/* ========================================
   Vibe Design — Vitalis-inspired UI
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Primitives — from Vitalis DS */
  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-100: #ccfbf1;
  --teal-50: #f0fdfa;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --red-500: #ef4444;
  --amber-500: #f59e0b;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-600: #d97706;
  --sky-500: #0ea5e9;

  /* Semantic */
  --fg-primary: var(--slate-900);
  --fg-secondary: var(--slate-500);
  --fg-tertiary: var(--slate-400);
  --fg-muted: var(--slate-300);
  --bg-page: #ffffff;
  --bg-surface: var(--slate-50);
  --bg-elevated: #ffffff;
  --border-default: rgba(0, 0, 0, 0.06);
  --border-emphasis: rgba(0, 0, 0, 0.1);
  --accent: var(--teal-600);
  --accent-light: var(--teal-50);
  --accent-border: var(--teal-100);

  /* Grid beams */
  --beam-color: var(--sky-500);
  --grid-color: rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--fg-primary);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

/* ---- Grid lines (background) ---- */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.grid-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--grid-color);
}
.grid-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grid-color);
}

/* Beams */
@keyframes beam-v {
  0% { top: -200px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes beam-h {
  0% { left: -200px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
.beam-v {
  position: absolute;
  width: 1px;
  height: 200px;
  background: linear-gradient(180deg, transparent, var(--beam-color), transparent);
  z-index: 1;
  opacity: 0;
}
.beam-h {
  position: absolute;
  height: 1px;
  width: 200px;
  background: linear-gradient(90deg, transparent, var(--beam-color), transparent);
  z-index: 1;
  opacity: 0;
}

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
}
.navbar-brand {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.navbar-brand span {
  font-weight: 400;
  color: var(--fg-tertiary);
}
/* User info + logout */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-email {
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  color: var(--fg-tertiary);
  letter-spacing: 0.02em;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--fg-tertiary);
  transition: all 0.2s ease;
  text-decoration: none;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.navbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-500);
}
.status-dot::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-400);
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}
.status-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.6875rem;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Language Switcher ---- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border: 1.5px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  background: none;
  opacity: 0.45;
  transition: all 0.15s ease;
}
.lang-flag:hover {
  opacity: 0.8;
  background: var(--slate-50);
}
.lang-flag.active {
  opacity: 1;
  border-color: var(--border-emphasis);
  background: var(--slate-50);
}
.lang-flag svg {
  border-radius: 2px;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.1);
}

/* ---- Layout ---- */
.page-content {
  position: relative;
  z-index: 10;
  max-width: 760px;
  margin: 0 auto;
  padding: 96px 24px 80px;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  margin-bottom: 48px;
}
.hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg-primary);
}
.hero h1 .accent {
  color: var(--accent);
}
.hero h1 .muted {
  color: var(--fg-tertiary);
}
.hero-subtitle {
  margin-top: 16px;
  font-size: 0.9375rem;
  color: var(--fg-secondary);
  line-height: 1.6;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- DS Label ---- */
.ds-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-tertiary);
  display: block;
  margin-bottom: 12px;
}

/* ---- Step Indicator ---- */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.3s ease;
}
.step-dot.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}
.step-dot.done {
  background: var(--teal-50);
  color: var(--accent);
  border: 1.5px solid var(--teal-100);
}
.step-dot.inactive {
  background: var(--slate-100);
  color: var(--fg-muted);
}
.step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.3s;
}
.step-label.active { color: var(--fg-primary); }
.step-label.inactive { color: var(--fg-muted); }
.step-line {
  width: 64px;
  height: 1px;
  background: var(--border-default);
  margin: 0 16px;
  transition: background 0.5s;
}
.step-line.active {
  background: var(--accent);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 32px;
  transition: border-color 0.2s;
}
.card:hover {
  border-color: var(--border-emphasis);
}
.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-primary);
  margin-bottom: 4px;
}
.card-desc {
  font-size: 0.8125rem;
  color: var(--fg-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ---- Info Card (limitations) ---- */
.info-card {
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.info-card-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--amber-600);
  margin-top: 1px;
}
.info-card-content {
  flex: 1;
}
.info-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--amber-600);
  margin-bottom: 4px;
}
.info-card-text {
  font-size: 0.75rem;
  color: var(--slate-700);
  line-height: 1.6;
}
.info-card-text code {
  font-family: 'Space Mono', monospace;
  font-size: 0.6875rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Success info card variant */
.info-card.success {
  background: var(--teal-50);
  border-color: var(--teal-100);
}
.info-card.success .info-card-icon { color: var(--accent); }
.info-card.success .info-card-title { color: var(--accent); }

/* ---- Form Controls ---- */
.input {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--fg-primary);
  background: var(--slate-50);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder {
  color: var(--fg-muted);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.08);
}

.select {
  padding: 12px 16px;
  font-size: 0.8125rem;
  font-family: 'Inter', sans-serif;
  color: var(--fg-secondary);
  background: var(--slate-50);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.select:focus {
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row .input { flex: 1; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--slate-900);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-primary:hover {
  background: var(--slate-700);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--border-emphasis);
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}
.btn-accent:hover {
  background: var(--teal-500);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.3);
}
.btn-accent:active { transform: scale(0.98); }
.btn-accent:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}
.btn-text:hover { color: var(--teal-500); }
.btn-text svg { width: 14px; height: 14px; }

/* ---- File List ---- */
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: var(--fg-secondary);
  background: var(--slate-50);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  transition: background 0.15s;
}
.file-card:hover {
  background: var(--slate-100);
}
.file-icon {
  width: 16px;
  height: 16px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

/* ---- Loading / Progress ---- */
.loading-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--slate-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 0.8125rem;
  color: var(--fg-secondary);
}
.progress-track {
  margin-top: 12px;
  width: 100%;
  height: 3px;
  background: var(--slate-100);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s ease;
  width: 0%;
}

/* ---- Error ---- */
.error-box {
  margin-top: 16px;
  padding: 14px 18px;
  font-size: 0.8125rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  line-height: 1.5;
}

/* ---- Results ---- */
.results-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.results-actions > * { flex: 1; }

/* ---- Hidden ---- */
.hidden { display: none !important; }

/* ---- Animations ---- */
@keyframes reveal-up {
  0% { clip-path: inset(100% 0 0 0); transform: translateY(16px); opacity: 0; }
  100% { clip-path: inset(0 0 0 0); transform: translateY(0); opacity: 1; }
}
.animate-reveal {
  opacity: 0;
  animation: reveal-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeIn 0.35s ease forwards;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 4px; }

/* ---- Selection ---- */
::selection {
  background: var(--teal-100);
  color: var(--accent);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .form-row { flex-direction: column; }
  .results-actions { flex-direction: column; }
  .card { padding: 24px; }
  .page-content { padding: 80px 16px 60px; }
  .grid-bg { display: none; }
}
