/* ═══════════════════════════════════════════
   APPROACH AUTO MOBILITY — Brand Design System
   ═══════════════════════════════════════════ */

:root {
  --green:        #5CC884;
  --green-light:  #82EA96;
  --green-dark:   #3fa863;
  --white:        #FFFFFB;
  --dark:         #141414;
  --dark-2:       #1E1E1E;
  --dark-3:       #252525;
  --gray:         #898F89;
  --border:       rgba(255,255,255,0.08);
  --border-green: rgba(92,200,132,0.4);

  --font-head: 'Saira', sans-serif;
  --font-body: 'Titillium Web', sans-serif;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure full viewport height throughout the flex chain */
html { height: 100%; }

body {
  font-family: var(--font-body);
  background-color: var(--dark);
  color: var(--white);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* On supporting browsers use dvh so keyboard adjusts height correctly */
  min-height: 100dvh;
}

/* ── Background Grid ── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(92,200,132,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92,200,132,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%,
    rgba(92,200,132,0.08) 0%, transparent 70%);
}

/* ════════════════════════════════
   HEADER
   ════════════════════════════════ */
.site-header {
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

/* Full horizontal SVG — desktop */
.logo-full {
  height: 32px;
  width: auto;
  max-width: 220px;
  display: block;
}

/* Square icon mark — mobile only (hidden by default) */
.logo-icon {
  height: 34px;
  width: 34px;
  display: none;
  flex-shrink: 0;
}

/* Wordmark shown beside icon on mobile */
.logo-wordmark {
  display: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--white);
  line-height: 1.3;
  /* two lines: APPROACH / AUTO MOBILITY */
}

/* ════════════════════════════════
   CARD SHELL + CARD
   ════════════════════════════════ */
.card-shell {
  flex: 1;
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  /* allow scrolling only if content exceeds viewport */
  overflow-y: auto;
}

.card {
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 520px;
  padding: 36px 36px 44px;
  position: relative;
  /* don't clip child flex containers */
  overflow: visible;
}

/* Animated green accent line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, var(--green), var(--green-light), var(--green));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════
   HERO (Step 1 only)
   ════════════════════════════════ */
.hero-copy { margin-bottom: 24px; }

.hero-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 3rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-title .accent { color: var(--green); }

.hero-sub {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--gray);
  letter-spacing: 0.04em;
  font-style: italic;
}

/* ════════════════════════════════
   PROGRESS BAR
   ════════════════════════════════ */
.progress-wrap { margin-bottom: 28px; }

.progress-track {
  height: 4px;
  background: var(--dark-3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-light));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  width: 33.33%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
}

.ps {
  font-size: 0.7rem;
  color: var(--gray);
  letter-spacing: 0.06em;
  font-family: var(--font-head);
  font-weight: 500;
  transition: color 0.3s;
}
.ps.active { color: var(--green); }
.ps.done   { color: var(--green); opacity: 0.6; }

/* ════════════════════════════════
   FORM STEPS
   ════════════════════════════════ */
.form-step { display: none; }
.form-step.active {
  display: block;
  animation: slideIn 0.32s ease;
}
.form-step.going-back.active {
  animation: slideInBack 0.32s ease;
}

@keyframes slideIn     { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }
@keyframes slideInBack { from { opacity:0; transform:translateX(-20px);} to { opacity:1; transform:none; } }

.step-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.2;
  margin-bottom: 6px;
}

.step-desc {
  font-size: 0.88rem;
  color: var(--gray);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ════════════════════════════════
   LANGUAGE GRID
   ════════════════════════════════ */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 14px 8px;
  min-height: 62px;
  background: var(--dark-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  text-align: center;
  user-select: none;
  transition: border-color 0.18s, background 0.18s;
}

.lang-card input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}

.lang-card:hover         { border-color: var(--border-green); background: rgba(92,200,132,0.05); }
.lang-card.selected      { border-color: var(--green);        background: rgba(92,200,132,0.08); }

.lang-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--white);
  line-height: 1.2;
}

.lang-name-en {
  font-size: 0.68rem;
  color: var(--gray);
  line-height: 1;
}

.check-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}
.lang-card.selected .check-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(92,200,132,0.2);
}

/* ════════════════════════════════
   INPUT FIELDS
   ════════════════════════════════ */
.input-group {
  display: flex;
  align-items: center;
  background: var(--dark-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 10px;
}
.input-group:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(92,200,132,0.12);
}
.input-group.error { border-color: #e05555; }

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 52px;
  border-right: 1px solid var(--border);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--white);
  flex-shrink: 0;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 16px;
  height: 52px;
  font-family: var(--font-body);
  /* 16px minimum prevents iOS auto-zoom */
  font-size: 16px;
  color: var(--white);
  letter-spacing: 0.04em;
}
.input-group input::placeholder { color: var(--gray); }

.name-group input { padding: 0 18px; }

.field-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 18px;
  line-height: 1.45;
}
.field-hint svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; }

.error-msg {
  font-size: 0.75rem;
  color: #e05555;
  margin-top: -6px;
  margin-bottom: 12px;
  display: flex;
  gap: 5px;
  align-items: center;
}

/* ════════════════════════════════
   OTP
   ════════════════════════════════ */
.otp-sent-msg {
  font-size: 0.88rem;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 18px;
}

.otp-boxes {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.otp-box {
  flex: 1;
  height: 62px;
  background: var(--dark-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--green);
  /* keep keyboard numeric */
  -webkit-appearance: none;
}
.otp-box:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(92,200,132,0.15);
}
.otp-box.filled { border-color: var(--green); color: var(--green); }

.resend-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--gray);
  margin-bottom: 20px;
}
.timer-text { color: var(--green); font-weight: 600; }

/* ════════════════════════════════
   BUTTONS
   ════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.93rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--green);
  color: var(--dark);
  box-shadow: 0 4px 20px rgba(92,200,132,0.28);
}
.btn-primary:hover    { background: var(--green-light); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(92,200,132,0.42); }
.btn-primary:active   { transform: none; }
.btn-primary:disabled { opacity: 0.42; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-link {
  background: none;
  border: none;
  color: var(--green);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  transition: opacity 0.2s;
}
.btn-link:hover { opacity: 0.72; }

.back-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  /* grey out the back link to de-emphasise */
  color: var(--gray) !important;
  text-decoration: none !important;
}

/* Loading spinner */
.btn .spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(20,20,20,0.3);
  border-top-color: var(--dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════
   SUCCESS / CONFIRMATION
   ════════════════════════════════ */
.success-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.success-icon svg { width: 72px; height: 72px; }

.success-circle {
  stroke-dasharray: 240; stroke-dashoffset: 240;
  animation: drawCircle 0.6s ease forwards 0.1s;
}
.success-check {
  stroke-dasharray: 80; stroke-dashoffset: 80;
  animation: drawCheck 0.4s ease forwards 0.65s;
}
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck  { to { stroke-dashoffset: 0; } }

.success-title { text-align: center; font-size: 1.9rem; margin-bottom: 6px; }
.success-desc  { text-align: center; font-size: 0.88rem; color: var(--gray); margin-bottom: 22px; }

.success-detail {
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.sd-row {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  gap: 14px;
}
.sd-row + .sd-row { border-top: 1px solid var(--border); }
.sd-label {
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-transform: uppercase;
  min-width: 64px;
}
.sd-value {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
}
.success-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray);
  line-height: 1.5;
  padding: 12px 14px;
  background: rgba(92,200,132,0.06);
  border: 1px solid var(--border-green);
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════
   FOOTER
   ════════════════════════════════ */
.site-footer {
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.72rem;
  color: var(--gray);
  line-height: 1.8;
}
.footer-tagline { font-style: italic; opacity: 0.55; }

/* ── Utility ── */
.hidden { display: none !important; }


/* ════════════════════════════════════════════════════
   MOBILE  ≤ 430px  (iPhone 12 mini = 375 × 812)
   Goal: fit every step in one screen — no scroll
   ════════════════════════════════════════════════════ */
@media (max-width: 430px) {

  /* ── Lock body to screen height ── */
  html, body {
    height: 100dvh;
    overflow: hidden;
  }

  /* ── Compact header, switch to icon mark ── */
  .site-header {
    padding: 10px 16px;
    gap: 8px;
  }

  /* Hide full horizontal logo, show icon + wordmark */
  .logo-full     { display: none; }
  .logo-icon     { display: block; }
  .logo-wordmark { display: block; }

  /* ── Card fills full remaining height, edge-to-edge ── */
  .card-shell {
    padding: 0;
    align-items: stretch;      /* stretch card to full height */
    overflow: hidden;          /* prevent shell from scrolling */
  }

  .card {
    /* full bleed */
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    max-width: 100%;
    padding: 18px 18px 0;
    overflow-y: auto;          /* scroll within card if needed */
    overflow-x: hidden;
    /* fill shell height */
    display: flex;
    flex-direction: column;
  }

  /* ── Hero ── */
  .hero-copy { margin-bottom: 14px; }
  .hero-title { font-size: 2.2rem; }
  .hero-sub   { font-size: 0.75rem; margin-top: 3px; }

  /* ── Progress ── */
  .progress-wrap { margin-bottom: 14px; }

  /* ── Step titles ── */
  .step-title    { font-size: 1.3rem; }
  .step-desc     { font-size: 0.8rem; margin-bottom: 12px; }

  /* ── Active step fills rest of card (pushes button down) ── */
  .form-step.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-bottom: 20px;  /* breathing room at the bottom */
  }

  /* ── Language grid: 4 cols × 2 rows ── */
  .lang-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 14px;
  }

  .lang-card {
    padding: 8px 4px;
    min-height: 50px;
    border-radius: var(--radius-sm);
    gap: 1px;
  }
  .lang-name    { font-size: 0.72rem; }
  .lang-name-en { font-size: 0.57rem; }
  .check-dot    { top: 5px; right: 5px; width: 6px; height: 6px; }

  /* Step 1 button sits naturally after grid — no push needed */

  /* ── Phone & OTP step: sub-panels fill & push button down ── */
  #phoneEntry,
  #otpEntry {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  /* Primary button pushed to bottom of its panel */
  #sendOtpBtn,
  #verifyOtpBtn,
  #submitBtn {
    margin-top: auto;
  }

  /* back-link follows button naturally */
  .back-link { margin-top: 10px; font-size: 0.78rem; }

  /* ── Input heights ── */
  .phone-prefix,
  .input-group input { height: 48px; }

  .field-hint { font-size: 0.7rem; margin-bottom: 12px; }

  /* ── OTP boxes ── */
  .otp-sent-msg { font-size: 0.78rem; margin-bottom: 12px; }

  .otp-boxes { gap: 10px; margin-bottom: 10px; }

  .otp-box {
    height: 56px;
    font-size: 1.45rem;
    border-radius: var(--radius-sm);
  }

  .resend-hint { margin-bottom: 12px; font-size: 0.72rem; }

  /* ── Buttons ── */
  .btn { padding: 13px 18px; font-size: 0.85rem; }

  /* ── Success ── */
  .success-icon         { margin-bottom: 12px; }
  .success-icon svg     { width: 54px; height: 54px; }
  .success-title        { font-size: 1.45rem; }
  .success-desc         { margin-bottom: 12px; }
  .sd-row               { padding: 10px 14px; }
  .success-detail       { margin-bottom: 12px; }
  .success-note         { font-size: 0.72rem; padding: 10px 12px; }

  /* ── Hide footer on mobile to save space ── */
  .site-footer { display: none; }
}

/* ── Very narrow (≤ 360px) ── */
@media (max-width: 360px) {
  .hero-title { font-size: 1.9rem; }
  .lang-name  { font-size: 0.65rem; }
  .otp-box    { height: 50px; font-size: 1.25rem; }
}
