/* =====================================================================
   Smart Vehicle Advisor — modern public theme
   CSS custom-property design system. Default = clean white/light.
   Theme + accent switching is done by setting data-theme / data-accent
   on <html> (see theme.js).
   ===================================================================== */

:root {
    /* Accent (overridable by data-accent presets) */
    --accent: #4f46e5;
    --accent-rgb: 79, 70, 229;
    --accent-2: #06b6d4;
    --accent-contrast: #ffffff;

    /* Light surface palette (default) */
    --bg: #f7f8fc;
    --bg-soft: #eef1f8;
    --surface: #ffffff;
    --surface-2: #f4f6fb;
    --border: #e6e8f0;
    --text: #1c2333;
    --text-muted: #5b6478;
    --shadow: 0 10px 30px rgba(20, 26, 51, 0.08);
    --shadow-lg: 0 24px 60px rgba(20, 26, 51, 0.14);
    --radius: 18px;
    --radius-sm: 12px;

    /* Severity colours */
    --sev-low: #16a34a;
    --sev-medium: #d97706;
    --sev-high: #dc2626;

    --nav-h: 72px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

/* Dark theme */
html[data-theme="dark"] {
    --bg: #0f1220;
    --bg-soft: #151a2d;
    --surface: #181d31;
    --surface-2: #1f2540;
    --border: #2a3150;
    --text: #eef1fb;
    --text-muted: #a3acc9;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --accent-contrast: #ffffff;
}

/* Accent presets */
html[data-accent="indigo"]  { --accent:#4f46e5; --accent-rgb:79,70,229;  --accent-2:#06b6d4; }
html[data-accent="emerald"] { --accent:#059669; --accent-rgb:5,150,105;  --accent-2:#10b981; }
html[data-accent="rose"]    { --accent:#e11d48; --accent-rgb:225,29,72;  --accent-2:#fb7185; }
html[data-accent="amber"]   { --accent:#d97706; --accent-rgb:217,119,6;  --accent-2:#f59e0b; }
html[data-accent="violet"]  { --accent:#7c3aed; --accent-rgb:124,58,237; --accent-2:#a855f7; }
html[data-accent="ocean"]   { --accent:#0284c7; --accent-rgb:2,132,199;  --accent-2:#06b6d4; }

* { box-sizing: border-box; }

body.sva {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s ease, color .3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sva-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.section { padding: 84px 0; }
.text-muted-2 { color: var(--text-muted); }
.center { text-align: center; }

/* ---------- Navbar ---------- */
.sva-nav {
    position: sticky; top: 0; z-index: 1000;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
}
.sva-nav .sva-container { display: flex; align-items: center; justify-content: space-between; }
.sva-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.sva-brand:hover { text-decoration: none; }
.sva-brand .logo {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center; color: #fff; font-size: 1.1rem;
}
.sva-navlinks { display: flex; align-items: center; gap: 8px; }
.sva-navlinks a.navlink {
    color: var(--text-muted); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: .95rem;
}
.sva-navlinks a.navlink:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn-sva {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: 1px solid transparent; border-radius: 999px;
    padding: 12px 24px; font-weight: 700; font-size: .98rem; cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease; text-decoration: none;
}
.btn-sva:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary-sva {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    box-shadow: 0 10px 24px rgba(var(--accent-rgb), .35);
}
.btn-primary-sva:hover { color: var(--accent-contrast); box-shadow: 0 16px 34px rgba(var(--accent-rgb), .45); }
.btn-ghost-sva { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.btn-ghost-sva:hover { color: var(--text); }
.btn-lg-sva { padding: 15px 32px; font-size: 1.05rem; }
.btn-block-sva { width: 100%; }

/* ---------- Cards ---------- */
.card-sva {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
    transition: transform .2s ease, box-shadow .2s ease;
}
.card-sva.hoverable:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 72px; }
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(900px 420px at 78% -8%, rgba(var(--accent-rgb), .20), transparent 60%),
        radial-gradient(700px 380px at 8% 12%, rgba(6, 182, 212, .14), transparent 55%);
}
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); font-weight: 850; line-height: 1.08; margin: 0 0 18px; letter-spacing: -.5px; }
.hero h1 .grad { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.18rem; color: var(--text-muted); max-width: 620px; margin: 0 0 30px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent);
    background: rgba(var(--accent-rgb), .1); padding: 7px 14px; border-radius: 999px; margin-bottom: 18px;
}

/* ---------- Feature grid ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.feature-ico {
    width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem;
    background: rgba(var(--accent-rgb), .12); color: var(--accent); margin-bottom: 14px;
}
.section-title { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 820; margin: 0 0 12px; letter-spacing: -.4px; }
.section-sub { color: var(--text-muted); max-width: 640px; margin: 0 auto 46px; }

/* ---------- Steps ---------- */
.step-num {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
    color: var(--accent-contrast); background: linear-gradient(135deg, var(--accent), var(--accent-2)); margin-bottom: 14px;
}

/* ---------- Forms ---------- */
.form-card { max-width: 620px; margin: 0 auto; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 650; margin-bottom: 7px; font-size: .92rem; }
.input-sva, select.input-sva, textarea.input-sva {
    width: 100%; padding: 13px 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 1rem; font-family: inherit; transition: border-color .2s ease, box-shadow .2s ease;
}
.input-sva:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
textarea.input-sva { min-height: 120px; resize: vertical; }
.field-error { color: var(--sev-high); font-size: .85rem; margin-top: 5px; display: block; }

/* ---------- Badges ---------- */
.badge-sva { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.sev-low    { background: rgba(22,163,74,.14);  color: var(--sev-low); }
.sev-medium { background: rgba(217,119,6,.14);  color: var(--sev-medium); }
.sev-high   { background: rgba(220,38,38,.14);  color: var(--sev-high); }
.pill-soft  { background: rgba(var(--accent-rgb), .12); color: var(--accent); }

/* ---------- Issue cards ---------- */
.issue { border-left: 5px solid var(--border); }
.issue.sev-low-b    { border-left-color: var(--sev-low); }
.issue.sev-medium-b { border-left-color: var(--sev-medium); }
.issue.sev-high-b   { border-left-color: var(--sev-high); }
.issue h3 { margin: 0 0 6px; font-size: 1.18rem; }
.cost { font-weight: 800; color: var(--accent); }

/* ---------- Processing loader ---------- */
.loader-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 70px 0; text-align: center; }
.car-loader { font-size: 3.4rem; animation: bounce 1.1s ease-in-out infinite; }
.road { width: 220px; height: 6px; border-radius: 6px; margin-top: 18px; overflow: hidden; background: var(--surface-2); position: relative; }
.road::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: slide 1.2s ease-in-out infinite; }
@keyframes bounce { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-12px);} }
@keyframes slide { 0%{ left:-40%;} 100%{ left:100%;} }
.spin { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Workshop list / map ---------- */
#sva-map { width: 100%; height: 420px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.ws-rating { color: var(--sev-medium); font-weight: 700; }

/* ---------- Theme switcher ---------- */
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); width: 42px; height: 42px; border-radius: 12px; cursor: pointer; font-size: 1.05rem; display: grid; place-items: center; }
.theme-pop {
    position: absolute; right: 0; top: 52px; width: 230px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 16px; display: none;
}
.theme-pop.open { display: block; }
.theme-pop h6 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: var(--text); }
.theme-toggle-wrap { position: relative; }

/* ---------- Profile dropdown ---------- */
.profile-wrap { position: relative; }
.profile-btn {
    display: inline-flex; align-items: center; gap: 9px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    padding: 6px 12px 6px 6px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .95rem;
}
.profile-btn:hover { background: var(--surface); }
.profile-btn .avatar {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.profile-pop {
    position: absolute; right: 0; top: 52px; width: 232px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 1100;
}
.profile-pop.open { display: block; }
.profile-pop .profile-head { padding: 10px 12px; color: var(--text-muted); font-size: .82rem; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.profile-pop .profile-head b { color: var(--text); }
.profile-pop a, .profile-pop button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 10px 12px; border-radius: 10px; color: var(--text); background: none; border: none; cursor: pointer;
    font-size: .94rem; font-weight: 600; text-decoration: none;
}
.profile-pop a:hover, .profile-pop button:hover { background: var(--surface-2); text-decoration: none; }
.profile-pop form { margin: 0; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 4px; }
.profile-pop button { color: var(--sev-high); }

/* ---------- Footer ---------- */
.sva-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 34px 0; color: var(--text-muted); margin-top: 40px; }

/* ---------- Alerts ---------- */
.alert-sva { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 600; }
.alert-ok { background: rgba(22,163,74,.12); color: var(--sev-low); }
.alert-err { background: rgba(220,38,38,.12); color: var(--sev-high); }

/* ---------- Dashboard tiles ---------- */
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tile .feature-ico { margin-bottom: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .sva-navlinks .navlink.hide-sm { display: none; }
    .section { padding: 56px 0; }
    .profile-btn .hide-sm { display: none; }
}

/* Navbar fits and stays aligned on small screens */
@media (max-width: 640px) {
    .sva-nav { height: auto; min-height: var(--nav-h); }
    .sva-nav .sva-container { gap: 8px; padding: 8px 14px; flex-wrap: nowrap; }
    .sva-brand { font-size: .98rem; gap: 8px; }
    .sva-brand .logo { width: 32px; height: 32px; font-size: .95rem; }
    .sva-navlinks { gap: 6px; align-items: center; }
    .sva-navlinks .btn-sva { padding: 8px 12px; font-size: .9rem; }
    .sva-navlinks a.navlink { padding: 7px 8px; }
    .theme-toggle { width: 38px; height: 38px; }
    .profile-pop, .theme-pop { top: 56px; }
}
.mt-sva { margin-top: 28px; } .mb-sva { margin-bottom: 28px; }
.fade-up { opacity: 0; transform: translateY(18px); }
