/*
 * CabRoyal — the shared visual language (Constitution 7).
 *
 * "Premium London Black Cab": a black ground, gold used sparingly as a line or
 * an accent rather than a fill, ivory for text, generous whitespace and a 16px
 * radius throughout. Playfair Display carries the headings, Inter the rest.
 *
 * Loaded by both the landing page and the admin panel, so the two never drift
 * apart. Bootstrap 5.3.8 comes from a CDN (Section C); this only sets the
 * variables it reads and adds what it does not have.
 */

:root {
    /* Constitution 7 */
    --cr-black: #0B0B0D;
    --cr-gold: #C9A227;
    --cr-ivory: #F5F1E8;
    --cr-green: #14342B;
    --cr-red: #B3261E;

    /* Derived: lifts off the black ground without introducing a new hue. */
    --cr-surface: #141417;
    --cr-surface-2: #1C1C21;
    --cr-line: rgba(201, 162, 39, 0.18);
    --cr-line-soft: rgba(245, 241, 232, 0.08);
    --cr-muted: rgba(245, 241, 232, 0.62);
    --cr-gold-soft: rgba(201, 162, 39, 0.12);

    --cr-radius: 16px;
    --cr-radius-sm: 10px;

    /* Bootstrap reads these. */
    --bs-primary: var(--cr-gold);
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-border-radius: var(--cr-radius);
}

body {
    background: var(--cr-black);
    color: var(--cr-ivory);
    font-family: var(--bs-body-font-family);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .cr-display {
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: -0.01em;
}

/* --- the gold hairline that ties the identity together ------------------- */

.cr-rule {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cr-gold), transparent);
    border: 0;
    opacity: 0.55;
}

.cr-rule-left {
    width: 64px;
    height: 2px;
    background: var(--cr-gold);
    border: 0;
    opacity: 1;
}

/* --- buttons ------------------------------------------------------------- */

.btn-gold {
    background: var(--cr-gold);
    border: 1px solid var(--cr-gold);
    color: var(--cr-black);
    font-weight: 600;
    border-radius: var(--cr-radius);
    padding: 0.7rem 1.6rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-gold:hover,
.btn-gold:focus {
    background: #d8b13a;
    color: var(--cr-black);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(201, 162, 39, 0.28);
}

.btn-gold:disabled {
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.btn-outline-gold {
    background: transparent;
    border: 1px solid var(--cr-gold);
    color: var(--cr-gold);
    font-weight: 600;
    border-radius: var(--cr-radius);
    padding: 0.7rem 1.6rem;
}

.btn-outline-gold:hover,
.btn-outline-gold:focus {
    background: var(--cr-gold-soft);
    color: var(--cr-gold);
}

/* --- surfaces ------------------------------------------------------------ */

.cr-card {
    background: var(--cr-surface);
    border: 1px solid var(--cr-line-soft);
    border-radius: var(--cr-radius);
}

.cr-card-gold {
    border-color: var(--cr-line);
}

/* --- forms --------------------------------------------------------------- */

.form-control,
.form-select {
    background: var(--cr-surface-2);
    border: 1px solid var(--cr-line-soft);
    color: var(--cr-ivory);
    border-radius: var(--cr-radius-sm);
    padding: 0.7rem 0.95rem;
}

.form-control:focus,
.form-select:focus {
    background: var(--cr-surface-2);
    border-color: var(--cr-gold);
    color: var(--cr-ivory);
    box-shadow: 0 0 0 3px var(--cr-gold-soft);
}

.form-control::placeholder {
    color: rgba(245, 241, 232, 0.35);
}

.form-label {
    color: var(--cr-muted);
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

/* Laravel's 422 field errors land here, wired up by ajax-helper.js. */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--cr-red);
}

.invalid-feedback {
    color: #e08a83;
    font-size: 0.82rem;
}

/* --- text ---------------------------------------------------------------- */

.text-gold { color: var(--cr-gold) !important; }
.text-muted-ivory { color: var(--cr-muted) !important; }
.bg-royal { background: var(--cr-black) !important; }
.bg-surface { background: var(--cr-surface) !important; }

/* --- badges -------------------------------------------------------------- */

.text-bg-royal {
    background: var(--cr-green) !important;
    color: var(--cr-ivory) !important;
}

.badge {
    font-weight: 500;
    border-radius: 999px;
    padding: 0.35em 0.75em;
}

/* --- toastr, restyled to match rather than shouting in default blue ------ */

#toast-container > div {
    border-radius: var(--cr-radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    opacity: 1;
    font-family: var(--bs-body-font-family);
    border: 1px solid rgba(245, 241, 232, 0.10);

    /* toastr puts its icon on as a background-image with !important and
       positions it with two separate properties. Those two are not important,
       so the `background` shorthand below used to wipe them — the icon
       survived, lost its `no-repeat`, and tiled across the whole toast. Every
       colour here is `background-color` for that reason. Restated anyway, so
       the next person to reach for the shorthand does not undo it. */
    background-position: 15px center;
    background-repeat: no-repeat;
}

#toast-container > .toast-success { background-color: var(--cr-green); }
#toast-container > .toast-error   { background-color: var(--cr-red); }
#toast-container > .toast-info    { background-color: var(--cr-surface-2); }
#toast-container > .toast-warning { background-color: #8a6d1f; }

/* The default is a black bar at 40% on what is already a dark toast, which is
   four pixels of nothing. */
#toast-container > div > .toast-progress {
    background-color: var(--cr-gold);
    opacity: 0.85;
    height: 3px;
}

/* Default: white with a white text-shadow, turning black on hover — a halo on
   a light theme, and invisible against ours the moment you point at it. */
#toast-container .toast-close-button {
    color: var(--cr-ivory);
    text-shadow: none;
    opacity: 0.6;
    font-weight: 500;
}

#toast-container .toast-close-button:hover,
#toast-container .toast-close-button:focus {
    color: var(--cr-gold);
    opacity: 1;
}

#toast-container > div:hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
}

.toast-title { letter-spacing: 0.01em; }
.toast-message { line-height: 1.45; }

/* A toast is 300px wide by default and does not shrink until 480px, so on a
   narrow phone it sits half off the screen. */
@media (max-width: 575.98px) {
    #toast-container > div {
        width: calc(100vw - 24px);
        max-width: 22rem;
    }
}

/* --- SweetAlert2, likewise ---------------------------------------------- */

.swal2-popup.cr-swal {
    background: var(--cr-surface);
    color: var(--cr-ivory);
    border: 1px solid var(--cr-line);
    border-radius: var(--cr-radius);
}

.swal2-popup.cr-swal .swal2-title {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--cr-ivory);
}

.swal2-popup.cr-swal .swal2-html-container {
    color: var(--cr-muted);
}

/* --- accessibility ------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--cr-gold);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Landing page (Prompt 5)
   ========================================================================== */

.cr-nav {
    background: rgba(11, 11, 13, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--cr-line-soft);
    padding-block: 0.85rem;
}

.cr-wordmark {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--cr-ivory);
}

.cr-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--cr-gold);
    color: var(--cr-black);
    font-size: 1.1rem;
}

.cr-nav .nav-link {
    color: var(--cr-muted);
    font-weight: 500;
    padding-inline: 0.9rem;
}

.cr-nav .nav-link:hover,
.cr-nav .nav-link:focus {
    color: var(--cr-gold);
}

/* --- hero ---------------------------------------------------------------- */

.cr-hero {
    position: relative;
    padding-block: clamp(4.5rem, 12vw, 9rem);
    overflow: hidden;
}

/* A single warm pool of light behind the headline — the only "glow" on the
   page, so it reads as deliberate rather than decorative. */
.cr-hero::before {
    content: '';
    position: absolute;
    inset: -20% 30% auto -10%;
    height: 70%;
    background: radial-gradient(closest-side, rgba(201, 162, 39, 0.16), transparent);
    pointer-events: none;
}

.cr-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cr-gold);
    border: 1px solid var(--cr-line);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    background: var(--cr-gold-soft);
}

.cr-hero h1 {
    font-size: clamp(2.6rem, 6.5vw, 4.6rem);
    line-height: 1.04;
    margin-block: 1.4rem 1.2rem;
}

.cr-hero .lead {
    color: var(--cr-muted);
    font-size: clamp(1.02rem, 1.6vw, 1.2rem);
    max-width: 34rem;
}

.cr-hero-note {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.6rem;
    color: var(--cr-muted);
    font-size: 0.9rem;
    border-left: 2px solid var(--cr-gold);
    padding-left: 0.9rem;
}

/* --- the phone mock in the hero ----------------------------------------- */

.cr-phone {
    position: relative;
    width: min(268px, 74vw);
    /* Shorter than a real handset. A true 9:19 pushes the hero past the fold
       on a laptop and leaves a void in the middle of the mock. */
    aspect-ratio: 9 / 16;
    margin-inline: auto;
    border-radius: 38px;
    background: linear-gradient(165deg, #17171b, #0d0d10);
    border: 1px solid var(--cr-line);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 14px;
}

.cr-phone-shot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* A phone screenshot is 9:19.6 and the frame is 9:16, so `cover` trims
       the status bar off the top and a little off the bottom — which is what
       you want anyway. */
    object-position: center;
    border-radius: 26px;
    display: block;
    border: 1px solid var(--cr-line-soft);
}

/* The route the mock is showing: a gold line between two points, drawn in
   CSS so the hero costs no extra request. */


/* The pickup dot at the far end of that line. */

/* Free cabs waiting nearby, as the rider's map shows them (Section H-3). */

/* Suggested streets rather than a real map — an image would be another
   request and a licence question for no extra meaning. */



/* --- sections ------------------------------------------------------------ */

.cr-section {
    padding-block: clamp(3.5rem, 8vw, 6rem);
}

.cr-section-alt {
    background: linear-gradient(180deg, transparent, rgba(245, 241, 232, 0.02), transparent);
}

.cr-section h2 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    margin-bottom: 0.6rem;
}

.cr-step-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.4rem;
    color: var(--cr-gold);
    line-height: 1;
    opacity: 0.85;
}

.cr-feature {
    padding: 1.75rem;
    height: 100%;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.cr-feature:hover {
    transform: translateY(-3px);
    border-color: var(--cr-line);
}

.cr-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--cr-gold-soft);
    color: var(--cr-gold);
    font-size: 1.35rem;
    margin-bottom: 1rem;
}

/* --- store badges (placeholders until the apps are published) ------------ */

.cr-store-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid var(--cr-line);
    border-radius: 14px;
    padding: 0.6rem 1.1rem;
    color: var(--cr-ivory);
    text-decoration: none;
    background: var(--cr-surface);
    opacity: 0.75;
    cursor: default;
}

.cr-store-badge i { font-size: 1.7rem; color: var(--cr-gold); }
.cr-store-badge small { display: block; font-size: 0.66rem; color: var(--cr-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.cr-store-badge strong { font-size: 0.98rem; font-weight: 600; }

/* --- stats --------------------------------------------------------------- */

.cr-stat {
    border-left: 2px solid var(--cr-line);
    padding-left: 1rem;
}

.cr-stat-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    color: var(--cr-gold);
    line-height: 1;
}

.cr-stat-label {
    color: var(--cr-muted);
    font-size: 0.85rem;
}

/* --- footer -------------------------------------------------------------- */

.cr-footer {
    border-top: 1px solid var(--cr-line-soft);
    padding-block: 3.5rem 2rem;
    background: #08080a;
}

.cr-footer-links a {
    color: var(--cr-muted);
    text-decoration: none;
    display: inline-block;
    padding-block: 0.3rem;
}

.cr-footer-links a:hover { color: var(--cr-gold); }

/* --- legal pages --------------------------------------------------------- */

.cr-legal {
    max-width: 46rem;
}

.cr-legal h2 {
    font-size: 1.35rem;
    margin-top: 2.4rem;
    margin-bottom: 0.8rem;
    color: var(--cr-ivory);
}

.cr-legal p,
.cr-legal li {
    color: var(--cr-muted);
    line-height: 1.75;
}

.cr-legal ul { padding-left: 1.1rem; }
.cr-legal li { margin-bottom: 0.5rem; }

/* --- checkboxes, radios and switches ------------------------------------- */

/*
 * Bootstrap compiles its blue into the checked state rather than reading
 * --bs-primary, so setting that variable leaves switches and checkboxes blue
 * on a gold panel. These are the four rules that actually change it.
 */
.form-check-input {
    background-color: var(--cr-surface-2);
    border-color: var(--cr-line-soft);
}

.form-check-input:checked {
    background-color: var(--cr-gold);
    border-color: var(--cr-gold);
}

.form-check-input:focus {
    border-color: var(--cr-gold);
    box-shadow: 0 0 0 3px var(--cr-gold-soft);
}

/* The knob is a background image whose colour is baked in, so the unchecked
   one has to be redrawn to be visible on a dark ground. */
.form-switch .form-check-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28245,241,232,0.45%29'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230B0B0D'/%3e%3c/svg%3e");
}

/* A field that just saved, in the inline tariff table. */
.form-control.is-valid {
    border-color: var(--cr-gold);
    background-image: none;
}
