/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #8B1A1A;
  --red-dark:   #6d1414;
  --red-light:  #fdf1f1;
  --border:     #dde1e9;
  --text:       #1a202c;
  --muted:      #6b7280;
  --error:      #c53030;
  --bg:         #f4f6f9;
  --white:      #ffffff;
  --radius:     12px;
  --radius-sm:  8px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Progress nav ────────────────────────────────────────────────────── */
.progress-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 8px;
}

.progress-inner {
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.step.active .step-circle {
  border-color: var(--red);
  background: var(--red);
}
.step.completed .step-circle {
  border-color: var(--red);
  background: var(--red);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--white);
}

.step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}

.step-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.step.active .step-label,
.step.completed .step-label {
  color: var(--red);
  font-weight: 700;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 6px 16px;
  transition: background 0.25s;
  border-radius: 1px;
}
.step-line.filled { background: var(--red); }

/* ── Form wrap ───────────────────────────────────────────────────────── */
.form-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

/* ── Field stack ─────────────────────────────────────────────────────── */
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.005em;
}

.req {
  color: var(--red);
  margin-left: 1px;
}

/* ── Base input ──────────────────────────────────────────────────────── */
.field-input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.field-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.12);
}

.field-input.has-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.10);
}

.field-input::placeholder { color: #aab0bc; }

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

/* ── Searchable-select trigger ───────────────────────────────────────── */
.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ss-trigger:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.12);
}

.ss-trigger.has-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.10);
}

.ss-value {
  font-size: 16px;
  color: #aab0bc;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.ss-value.chosen { color: var(--text); }

.ss-chevron {
  color: var(--muted);
  flex-shrink: 0;
  margin-left: 8px;
  transition: transform 0.2s;
}
.ss-trigger[aria-expanded="true"] .ss-chevron { transform: rotate(180deg); }

/* ── Modal overlay ───────────────────────────────────────────────────── */
.ss-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ss-modal-inner {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp 220ms cubic-bezier(0.34, 1.1, 0.64, 1);
  overflow: hidden;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0);    }
}

.ss-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ss-modal-header .ss-search {
  flex: 1;
  height: 44px;
  font-size: 16px;
  border-radius: var(--radius-sm);
}

.ss-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.ss-close:active { background: var(--border); }

.ss-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1;
}

.ss-list li {
  padding: 15px 18px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}
.ss-list li:last-child { border-bottom: none; }
.ss-list li:active { background: var(--red-light); }

.ss-list li mark {
  background: none;
  color: var(--red);
  font-weight: 700;
}

.ss-list .ss-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  cursor: default;
  padding: 24px 18px;
  border-bottom: none;
}
.ss-list .ss-empty:active { background: none; }

/* ── Phone row ───────────────────────────────────────────────────────── */
.phone-row {
  display: flex;
  gap: 8px;
}

.phone-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 52px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.phone-code-btn:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.12);
}
.phone-code-btn:active { background: var(--bg); }
.phone-code-btn svg { color: var(--muted); }

.phone-num-input { flex: 1; min-width: 0; }

/* ── Arrival date pills ──────────────────────────────────────────────── */
.date-pills {
  display: flex;
  gap: 8px;
}

.date-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 11px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.date-pill.selected {
  border-color: var(--red);
  background: var(--red-light);
}

.dp-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.dp-date {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.date-pill.selected .dp-label { color: var(--red); }
.date-pill.selected .dp-date  { color: var(--red); opacity: 0.8; }

/* ── Radio pills ─────────────────────────────────────────────────────── */
.radio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 80px;
  height: 48px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.radio-pill input[type="radio"] { display: none; }
.radio-pill.selected {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
  font-weight: 700;
}
.radio-pill:active { background: var(--red-light); }

/* ── Inline field error ──────────────────────────────────────────────── */
.field-error {
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  display: none;
  line-height: 1.4;
}

/* ── Form-level error banner ─────────────────────────────────────────── */
.form-error {
  background: #fff5f5;
  border: 1.5px solid #feb2b2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--error);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Primary button ──────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 12px;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active   { background: var(--red-dark); transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-arrow { font-size: 18px; line-height: 1; }

/* ── Back button ─────────────────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.btn-back:active { color: var(--text); }

/* ── Terms checkbox ──────────────────────────────────────────────────── */
.terms-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.6;
  margin-bottom: 16px;
}
.terms-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  accent-color: var(--red);
  margin-top: 1px;
}
.terms-label a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── SSL note ────────────────────────────────────────────────────────── */
.ssl-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Wait note ───────────────────────────────────────────────────────── */
.wait-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Desktop (≥ 768px) ───────────────────────────────────────────────── */
@media (min-width: 768px) {
  body {
    background: var(--bg);
    padding: 40px 24px 60px;
  }

  /* Sticky → static on desktop; card top */
  .progress-nav {
    position: static;
    max-width: 780px;
    margin: 0 auto;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 16px 40px 14px;
  }

  .progress-inner { max-width: 100%; }

  /* White card body */
  .form-wrap {
    max-width: 780px;
    margin: 0 auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    padding: 36px 40px 48px;
  }

  .page-title { font-size: 28px; }

  /* 2-column field pairs */
  .field-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Modal: centered dialog instead of bottom sheet */
  .ss-modal { align-items: center; }
  .ss-modal-inner {
    border-radius: 16px;
    max-width: 480px;
    max-height: 70dvh;
    animation: fadeSlide 180ms cubic-bezier(0.34, 1.1, 0.64, 1);
  }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
