/* ============================================================
   Carniverse — Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Roboto:wght@400;500;700&display=swap');

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

:root {
    --navy:        #102A43;
    --navy-dk:     #0a1c2e;
    --orange:      #79a1b8;
    --orange-dk:   #5f8aa4;
    --orange-light:#eef4f8;
    --green:       #34a853;
    --red:         #ea4335;
    --text:        #102A43;
    --muted:       #4a6080;
    --border:      #d0dae8;
    --bg:          #F0F4F8;
    --white:       #ffffff;
    --shadow:      0 1px 6px rgba(16,42,67,.10);
    --radius:      8px;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4,
.card-title,
.auth-card h2,
.page-header h1 {
    font-family: 'Montserrat', Arial, sans-serif;
}

/* ── NAV ── */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: 1px;
}
.nav-logo img {
    height: 44px;
    width: auto;
    display: block;
    object-fit: contain;
}
.nav-links { display: flex; align-items: center; gap: 12px; }
.nav-links a {
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: background .15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links .btn-nav {
    background: var(--orange);
    color: var(--navy) !important;
    font-weight: 500;
}
.nav-links .btn-nav:hover { background: var(--orange-dk); }

/* ── MAIN LAYOUT ── */
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── HERO BANNER ── */
.hero-banner {
    position: relative;
    width: 100%;
    height: clamp(280px, 40vw, 420px);
    background: url('../img/hero-bg.jpg') center 55% / cover no-repeat;
    display: flex;
    align-items: center;
    padding: 0 clamp(24px, 5vw, 72px);
    overflow: hidden;
}
.hero-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(10,28,52,.72) 0%, rgba(10,28,52,.35) 70%, rgba(10,28,52,.05) 100%);
    pointer-events: none;
}
.hero-overlay {
    position: relative;
    z-index: 1;
}
.hero-overlay h1 {
    font-size: clamp(28px, 4.5vw, 52px);
    font-weight: 800;
    color: var(--white);
    line-height: 1.15;
    margin-bottom: 12px;
    text-shadow: 0 2px 16px rgba(0,0,0,.25);
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.hero-overlay p {
    font-size: clamp(15px, 2.5vw, 20px);
    color: rgba(255,255,255,.85);
    max-width: 560px;
}

/* ── HERO (fallback) ── */
.hero {
    text-align: center;
    padding: 56px 20px 32px;
}
.hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
    margin-bottom: 12px;
}
.hero p {
    font-size: 17px;
    color: var(--muted);
    max-width: 560px;
    margin: 0 auto 8px;
}

/* ── CARDS ── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--navy);
}
.card-title-hero {
    background: var(--navy);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    font-family: 'Montserrat', Arial, sans-serif;
    padding: 20px 28px;
    border-radius: var(--radius) var(--radius) 0 0;
    letter-spacing: -.3px;
}

/* Full navy card */
.card-navy {
    background: var(--navy) !important;
    border-color: var(--navy) !important;
}
.card-navy .card-title-hero {
    background: rgba(0,0,0,.2);
    border-radius: 12px 12px 0 0;
}
.card-navy .form-group label {
    color: rgba(255,255,255,.7);
}
.card-navy select {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.2);
    color: #fff;
}
.card-navy select option { background: var(--navy); color: #fff; }
.card-navy .btn-primary {
    background: #fff;
    color: var(--navy);
}

/* ── FORM ELEMENTS ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.form-group select,
.form-group input,
.form-group textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s, background .15s;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235f6368' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--orange);
    background: var(--orange-light);
    box-shadow: 0 0 0 3px rgba(255,179,124,.28);
}
.form-group select:disabled { background-color: var(--bg); color: var(--muted); cursor: not-allowed; }
.form-group textarea { resize: vertical; min-height: 90px; }

/* ── BUTTONS ── */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: var(--radius);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
    font-family: inherit;
    text-align: center;
}
.btn-primary {
    background: var(--orange);
    color: var(--navy);
}
.btn-primary:hover { background: var(--orange-dk); box-shadow: 0 2px 8px rgba(121,161,184,.45); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { background: #2d8f49; }
.btn-outline {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: var(--navy); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #c62828; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th {
    background: var(--bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    text-align: left;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--orange-light); }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #c3e6cb; }
.alert-error   { background: #fce8e6; color: #c62828; border: 1px solid #f5c6cb; }
.alert-info    { background: #e8f0fe; color: #1a56db; border: 1px solid #c3d1fb; }

/* ── HOW IT WORKS SECTION ── */
.hiw-section {
    position: relative;
    margin: 0;
}
.hiw-photo {
    width: 100%;
    height: clamp(260px, 35vw, 400px);
    object-fit: cover;
    object-position: center 60%;
    display: block;
}
.hiw-card {
    position: relative;
    margin: -56px clamp(16px, 4vw, 48px) 0;
    background: var(--white);
    border-radius: 20px;
    padding: clamp(28px, 4vw, 52px) clamp(20px, 4vw, 52px) clamp(28px, 4vw, 48px);
    box-shadow: 0 8px 40px rgba(16,42,67,.13);
    z-index: 2;
}
.hiw-card h2 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 32px;
}
.hiw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    text-align: center;
}
.hiw-item {
    padding: 0 clamp(12px, 3vw, 36px);
    border-right: 1px solid var(--border);
}
.hiw-item:last-child { border-right: none; }
.hiw-num {
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 800;
    color: var(--border);
    line-height: 1;
    margin-bottom: 10px;
}
.step-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--orange);
    margin-bottom: 6px;
}
.hiw-item h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
    line-height: 1.3;
}
.hiw-item p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.65;
    margin: 0;
}

/* Legacy .step support */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 32px 0;
    text-align: center;
}
.step-num {
    width: 36px;
    height: 36px;
    background: var(--navy);    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin: 0 auto 12px;
}
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p  { font-size: 13px; color: var(--muted); }

/* ── QUOTE CARD ── */
.quote-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.quote-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--green);
}
.quote-dealer { font-weight: 600; font-size: 15px; }
.quote-meta   { font-size: 13px; color: var(--muted); }

/* ── INQUIRY SUMMARY ── */
.car-tag {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    margin: 2px 4px 2px 0;
}

/* ── PAGE HEADER ── */
.page-header {
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--navy); }

/* ── AUTH PAGES ── */
.auth-wrap {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 22px; margin-bottom: 24px; color: var(--navy); }
.auth-card .form-group { margin-bottom: 16px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-footer a { color: var(--navy); text-decoration: none; }

/* ── STATS BAR ── */
.stats-bar {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.stat-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    flex: 1;
    min-width: 140px;
}
.stat-box .num { font-size: 30px; font-weight: 700; color: var(--navy); }
.stat-box .lbl { font-size: 13px; color: var(--muted); }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    transition: color .15s;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── EMPTY STATE ── */
.empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}
.empty p { margin-top: 8px; font-size: 14px; }

/* ── FOOTER ── */
footer {
    text-align: center;
    padding: 28px 20px 24px;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 60px;
    background: var(--white);
}
.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 24px;
    margin-bottom: 12px;
}
.footer-links a {
    color: var(--navy);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: opacity .15s;
}
.footer-links a:hover { opacity: .7; }
.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 14px;
}
.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #333;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.footer-social a:hover { background: #111; color: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    .nav { padding: 12px 16px; }
    .hero { padding: 36px 16px 24px; }
    .card { padding: 20px 16px; }
    .auth-card { padding: 28px 20px; }
    .page-header { padding: 20px 0 16px; }
    .quote-card { flex-direction: column; align-items: flex-start; }

    /* Touch-friendly inputs & selects */
    input, select, textarea {
        font-size: 16px !important; /* prevents iOS auto-zoom on focus */
        min-height: 44px;
        padding: 10px 12px;
    }
    .btn { min-height: 44px; font-size: 15px; }

    /* Form grid → single column */
    .form-grid { grid-template-columns: 1fr !important; gap: 12px; }

    /* Steps → single column on mobile */
    .steps { grid-template-columns: 1fr; gap: 12px; }
    .step { text-align: left; padding: 16px; }
    .step-num { margin: 0 0 10px 0; }
    .steps-wrap { flex-direction: column; align-items: center; gap: 20px; }
    .step-card { width: 240px; height: 240px; padding: 24px; }
    .step-card h3 { font-size: 15px; }
    .step-card p { font-size: 12px; }
    .step-arrow { display: none; }

    /* Trust signals → two per row */
    .trust-bar { gap: 8px 16px; }

    /* Hero banner — taller on mobile so h1 has room */
    .hero-banner { height: clamp(220px, 55vw, 340px); }
    .hero-overlay h1 { font-size: clamp(22px, 6.5vw, 36px); padding: 0 12px; }

    /* Finance/lease fields — force single column */
    .finance-fields .form-grid,
    .lease-fields .form-grid { grid-template-columns: 1fr !important; }

    /* Detect location button — full width on mobile */
    #detect-location-btn { width: 100%; margin-top: 8px; }
    #province + div,
    label + div { flex-wrap: wrap; }

    /* Contact grid → stacked */
    .contact-grid { grid-template-columns: 1fr !important; }

    /* Footer social icons — larger tap targets */
    .footer-social a { width: 42px; height: 42px; }

    /* Nav — hide extra links, keep Sign In + Register */
    .nav-links { gap: 6px; }
    .nav-links a { padding: 6px 10px; font-size: 13px; }
}

/* Tablet — 641px to 900px */
@media (min-width: 641px) and (max-width: 900px) {
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: repeat(3, 1fr); }
    .contact-grid { grid-template-columns: 1fr 1.2fr; }
}

/* ── CAR FINANCE CALCULATOR ── */
.calc-section { margin-top: 28px; }
.calc-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(16,42,67,.07);
    overflow: hidden;
}
.calc-header {
    padding: 22px 28px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.calc-eyebrow {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 2px; color: var(--muted); margin-bottom: 5px;
}
.calc-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 20px; font-weight: 800; color: var(--navy); margin: 0 0 4px;
}
.calc-sub { font-size: 13px; color: var(--muted); margin: 0; }

/* Inputs panel */
.calc-inputs-panel {
    padding: 22px 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.calc-field { display: flex; flex-direction: column; gap: 6px; }
.calc-field label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted);
}
.calc-input-wrap {
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; overflow: hidden;
    transition: border-color .15s;
}
.calc-input-wrap:focus-within { border-color: var(--navy); }
.calc-prefix, .calc-suffix {
    padding: 0 10px; font-size: 14px; color: var(--muted);
    font-weight: 600; flex-shrink: 0;
}
.calc-input-wrap input {
    flex: 1; border: none; background: transparent;
    padding: 10px 8px; font-size: 14px; color: var(--navy);
    outline: none; min-width: 0;
}

/* Slider */
.calc-slider {
    width: 100%; height: 4px; margin-top: 6px;
    background: var(--border); border-radius: 9999px;
    -webkit-appearance: none; appearance: none; cursor: pointer;
}
.calc-slider::-webkit-slider-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--navy); border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(16,42,67,.2);
    -webkit-appearance: none; appearance: none; cursor: pointer;
}

/* Tax stepper */
.calc-tax-row {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 16px;
}
.calc-tax-row label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); white-space: nowrap;
}
.calc-tax-stepper {
    display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; height: 40px;
}
.calc-tax-btn {
    width: 40px; height: 100%; border: none;
    background: #fff; font-size: 20px; font-weight: 300;
    color: var(--navy); cursor: pointer; flex-shrink: 0;
    transition: background .15s; line-height: 1;
}
.calc-tax-btn:hover { background: var(--border); }
.calc-tax-val {
    width: 60px; text-align: center; font-size: 15px;
    font-weight: 700; color: var(--navy);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    line-height: 40px;
}

/* Output area */
.calc-output {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}
.calc-results-table { border-right: 1px solid var(--border); }
.calc-results-table table { width: 100%; border-collapse: collapse; }
.calc-results-table thead th {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted);
    padding: 12px 20px; border-bottom: 1px solid var(--border);
    background: #fff;
}
.calc-results-table thead th:last-child { text-align: right; }
.calc-results-table tbody td {
    padding: 10px 20px; font-size: 13px; color: var(--navy);
    border-bottom: 1px solid var(--border);
}
.calc-results-table tbody tr:last-child td { border-bottom: none; }
.calc-results-table tbody td.amount {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700; text-align: right;
}
.calc-results-table tbody tr.highlighted td { background: #fff; }
.calc-results-table tbody tr.highlighted td.amount { color: var(--navy); }

/* Chart panel */
.calc-chart-panel { padding: 16px 20px; display: flex; flex-direction: column; overflow: hidden; }
.calc-chart-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); margin-bottom: 10px;
}
.calc-chart-wrap { position: relative; flex: 1; min-height: 200px; width: 100%; overflow: hidden; }
.calc-chart-wrap canvas { max-width: 100% !important; }

/* Responsive */
@media (max-width: 640px) {
    .calc-inputs-panel { grid-template-columns: 1fr; }
    .calc-output { grid-template-columns: 1fr; }
    .calc-results-table { border-right: none; border-bottom: 1px solid var(--border); }
    .calc-chart-wrap { min-height: 220px; }
    .calc-tax-row { flex-wrap: wrap; }
}

/* Summary + disclaimer */
.calc-summary {
    padding: 12px 20px;
    background: #fff; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--muted); line-height: 1.6;
}
.calc-disclaimer {
    padding: 10px 20px 16px;
    font-size: 11px; color: #8fa3b8; line-height: 1.6;
    border-top: 1px solid var(--border);
}
