/* Best5AutoInsurance – Auto Insurance quiz v1 (design inspired by QuoteWizard, Best5 branding) */
:root {
  --navy: #183b5f;      /* logo navy – headings */
  --blue: #1b4b96;      /* Best5 CTA blue */
  --blue-dark: #143a75;
  --tile: #edf3fa;      /* answer buttons */
  --tile-hover: #dce8f6;
  --gold: #c49a4c;      /* logo gold – progress */
  --ink: #1f2a37;
  --muted: #5b6673;
  --line: #e2e6eb;
  --bg: #f1f4f8;
  --white: #fff;
  --error: #c62828;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Footer always at the bottom of the screen */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }

[hidden] { display: none !important; }

/* ---------- Header ---------- */
/* Logo on the left, lined up with the content column (.page: max 760px + 16px padding) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, calc((100% - 760px) / 2 + 16px));
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar__logo { display: block; width: 116px; height: auto; }

.why-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.why-btn:hover { color: var(--blue); }
/* Like QuoteWizard: no "Why We Ask" on the first (ZIP) screen */
body[data-step="1"] .why-btn { visibility: hidden; }
.why-btn__text { display: none; }

/* ---------- "Why we ask" popover ---------- */
.why {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 22px 24px 24px;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 30, 50, .25);
  color: var(--ink);
}
.why::backdrop { background: rgba(20, 30, 45, .45); }
.why__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.why__title { margin: 0; font-size: 20px; color: var(--navy); }
.why__close { padding: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.why__item { display: none; margin: 0 0 16px; color: var(--muted); }
body[data-why="vehicle"] .why__item[data-for="vehicle"],
body[data-why="multi"] .why__item[data-for="multi"],
body[data-why="insurer"] .why__item[data-for="insurer"],
body[data-why="driver"] .why__item[data-for="driver"],
body[data-why="age"] .why__item[data-for="age"],
body[data-why="contact"] .why__item[data-for="contact"],
body[data-why="address"] .why__item[data-for="address"] { display: block; }
.why__more { padding-top: 16px; border-top: 1px solid var(--line); }
.why__sub { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
.why__more p { margin: 0; color: var(--muted); }

/* ---------- Page + progress ---------- */
/* min-height: the footer never shows above the fold (Alex) */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.back-btn:hover { color: var(--blue); }
body[data-step="1"] .back-btn { display: none; }

.progress { margin-bottom: 16px; }
.progress__track { height: 10px; border-radius: 99px; background: #e3e7ec; overflow: hidden; }
.progress__fill { height: 100%; width: 4%; border-radius: inherit; background: var(--gold); transition: width .35s ease; }
.progress__label { margin: 6px 0 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--navy); }

/* ---------- Card + steps ---------- */
.card {
  padding: 20px 16px 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step { display: none; }
.step.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step__headline {
  margin: 0 0 18px;
  font-size: 23px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--navy);
  text-wrap: balance;
}
.step__title {
  display: block;
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
.step__headline + .step__title { font-size: 17px; margin-bottom: 10px; }

/* ---------- Answer buttons ---------- */
.options { display: grid; gap: 8px; }
.options--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options--years { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.options--months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options--days { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.options--stack { grid-template-columns: 1fr; }

.opt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--tile);
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.opt:hover { background: var(--tile-hover); }
.opt:active, .opt:focus-visible { border-color: var(--blue); outline: none; }
.options--stack .opt { min-height: 60px; font-size: 17px; }
.options--days .opt { min-height: 46px; padding: 6px 2px; }
.options--two .opt { font-size: 14px; }

.opt--loading {
  pointer-events: none;
  background: linear-gradient(90deg, #f0f2f5 25%, #e6e9ee 50%, #f0f2f5 75%) 0 0 / 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.load-error { grid-column: 1 / -1; margin: 0; color: var(--error); }

/* ---------- Vehicle list (step 5) ---------- */
.vehicles { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.vehicles__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  font-size: 14px;
  font-weight: 500;
}
.vehicles__remove { flex: none; padding: 2px; border: 0; background: none; color: var(--blue); cursor: pointer; }

/* ---------- Fields ---------- */
.field { margin-bottom: 4px; }
.field__label { display: block; margin: 0 0 6px; font-size: 17px; font-weight: 600; color: var(--ink); }
.field:focus-within .field__label { color: var(--blue); }

.input {
  display: block;
  width: 100%;
  height: 60px;
  padding: 0 16px;
  border: 1px solid #d5dae0;
  border-radius: var(--radius);
  background: #f3f4f6;
  color: var(--blue);
  font-size: 18px;
  font-weight: 600;
}
.input::placeholder { font-weight: 400; }
.input::placeholder { color: #9aa3ad; }
.input:focus { outline: none; border-color: var(--blue); background: var(--white); box-shadow: 0 0 0 3px rgba(27, 75, 150, .15); }

.field--short { max-width: 260px; }
/* Birth Year field as wide as the Continue button (Alex) */
#dobYearForm .field--year,
#dobYearForm .cta { width: 100%; max-width: 320px; }
.input--year { text-align: center; font-size: 22px; letter-spacing: .08em; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  background: #f3f4f6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%231b4b96' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
}
.field--select { margin-top: 16px; }

.field__error { display: none; margin: 6px 0 0; font-size: 13px; color: var(--error); }
.field.has-error .input { border-color: var(--error); background: #fff7f7; }
.field.has-error .field__error { display: block; }

.fields-grid { display: grid; gap: 14px; }

/* ---------- CTA ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 20px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background-color .15s;
}
.cta:hover { background: var(--blue-dark); }
.cta:focus-visible { outline: 3px solid rgba(27, 75, 150, .35); outline-offset: 2px; }
.cta__arrow { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Last step ---------- */
.last-step {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--tile);
  font-size: 14px;
  color: var(--muted);
}
.last-step p { margin: 0 0 6px; }
.last-step__title { font-size: 20px; font-weight: 700; color: var(--navy); }
.last-step__secure { display: flex; align-items: center; gap: 6px; margin: 0 !important; font-weight: 600; color: var(--navy); }

.demo-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
}

.tcpa { margin-top: 16px; font-size: 11px; line-height: 1.55; color: var(--muted); }
.tcpa p { margin: 0; }
.tcpa a { color: var(--blue); }

/* ---------- Trust + providers ---------- */
/* Under CHECK RATES (Alex) */
.trust__line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--ink);
}
.trust__line svg { flex: none; color: var(--blue); }

.providers { margin-top: 28px; padding-top: 22px; border-top: 1px dashed var(--line); text-align: center; }
/* Insurer logos only on the ZIP and Vehicle Year screens (Alex) */
body:not([data-step="1"]):not([data-step="2"]) .providers { display: none; }
.providers__title { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.providers__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.providers__list { align-items: center; }
.providers__list li { display: flex; align-items: center; justify-content: center; min-height: 58px; }
.provider-logo { display: block; max-width: 100%; height: auto; }

/* ---------- Footer ---------- */
.legal {
  margin-top: 150px; /* extra space above the footer (Alex) */
  padding: 14px 16px 18px;
  background: #666;
  color: var(--white);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 11px;
  text-align: center;
}
.legal__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.legal a { color: var(--white); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal__copy { margin: 0; }

/* ---------- Larger screens ---------- */
@media (min-width: 480px) {
  .options--years { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .options--months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .options--days { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cta { width: auto; }
  .cta--wide { width: 100%; }
  .trust__line { justify-content: flex-start; }
}

@media (min-width: 768px) {
  body { background: var(--white); }
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .topbar__logo { width: 150px; }
  .why-btn__text { display: inline; }
  .page { padding-top: 36px; }
  .progress { margin-bottom: 28px; }
  /* Fixed question area, like QuoteWizard – trust + providers sit lower and the page fills the screen */
  .card { min-height: 520px; padding: 0; border: 0; border-radius: 0; }
  .input { height: 68px; font-size: 20px; }
  .field--short { max-width: 280px; }
  .cta { min-height: 60px; font-size: 18px; }
  .providers__list { gap: 10px 36px; }
  .step__headline { font-size: 30px; }
  .step__title { font-size: 24px; }
  .step__headline + .step__title { font-size: 20px; }
  .options--years { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .options--months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .options--days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .options--two .opt { font-size: 15px; }
  .options--stack { max-width: 460px; }
  .fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .cta--wide { width: auto; }
  .trust__line { font-size: 16px; }
  .providers { margin-top: 40px; padding-top: 28px; }
  .providers { margin-top: 28px; }
  .providers__title { font-size: 17px; }
}
