/* ==========================================================================
   FastAutoQuote v5 — EverQuote-inspired Design System
   Scoped under .v5-page so it doesn't bleed into v1-v4.
   ========================================================================== */

.v5-page {
    --c-navy: #12256D;
    --c-navy-deep: #0B1A55;
    --c-pale: #8EC4F6;
    --c-pale-bg: #EAF3FB;
    --c-text: #1A1A1A;
    --c-text-muted: #4f4747;
    --c-text-light: #7d7878;
    --c-border: #d9d9d9;
    --c-border-light: #ECECEC;
    --c-bg: #ffffff;
    --c-bg-stage: #f6f7f9;
    --c-white: #ffffff;
    --c-error: #c41e3a;
    --c-success: #2e7d32;

    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;

    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--c-text);
    background: var(--c-bg-stage);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
.v5-page *, .v5-page *::before, .v5-page *::after { box-sizing: border-box; }
.v5-page button { font-family: inherit; cursor: pointer; }

/* Hide global site-header on v5 routes (uses its own) */
.page-wrapper:has(.v5-page) > .site-header { display: none !important; }
.page-wrapper:has(.v5-page) .content { padding: 0 !important; }
.page-wrapper:has(.v5-page) > footer { display: none !important; }

/* Header */
.v5-header {
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border);
    padding: 12px 16px;
}
.v5-header__inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.v5-logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--c-navy);
    letter-spacing: -0.01em;
}

/* Layout */
.v5-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--c-bg-stage); }
.v5-main { flex: 1; width: 100%; max-width: 540px; margin: 0 auto; padding: 28px 16px 80px; }
@media (min-width: 1024px) { .v5-main { padding-top: 32px; } }

/* Progress bar (simple thin blue bar like EQ) */
.v5-progress {
    height: 4px;
    background: var(--c-border-light);
    border-radius: 999px;
    margin: 0 0 32px;
    overflow: hidden;
}
.v5-progress__fill {
    height: 100%;
    background: var(--c-navy);
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

/* Headlines */
.v5-h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--c-navy);
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.2;
    text-wrap: balance;
}
.v5-sub {
    font-size: 15px;
    color: var(--c-text-muted);
    text-align: center;
    margin: -16px 0 28px;
    line-height: 1.5;
    text-wrap: balance;
}

/* ZIP input (landing) */
.v5-zip-row { display: flex; gap: 0; margin: 8px auto 0; max-width: 460px; }
.v5-zip-input {
    flex: 1;
    height: 56px;
    padding: 0 18px;
    font-size: 17px;
    font-weight: 500;
    color: var(--c-text);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-right: 0;
    border-radius: var(--r-md) 0 0 var(--r-md);
    outline: none;
    font-family: inherit;
}
.v5-zip-input:focus { border-color: var(--c-navy); box-shadow: -2px 0 0 0 var(--c-navy) inset; }
.v5-zip-input::placeholder { color: var(--c-text-light); }
.v5-zip-btn {
    height: 56px;
    padding: 0 28px;
    background: var(--c-navy);
    color: var(--c-white);
    border: 0;
    border-radius: 0 var(--r-md) var(--r-md) 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.v5-zip-btn:hover { background: var(--c-navy-deep); }
.v5-zip-btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* Option buttons / radio cards */
.v5-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.v5-options.cols-3 { grid-template-columns: repeat(3, 1fr); }
.v5-options.cols-4 { grid-template-columns: repeat(4, 1fr); }
.v5-options.cols-1 { grid-template-columns: 1fr; gap: 12px; }

.v5-option {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 18px 14px;
    font-size: 16px;
    font-weight: 500;
    color: var(--c-text);
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 56px;
    position: relative;
    font-family: inherit;
}
.v5-option:hover { border-color: var(--c-navy); background: var(--c-pale-bg); }
.v5-option.is-selected { border-color: var(--c-navy); background: var(--c-pale-bg); border-width: 2px; padding: 17px 13px; }

/* Make option with logo */
.v5-option--logo { flex-direction: column; gap: 6px; padding: 14px 8px; min-height: 88px; }
.v5-option--logo img { width: 48px; height: 36px; object-fit: contain; }
.v5-option--logo .label { font-size: 13px; font-weight: 600; }

/* Toggle: Car / Motorcycle on make page */
.v5-toggle {
    display: inline-flex;
    background: var(--c-bg-stage);
    border-radius: 999px;
    padding: 4px;
    margin: 0 auto 20px;
}
.v5-toggle button {
    padding: 8px 18px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-muted);
    cursor: pointer;
}
.v5-toggle button.is-active { background: var(--c-white); color: var(--c-navy); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Inputs (text/email/phone) */
.v5-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    outline: none;
}
.v5-input:focus { border-color: var(--c-navy); }
.v5-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .v5-input-row { grid-template-columns: 1fr; } }
.v5-input-label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text-muted); margin-bottom: 6px; }

/* DOB three-dropdown */
.v5-dob { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr; gap: 8px; max-width: 360px; margin: 0 auto; }
.v5-dob select { width: 100%; padding: 14px 12px; font-size: 16px; font-weight: 500; color: var(--c-text); background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-md); outline: none; appearance: none; -webkit-appearance: none; cursor: pointer; font-family: inherit; text-align: center; padding-right: 28px; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237d7878' d='M6 9L1 4h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.v5-dob select:focus { border-color: var(--c-navy); }

/* Buttons */
.v5-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--c-navy);
    color: var(--c-white);
    border: 0;
    border-radius: var(--r-md);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 50px;
    font-family: inherit;
}
.v5-btn:hover { background: var(--c-navy-deep); }
.v5-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.v5-btn--block { width: 100%; }

.v5-back { background: none; border: 0; color: var(--c-text-muted); font-size: 13px; font-weight: 500; cursor: pointer; padding: 6px 0; font-family: inherit; margin-top: 24px; }
.v5-back:hover { color: var(--c-text); }

/* Carriers strip on landing */
.v5-carriers { margin: 36px auto 0; max-width: 600px; }
.v5-carriers__label { font-size: 13px; color: var(--c-text-muted); text-align: center; margin-bottom: 16px; font-weight: 500; }
.v5-carriers__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 28px; }
.v5-carriers__row img { height: 28px; opacity: 0.85; }

/* Testimonials on landing */
.v5-testimonials { margin: 48px auto 0; max-width: 700px; }
.v5-testimonials__title { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--c-navy); text-align: center; font-size: 18px; margin-bottom: 24px; }
.v5-testimonial-card { background: var(--c-bg-stage); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.v5-testimonial-card__quote { font-size: 14px; line-height: 1.5; color: var(--c-text); margin-bottom: 12px; }
.v5-testimonial-card__author { font-size: 12px; color: var(--c-text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.v5-testimonial-card__author strong { color: var(--c-navy); }
.v5-testimonial-card__savings { background: var(--c-success); color: var(--c-white); padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 11px; }

/* Stat banner */
.v5-stat { background: var(--c-pale-bg); padding: 20px; border-radius: var(--r-lg); text-align: center; margin: 32px auto 0; max-width: 540px; }
.v5-stat strong { font-family: 'Montserrat', sans-serif; font-size: 22px; color: var(--c-navy); }
.v5-stat span { display: block; font-size: 13px; color: var(--c-text-muted); margin-top: 4px; }

/* Compliance / TCPA */
.v5-compliance { font-size: 11px; color: var(--c-text-muted); line-height: 1.5; margin: 16px auto; max-width: 460px; text-align: center; }
.v5-compliance a { color: var(--c-navy); }
.v5-tcpa { font-size: 11px; color: var(--c-text-muted); line-height: 1.5; margin-top: 16px; padding: 12px 14px; background: var(--c-bg-stage); border-radius: var(--r-sm); }
.v5-tcpa a { color: var(--c-navy); }

.v5-error { color: var(--c-error); font-size: 13px; text-align: center; margin: 8px 0; }

/* Defeat global validation styles */
.v5-page input.valid, .v5-page input.invalid, .v5-page input.modified {
    background-image: none !important;
    padding-right: 16px !important;
    outline: none !important;
}

/* ==========================================================================
   v5 funnel step page additions (steps 2-27)
   ========================================================================== */

/* ==========================================================================
   EverQuote-style top stack: white header → savings line → progress
   ========================================================================== */

/* White header bar with centered wordmark */
.v5-eq-header {
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border);
    padding: 14px 16px;
    text-align: center;
}
.v5-eq-logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0.02em;
    color: var(--c-navy);
    line-height: 1;
    display: inline-block;
}
.v5-eq-logo .accent {
    color: var(--c-pale);
    font-weight: 700;
}

/* Small navy savings text on white (no banner block) */
.v5-eq-savings {
    background: var(--c-white);
    color: var(--c-navy);
    text-align: center;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 14px 16px 10px;
    line-height: 1.3;
    letter-spacing: 0.005em;
}

/* Legacy banner class — now styled identically to .v5-eq-savings so any
   remaining markup blends with the new design instead of looking like a block. */
.v5-savings-banner {
    background: var(--c-white);
    color: var(--c-navy);
    text-align: center;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 14px 16px 10px;
    line-height: 1.3;
}

/* EQ-style progress: wider track with orange car mascot on the leading edge */
.v5-progress-wrap {
    background: var(--c-white);
    padding: 6px 16px 16px;
    border-bottom: 1px solid var(--c-border);
}
.v5-progress-track {
    position: relative;
    height: 8px;
    background: #E5E7EB;
    border-radius: 999px;
    max-width: 540px;
    margin: 0 auto;
    overflow: visible;
}
.v5-progress-fill {
    position: relative;
    height: 100%;
    background: var(--c-navy);
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.v5-progress-mascot {
    position: absolute;
    top: 50%;
    right: -16px;
    width: 36px;
    height: 22px;
    transform: translateY(-50%);
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 36'%3E%3Cpath fill='%23F47C2D' d='M6 26c0-4 3-7 7-7h2l4-9c1-2 3-3 5-3h20c2 0 4 1 5 3l3 6 6 1c2 0 4 2 4 4v5c0 2-2 4-4 4h-3a6 6 0 0 1-12 0H21a6 6 0 0 1-12 0H8a2 2 0 0 1-2-2v-2z'/%3E%3Ccircle cx='15' cy='28' r='4' fill='%231A1A1A'/%3E%3Ccircle cx='47' cy='28' r='4' fill='%231A1A1A'/%3E%3Cpath fill='%23BFD9F2' d='M24 12h11l3 6H22l2-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 2;
}
.v5-progress-pct {
    text-align: center;
    color: var(--c-text-light);
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
    font-family: 'DM Sans', sans-serif;
}

/* Progress bar variant used on step pages (matches EQ thin track) */
.v5-progress__bar {
    height: 100%;
    background: var(--c-navy);
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
    border-radius: 999px;
}

/* Back link top-left of main content */
.v5-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 0;
    color: var(--c-text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin: 0 0 14px;
    font-family: inherit;
    text-decoration: none;
}
.v5-back-link::before { content: "\2039"; font-size: 16px; line-height: 1; margin-top: -2px; }
.v5-back-link:hover { color: var(--c-navy); }

/* Step-page H1 — centered (matches EQ). */
.v5-page .v5-main .v5-back-link ~ .v5-h1,
.v5-page .v5-main .v5-back-link ~ * .v5-h1 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 24px;
}

/* Sub-headline (used on driver-count step, etc.) */
.v5-sublead {
    font-size: 14px;
    color: var(--c-text-muted);
    text-align: center;
    margin: -16px 0 24px;
    line-height: 1.5;
}

/* Stack option cards vertically (single-column) for funnel step pages */
.v5-options.v5-options--stack {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

/* Two-column variant for compact Y/N + counts */
.v5-options.v5-options--two {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

/* Four-column variant (counts 0/1/2/3+, years grid). EQ uses 3-up on mobile. */
.v5-options.v5-options--four {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
@media (min-width: 640px) {
    .v5-options.v5-options--four { grid-template-columns: repeat(4, 1fr); }
}

/* Make options left-aligned for stacked card list (EQ style) */
.v5-options--stack .v5-option {
    justify-content: flex-start;
    text-align: left;
    padding: 18px 20px;
    padding-right: 56px; /* room for radio circle */
}

/* All step-page option cards: left-aligned text + right-side outline circle.
   Applies to stack / two / four variants used on funnel steps. */
.v5-options--stack .v5-option,
.v5-options--two .v5-option,
.v5-options--four .v5-option {
    justify-content: flex-start;
    text-align: left;
    padding: 18px 20px;
    padding-right: 48px;
    color: var(--c-navy);
    font-weight: 600;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    min-height: 60px;
    position: relative;
}
.v5-options--four .v5-option {
    /* tighter padding for 4-col year/count grid */
    padding: 14px 14px;
    padding-right: 34px;
    min-height: 52px;
    font-size: 15px;
}
.v5-options--two .v5-option { padding-right: 48px; }

/* The outline radio circle on the right edge */
.v5-options--stack .v5-option::after,
.v5-options--two .v5-option::after,
.v5-options--four .v5-option::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--c-border);
    border-radius: 50%;
    background: var(--c-white);
    transform: translateY(-50%);
    transition: all 0.15s;
}
.v5-options--four .v5-option::after { right: 10px; width: 14px; height: 14px; }

.v5-options--stack .v5-option.is-selected::after,
.v5-options--two .v5-option.is-selected::after,
.v5-options--four .v5-option.is-selected::after {
    border-color: var(--c-navy);
    background: var(--c-navy);
    box-shadow: inset 0 0 0 3px var(--c-white);
}

/* Selected state — light blue bg with navy border */
.v5-option.is-selected {
    background: var(--c-pale-bg);
    border-color: var(--c-navy);
    border-width: 2px;
    padding-top: 17px;
    padding-bottom: 17px;
}
.v5-options--four .v5-option.is-selected {
    padding-top: 13px;
    padding-bottom: 13px;
}

/* Show More Years (step 2) link */
.v5-show-more {
    background: none;
    border: 0;
    color: var(--c-navy);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 12px;
    margin: 8px auto 0;
    display: block;
    font-family: inherit;
    text-decoration: underline;
}
.v5-show-more:hover { color: var(--c-navy-deep); }

/* Typeahead fallback (step 3 make, step 16 education) */
.v5-typeahead {
    margin: 18px auto 0;
    max-width: 460px;
}
.v5-typeahead select {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237d7878' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.v5-typeahead select:focus { border-color: var(--c-navy); }

/* Vehicle type tabs (Car/Motorcycle on step 3) */
.v5-vtype-tabs {
    display: inline-flex;
    background: var(--c-bg-stage);
    border-radius: 999px;
    padding: 4px;
    margin: 0 auto 20px;
    gap: 0;
}
.v5-vtype-tabs button {
    padding: 8px 22px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-muted);
    cursor: pointer;
}
.v5-vtype-tabs button.is-active {
    background: var(--c-white);
    color: var(--c-navy);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.v5-vtype-row { text-align: center; }

/* DOB inputs row (step 27) */
.v5-dob-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 360px;
    margin: 0 auto 18px;
}
.v5-dob-input {
    width: 70px;
    height: 56px;
    padding: 0 8px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    color: var(--c-text);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    outline: none;
    font-family: inherit;
}
.v5-dob-input--year { width: 96px; }
.v5-dob-input:focus { border-color: var(--c-navy); }
.v5-dob-sep {
    font-size: 22px;
    color: var(--c-text-light);
    font-weight: 400;
    user-select: none;
}
.v5-dob-error {
    color: var(--c-error);
    font-size: 14px;
    text-align: center;
    margin: 0 0 14px;
    font-weight: 500;
}
.v5-continue-row { display: flex; justify-content: center; margin-top: 8px; }
.v5-continue {
    min-width: 200px;
    height: 52px;
    padding: 0 36px;
    background: var(--c-navy);
    color: var(--c-white);
    border: 0;
    border-radius: var(--r-md);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.v5-continue:hover { background: var(--c-navy-deep); }
.v5-continue:disabled { opacity: 0.6; cursor: not-allowed; }
