/* ─────────────────────────────────────────────────────────────────────────────
   Theme layer over Bootstrap 5.3 — Motorway-inspired palette.
   Rule: cream ground, near-black for anything interactive (buttons, links),
   yellow as a highlight only — never a small button. All values are tokens so
   the whole theme re-points from :root.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    --bs-body-bg: #fbf7ec;
    --bs-body-color: #1a1a1a;
    --bs-secondary-color: #5c5749;
    --bs-body-font-family: 'Overpass', Arial, sans-serif;
    --bs-border-color: #e7e1cf;
    --bs-border-color-translucent: #e7e1cf;

    --ink: #1a1a1a;          /* buttons, links, dark nav */
    --ink-hover: #000000;
    --yellow: #ffde00;       /* accent — surfaces & highlights only */
    --yellow-hover: #f2d200;
    --surface: #ffffff;
    --ring: 0 0 0 0.2rem rgba(26, 26, 26, 0.18);
}

body {
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 { letter-spacing: -0.011em; font-weight: 600; }

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

/* ── Site nav — Motorway yellow, black text/logo ───────────────────────────── */
.site-nav {
    background-color: var(--yellow);
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}
.site-nav .navbar-brand {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.2rem;
    padding-top: 0;
    padding-bottom: 0;
}
.site-nav .navbar-brand .site-logo {
    display: block;
    height: 1.5rem;
    width: auto;
}
.site-nav .nav-cta {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    padding: 0.25rem 0.1rem;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.site-nav .nav-cta:hover,
.site-nav .nav-cta:focus-visible {
    color: var(--ink);
    border-bottom-color: var(--ink);
    text-decoration: none;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card { border-color: var(--bs-border-color); border-radius: 0.65rem; background-color: var(--surface); }
.card.shadow-sm {
    box-shadow: 0 1px 2px rgba(26, 22, 8, 0.05), 0 1px 3px rgba(26, 22, 8, 0.07) !important;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card.shadow-sm:hover {
    box-shadow: 0 4px 12px rgba(26, 22, 8, 0.11), 0 2px 4px rgba(26, 22, 8, 0.07) !important;
    transform: translateY(-1px);
}
.card-img-top, .card .ratio:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.card-footer, .card-header { background-color: transparent; border-color: var(--bs-border-color); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn { border-radius: 0.5rem; font-weight: 500; }
.btn:focus-visible { box-shadow: var(--ring); }
/* Filled primary — black by default, dark grey (not near-black) on hover, black again when pressed. */
.btn-dark, .btn-primary { background-color: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover, .btn-primary:hover,
.btn-dark:focus-visible, .btn-primary:focus-visible {
    background-color: #3f3b33; border-color: #3f3b33; color: #fff;
}
.btn-dark:active, .btn-primary:active {
    background-color: var(--ink) !important; border-color: var(--ink) !important; color: #fff !important;
}

/* the "create / list a car" CTA — Motorway's yellow with black text */
.btn-success { background-color: var(--yellow); border-color: var(--yellow); color: var(--ink); font-weight: 600; }
.btn-success:hover, .btn-success:focus { background-color: var(--yellow-hover); border-color: var(--yellow-hover); color: var(--ink); }

/* Outline — white with a light border; hover just darkens the border (no fill). */
.btn-outline-secondary { color: var(--bs-secondary-color); border-color: var(--bs-border-color); background-color: transparent; }
.btn-outline-secondary:hover, .btn-outline-secondary:focus-visible {
    background-color: transparent; border-color: var(--ink); color: var(--ink);
}
.btn-outline-secondary:active {
    background-color: #f3edde !important; border-color: var(--ink) !important; color: var(--ink) !important;
}

/* <a class="btn"> should never pick up the global link underline on hover... */
.btn:hover:not(.btn-link) { text-decoration: none; }
/* ...except the deliberately link-styled ones. */
.btn-link { text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 0.875rem; margin-bottom: 0.25rem; }
.form-control, .form-select { border-radius: 0.5rem; border-color: #d8d2bf; background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: var(--ring); }
.form-control:disabled, .form-control[readonly] { background-color: #f0ece0; color: var(--bs-secondary-color); }
.form-text { color: var(--bs-secondary-color); }

/* ── Dashboard view tabs (underline style) ──────────────────────────────────── */
.dash-tab {
    color: var(--bs-secondary-color);
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
    padding: 0.3rem 0.15rem 0.55rem;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.dash-tab:hover { color: var(--ink); text-decoration: none; }
.dash-tab.active { color: var(--ink); border-bottom-color: var(--yellow); }
.dash-tab.disabled { opacity: 0.55; pointer-events: none; }
.dash-tab-sm { font-size: 0.95rem; }
.dash-tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.35rem; height: 1.35rem; padding: 0 0.4rem; margin-left: 0.35rem;
    border-radius: 999px; font-size: 0.78rem; font-weight: 600;
    background: #eae4d3; color: var(--bs-secondary-color);
}
.dash-tab.active .dash-tab-count { background: var(--yellow); color: var(--ink); }

/* ── Menus / badges / tables / alerts / pagination ─────────────────────────── */
.list-group { border-radius: 0.55rem; }
.list-group-item { border-color: var(--bs-border-color); background-color: var(--surface); }
.list-group-item-action:hover { background-color: #f4efe1; }
.list-group-item.active { background-color: var(--ink); border-color: var(--ink); }

.badge { font-weight: 500; letter-spacing: 0; padding: 0.36em 0.6em; }

.table > :not(caption) > * > * { padding: 0.5rem 0.85rem; }
.table th { color: var(--bs-secondary-color); font-weight: 500; }

.alert { border-radius: 0.55rem; border: 1px solid transparent; }

.page-link { color: var(--ink); border-radius: 0.4rem; margin: 0 0.1rem; border-color: var(--bs-border-color); }
.page-item.active .page-link { background-color: var(--ink); border-color: var(--ink); }

/* ── Auth pages (allauth: login / signup / code) ───────────────────────────── */
.auth-card {
    max-width: 25rem;
    margin: 2.5rem auto;
    background: var(--surface);
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 1px 2px rgba(26, 22, 8, 0.05), 0 18px 44px -22px rgba(26, 22, 8, 0.22);
}
.auth-card h1 { font-weight: 700; }
.auth-card-wide { max-width: 38rem; }   /* signup: room for the 2-column field grid */
.auth-card form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.auth-card form select,
.auth-card form textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d8d2bf;
    border-radius: 0.5rem;
    font: inherit;
    background: var(--surface);
    margin-bottom: 0.15rem;
}
.auth-card form input:focus, .auth-card form select:focus, .auth-card form textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 0.2rem rgba(26, 26, 26, 0.15);
}
.auth-card .form-label { margin-top: 0.6rem; }
.auth-card .helptext { display: block; font-size: 0.78rem; color: var(--bs-secondary-color); margin: 0.15rem 0 0.4rem; }
.auth-card ul.errorlist { list-style: none; padding: 0; margin: 0.15rem 0 0.4rem; color: #b3261e; font-size: 0.82rem; }
.auth-card .pc-invalid input { border-color: #b3261e; }   /* bad postcode on submit — red outline, no text */

/* Invalid-field feedback (set by the script in base.html), site-wide */
.field-error,
input.field-error, select.field-error, textarea.field-error { border-color: #b3261e !important; }
.field-error:focus { border-color: #b3261e !important; box-shadow: 0 0 0 0.2rem rgba(179, 38, 30, 0.15) !important; }
.field-hint { color: #b3261e; font-size: 0.72rem; line-height: 1.3; margin-top: 0.15rem; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; color: var(--bs-secondary-color); font-size: 0.85rem; margin: 1.1rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--bs-border-color); }

/* ── Toasts (flash messages) — small, bottom-centre, auto-dismiss ────────────── */
.toast-stack {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    z-index: 1080; display: flex; flex-direction: column; align-items: center;
    gap: 0.5rem; width: max-content; max-width: calc(100vw - 2rem); pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    display: flex; align-items: center; gap: 0.75rem;
    background: var(--ink); color: #fff;
    padding: 0.5rem 0.55rem 0.5rem 0.9rem;
    border-radius: 0.6rem; border-left: 3px solid var(--yellow);
    box-shadow: 0 8px 24px rgba(26, 22, 8, 0.22);
    font-size: 0.875rem; font-weight: 500;
    animation: toast-in 0.18s ease-out;
}
.toast-item.error, .toast-item.danger { border-left-color: #ff6b6b; }
.toast-item.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.22s ease, transform 0.22s ease; }
.toast-x { border: 0; background: transparent; color: rgba(255, 255, 255, 0.6); font-size: 1.15rem; line-height: 1; padding: 0 0.35rem; cursor: pointer; }
.toast-x:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast-item { animation: none; } .toast-item.toast-out { transition: none; } }

/* ── Site footer — dark anchor to bookend the cream page ───────────────────── */
.site-footer {
    flex-shrink: 0;
    background: var(--ink);
    color: #b8b2a1;
    padding: 2.5rem 0 1.75rem;
    margin-top: 3rem;
    font-size: 0.9rem;
}
.site-footer a { color: #e9e3d2; font-weight: 600; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.site-footer-top {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    justify-content: space-between;
    align-items: flex-start;
}
.site-footer-brand { max-width: 32rem; }
.site-footer-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 0.4rem;
}
.site-footer-brand p { margin: 0; line-height: 1.5; }
.site-footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.site-footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #857f71;
    font-size: 0.8rem;
}

/* ── Legal pages (privacy, terms) ─────────────────────────────────────────── */
.legal-page {
    max-width: 48rem;
    margin: 0 auto;
    padding: 2.5rem 0 1rem;
}
.legal-page h1 { font-weight: 700; }
.legal-page h5 { margin-bottom: 0.6rem; }
.legal-page h6 { font-weight: 600; margin-top: 1rem; }
.legal-page ul { padding-left: 1.15rem; }
.legal-page li { margin-bottom: 0.3rem; }
.legal-page .card a { white-space: nowrap; }
