/*
 * Opony — styles for the driver page, workshop page and login.
 * Plain CSS (no build step). The admin panel (Filament) has its own tweaks in admin.css.
 */

:root {
    color-scheme: light;
    /* AB brand: red #a12421 (logo), near-black #1f1a17, warm grey #aba8a8 — see ab.pl */
    --bg: #f5f4f2;
    --surface: #ffffff;
    --surface-2: #f1efed;
    --text: #1f1a17;
    --muted: #6f6865;
    --border: #e7e4e1;
    --border-strong: #d6d2ce;
    --ink: #1f1a17;
    --primary: #a12421;
    --primary-hover: #861c1a;
    --primary-soft: #fbf0ef;
    --primary-text: #ffffff;
    --brand-grey: #aba8a8;
    --warn: #b45309;
    --warn-soft: #fdf4e7;
    --ok: #15803d;
    --ok-soft: #ecfdf3;
    --err: #c62828;
    --err-soft: #fef2f2;
    --shadow: 0 1px 2px rgb(31 26 23 / .04), 0 1px 3px rgb(31 26 23 / .06);
    --shadow-lg: 0 12px 32px -12px rgb(31 26 23 / .2);
    --radius: 10px;
    --radius-sm: 8px;
    --font: 'Inter Variable', Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #141110;
        --surface: #1c1917;
        --surface-2: #262220;
        --text: #eeeae7;
        --muted: #a39d99;
        --border: #2c2724;
        --border-strong: #3a3431;
        --ink: #eeeae7;
        --primary: #e2615c;
        --primary-hover: #ea7d78;
        --primary-soft: #331a19;
        --primary-text: #1a0d0c;
        --brand-grey: #8f8a88;
        --warn: #f0a54a;
        --warn-soft: #2d2213;
        --ok: #4ade80;
        --ok-soft: #10261a;
        --err: #f87171;
        --err-soft: #2c1517;
        --shadow: 0 1px 2px rgb(0 0 0 / .3);
        --shadow-lg: 0 12px 32px -12px rgb(0 0 0 / .6);
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }

/* ---------- Logo ---------- */

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.logo-text { display: inline-flex; align-items: baseline; gap: 7px; }
.logo-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.logo-sub { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Co-branding: AB logo | Opony */
.brand-lockup { display: inline-flex; align-items: center; gap: 14px; }
.brand-ab { display: block; height: 28px; width: auto; }
.brand-divider { width: 1px; align-self: stretch; min-height: 28px; background: var(--border-strong); }

/* ---------- Shell ---------- */

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(12px);
    -webkit-backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 920px; margin: 0 auto; padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-tag {
    font-size: .75rem; font-weight: 600; color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}
.user-nav { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.user-nav .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary);
    font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.user-nav .name { color: var(--text); font-weight: 500; margin: 0 8px 0 4px; }
.user-nav form { margin: 0; }

.page { max-width: 920px; margin: 0 auto; padding: 36px 20px 64px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 6px; }
.page-head p { color: var(--muted); margin: 0; max-width: 60ch; }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin: 0 0 6px; }

.footer { max-width: 920px; margin: 0 auto; padding: 0 20px 32px; color: var(--muted); font-size: .8rem; }

@media (max-width: 560px) {
    .topbar-inner { padding: 10px 16px; gap: 8px; }
    .logo-sub, .user-nav .name, .user-nav .avatar { display: none; }
    .topbar .brand-lockup { gap: 10px; }
    .topbar .brand-ab { height: 22px; }
    .user-nav { gap: 2px; }
    .user-nav .btn { padding: 6px 8px; }
    .page { padding-top: 24px; }
    .page-head h1 { font-size: 1.45rem; }
}

/* ---------- Buttons & forms ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 8px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.2;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; box-shadow: var(--shadow); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.block { width: 100%; min-height: 44px; }
.btn svg { width: 16px; height: 16px; flex: none; }

.field { margin-top: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field .hint { font-weight: 400; color: var(--muted); }
.input, textarea.input {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 64px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.form-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.error-text { color: var(--err); font-size: .82rem; margin-top: 6px; }

/* ---------- Cards, notices, badges ---------- */

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px; margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 1.15rem; font-weight: 650; margin: 0 0 6px; }
.card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; margin: 0; }
.card-meta svg { width: 16px; height: 16px; flex: none; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.section-title { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }

.empty { text-align: center; padding: 40px 24px; }
.empty .empty-icon { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--muted); opacity: .7; }
.empty p { color: var(--muted); margin: 0 auto; max-width: 46ch; }

.notice {
    display: flex; gap: 10px; align-items: flex-start;
    margin: 16px 0 0; padding: 11px 14px;
    border-radius: var(--radius-sm); font-size: .9rem;
    background: var(--surface-2); color: var(--text);
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.success { background: var(--ok-soft); color: var(--ok); }
.notice.error { background: var(--err-soft); color: var(--err); }
.notice.info { background: var(--surface-2); color: var(--text); }
.notice.info svg { color: var(--muted); }
.notice .notice-body { flex: 1; min-width: 0; }
.notice .notice-body .actions { margin-top: 10px; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .78rem; font-weight: 500; line-height: 1;
    padding: 5px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted);
    white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok, .badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .badge.dropped_off { background: var(--warn-soft); color: var(--warn); }
.badge.err, .badge.not_done, .badge.no_show { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--primary-soft); color: var(--primary); }

/* Licence plate: white plate with the blue EU band. */
.plate {
    display: inline-flex; align-items: stretch;
    border: 1.5px solid #1f2937; border-radius: 5px; overflow: hidden;
    background: #fff; color: #111827;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
    font-weight: 700; font-size: .88rem; letter-spacing: .08em; line-height: 1;
}
.plate::before { content: 'PL'; display: grid; place-items: end center; background: #1d4ed8; color: #fff; font-size: .5rem; letter-spacing: 0; padding: 0 3px 3px; }
.plate span { padding: 5px 8px 4px; }

details.more { margin-top: 18px; }
details.more summary {
    cursor: pointer; list-style: none;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: .88rem; font-weight: 500;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.more[open] summary::before { transform: rotate(45deg); }
details.more summary:hover { color: var(--text); }
.prose-muted { white-space: pre-line; font-size: .9rem; color: var(--muted); margin: 10px 0 0; }

/* ---------- Driver: appointment & slot picker ---------- */

.appointment {
    margin-top: 20px; padding: 16px 18px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
}
.appointment.none { background: var(--surface-2); border-color: var(--border); border-left-color: var(--brand-grey); }
.appointment-body { display: flex; align-items: center; gap: 14px; }
.appointment-icon {
    width: 44px; height: 44px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: var(--surface); color: var(--primary); box-shadow: var(--shadow);
}
.appointment.none .appointment-icon { color: var(--muted); }
.appointment-icon svg { width: 22px; height: 22px; }
.appointment-label { font-size: .8rem; color: var(--muted); }
.appointment-value { font-size: 1.05rem; font-weight: 650; }

.days-list { display: grid; gap: 20px; }
.day-title { font-size: .9rem; font-weight: 600; margin: 0 0 10px; text-transform: capitalize; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.slot {
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    border-radius: var(--radius-sm); padding: 10px 8px;
    font: inherit; font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums;
    cursor: pointer; text-align: center;
    transition: border-color .15s, background-color .15s, transform .1s, box-shadow .15s;
}
.slot small { display: block; margin-top: 2px; font-size: .74rem; font-weight: 450; color: var(--muted); }
.slot:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.slot:active:not(:disabled) { transform: translateY(1px); }
.slot:disabled { background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: not-allowed; font-weight: 500; }
.slot:disabled small { opacity: .8; }
.slot.current { background: var(--primary); color: var(--primary-text); border-color: var(--primary); box-shadow: var(--shadow); }
.slot.current small { color: inherit; opacity: .85; }
/* FR-USR-6: full slot that can be asked for in a swap */
.slot.swap { border-style: dashed; }
.slot.swap:not(:disabled) small { color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Workshop ---------- */

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 16px; scrollbar-width: thin; }
.chip {
    flex: 0 0 auto; min-height: 38px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    border-radius: 999px; padding: 7px 14px;
    font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat-label { font-size: .75rem; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.visit { padding: 16px 18px; margin-bottom: 12px; }
.visit.is-done { opacity: .78; }
.visit-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.visit-time { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 96px; }
.visit-head .badge { margin-left: auto; }
.note { font-size: .88rem; margin: 10px 0 0; white-space: pre-line; padding-left: 10px; border-left: 2px solid var(--border-strong); }
.note b { font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { min-height: 44px; padding: 10px 16px; }
.walkin { display: flex; gap: 8px; }
.walkin .input { flex: 1; text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }

@media (max-width: 480px) {
    .stats { gap: 6px; }
    .stat { padding: 10px; }
    .visit-time { min-width: 0; }
}

/* ---------- Login ---------- */

.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background:
        radial-gradient(60rem 30rem at 10% -10%, color-mix(in srgb, var(--brand-grey) 22%, transparent), transparent 60%),
        radial-gradient(50rem 30rem at 110% 110%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 60%),
        var(--bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card .brand-lockup { margin-bottom: 28px; }
.auth-card .brand-ab { height: 34px; }
.auth-card h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 6px; }
.auth-card .lead { color: var(--muted); font-size: .92rem; margin: 0 0 24px; }
.auth-dev { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--border-strong); }
.auth-dev .badge { margin-bottom: 4px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: .8rem; }

@media (max-width: 400px) {
    .topbar .logo-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
