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

:root {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --border:    #d2d2d7;
  --accent:    #0071e3;
  --accent-dk: #0058b0;
  --text:      #1d1d1f;
  --sub:       #6e6e73;
  --danger:    #ff3b30;
  --success:   #30d158;
  --radius:    14px;
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --transition:160ms ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Layout ──────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 48px;
  flex: 1;
}

/* ── Logo / Header ───────────────────────────────────────── */
.logo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.logo-bar .icon {
  width: 40px; height: 40px;
  background: var(--text);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
}
.logo-bar .brand { font-size: 17px; font-weight: 600; }
.logo-bar .sub   { font-size: 13px; color: var(--sub); margin-top: 1px; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}

/* ── Step container ──────────────────────────────────────── */
.step {
  display: none;
  animation: fadeUp 220ms ease forwards;
}
.step.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.step-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 20px;
}

/* ── Option cards ────────────────────────────────────────── */
.options { display: flex; flex-direction: column; gap: 10px; }

.option-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  user-select: none;
}
.option-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.option-card:active { transform: scale(.98); }
.option-card.selected {
  border-color: var(--accent);
  background: #f0f6ff;
}
.option-card .opt-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}
.option-card .opt-sub {
  font-size: 13px;
  color: var(--sub);
  line-height: 1.4;
}
.option-card .opt-notes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  list-style: none;
}
.option-card .opt-notes li {
  font-size: 13px;
  color: var(--sub);
  padding: 2px 0 2px 14px;
  position: relative;
  line-height: 1.45;
}
.option-card .opt-notes li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* 2-column grid for product type */
.options.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.options.grid-2 .option-card { padding: 20px 14px; text-align: center; }
.options.grid-2 .option-card .opt-title { font-size: 15px; }

/* ── Decision tree Q&A ───────────────────────────────────── */
.dtree-q {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.dtree-q .q-text { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.dtree-q .q-sub  { font-size: 13px; color: var(--sub); font-weight: 400; }
.dtree-btns { display: flex; gap: 8px; }
.dtree-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}
.dtree-btn:hover, .dtree-btn.selected { border-color: var(--accent); background: #f0f6ff; color: var(--accent); }
.dtree-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Insurance comparison table ──────────────────────────── */
.ins-compare {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ins-compare table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ins-compare th {
  background: var(--bg);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--sub);
  border-bottom: 1px solid var(--border);
}
.ins-compare td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ins-compare tr:last-child td { border-bottom: none; }
.ins-compare td:first-child { color: var(--sub); }
.ins-compare td:not(:first-child) { font-weight: 600; }

/* ── Result page ─────────────────────────────────────────── */
.result-hero {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.result-hero .product-name { font-size: 15px; color: var(--sub); margin-bottom: 4px; }
.result-hero .cost-label   { font-size: 14px; color: var(--sub); margin-bottom: 4px; }
.result-hero .cost-value   { font-size: 40px; font-weight: 700; color: var(--text); line-height: 1.1; }
.result-hero .savings-badge {
  display: inline-block;
  margin-top: 10px;
  background: #e8f5e9;
  color: #1b5e20;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: 600;
}

.result-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.result-section .rs-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sub);
  margin-bottom: 10px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-row .rr-label { color: var(--sub); }
.result-row .rr-value { font-weight: 600; }

.gift-list { list-style: none; }
.gift-list li {
  font-size: 14px;
  padding: 5px 0 5px 16px;
  position: relative;
  color: var(--sub);
  border-bottom: 1px solid var(--border);
}
.gift-list li:last-child { border-bottom: none; }
.gift-list li::before { content: '🎁'; position: absolute; left: 0; font-size: 12px; }

.note-box {
  background: #fff8e1;
  border-left: 3px solid #ffc107;
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  font-size: 13px;
  color: #5d4037;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── Privacy / info box ──────────────────────────────────── */
.info-box {
  background: #e8f0fe;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: #1a237e;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── Form inputs ─────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  transition: border-color var(--transition);
  color: var(--text);
  -webkit-appearance: none;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--sub); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  letter-spacing: .01em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover  { background: var(--accent-dk); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  margin-top: 10px;
}
.btn-secondary:hover { background: #f0f6ff; }
.btn-danger {
  background: transparent;
  color: var(--sub);
  border: none;
  font-size: 14px;
  margin-top: 8px;
}

.btn-group { margin-top: 24px; }

/* ── Login page ──────────────────────────────────────────── */
.login-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 80dvh;
}
.login-hero { text-align: center; margin-bottom: 36px; }
.login-hero .icon-big {
  font-size: 52px;
  margin-bottom: 12px;
}
.login-hero h1 { font-size: 26px; font-weight: 700; }
.login-hero p  { font-size: 15px; color: var(--sub); margin-top: 6px; line-height: 1.5; }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

/* ── Thank you page ──────────────────────────────────────── */
.thankyou-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  text-align: center;
}
.thankyou-wrap .icon-big { font-size: 64px; margin-bottom: 16px; }
.thankyou-wrap h2 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.thankyou-wrap p  { font-size: 15px; color: var(--sub); line-height: 1.6; }

/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ─────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.text-sub { color: var(--sub); font-size: 14px; }
