/*
 * sr-trucking — local visual overrides.
 *
 * Built on top of scott_common's tokens.css + base.css + components.css.
 * All values resolved via var(--scott-*) per BRAND.md §13 (no hardcoded hex).
 *
 * Sections:
 *   1. SOS banner   (scott_common doesn't ship a fleet-wide alert banner)
 *   2. Nav dropdowns (Finance / Compliance / Tickets <details> menus)
 *   3. Compat aliases (.btn / .card / .status-pill etc.) — preserves the
 *      90+ staff templates that use sr-trucking's pre-v0.6.0 class names
 *      while we sweep them onto the canonical .scott-* classes over time.
 *      Future PR: replace these aliases with a per-template sweep, then
 *      delete this section.
 */


/* ── 1. SOS banner — full-width red bar above the navbar ───────── */

.scott-sos-banner {
    background: var(--scott-error);
    color: var(--scott-surface);
    padding: var(--scott-space-3) var(--scott-space-4);
    text-align: center;
    font-weight: var(--scott-weight-bold);
    font-size: var(--scott-text-base);
}

.scott-sos-banner a {
    color: var(--scott-surface);
    text-decoration: underline;
}


/* ── 2. Nav dropdown menus (Finance / Compliance / Tickets) ───── */
/* Uses native <details>/<summary> for keyboard + screen-reader friendliness.
 * Triggered from inside .scott-navbar__items. */

.scott-navbar__items details.nav-menu {
    position: relative;
    list-style: none;
}

.scott-navbar__items details.nav-menu > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--scott-space-2) var(--scott-space-3);
    border-radius: var(--scott-radius-sm);
    user-select: none;
    color: var(--scott-surface);
}

.scott-navbar__items details.nav-menu > summary::-webkit-details-marker {
    display: none;
}

.scott-navbar__items details.nav-menu > summary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.scott-navbar__items details.nav-menu[open] > summary {
    background: rgba(255, 255, 255, 0.18);
}

.scott-navbar__items details.nav-menu > .nav-menu__pop {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--scott-surface);
    color: var(--scott-ink);
    border: 2px solid var(--scott-ink);
    border-radius: var(--scott-radius-md);
    box-shadow: 0 8px 24px rgba(15, 20, 25, 0.25);
    padding: var(--scott-space-2) 0;
    min-width: 240px;
    z-index: 1100;
    margin-top: 0;
}

.scott-navbar__items details.nav-menu > .nav-menu__pop a {
    display: block;
    color: var(--scott-primary);
    padding: var(--scott-space-2) var(--scott-space-4);
    font-size: var(--scott-text-sm);
    text-decoration: none;
}

.scott-navbar__items details.nav-menu > .nav-menu__pop a:hover {
    background: var(--scott-primary-light);
}

.scott-navbar__items details.nav-menu > .nav-menu__pop hr {
    border: none;
    border-top: 1px solid var(--scott-border);
    margin: var(--scott-space-1) 0;
}


/* ── 3. Compat aliases — preserves 90+ pre-v0.6.0 staff templates ──
 * Each rule maps a sr-trucking legacy class name to its scott_common
 * equivalent's behavior using only var(--scott-*) tokens. Sweep complete
 * once every template moves to .scott-* class names; then delete this. */

/* .btn family → BRAND.md §8 button system */
.btn {
    display: inline-block;
    padding: var(--scott-space-2) var(--scott-space-4);
    background: var(--scott-primary);
    color: var(--scott-surface);
    border: none;
    border-radius: var(--scott-radius-sm);
    cursor: pointer;
    text-decoration: none;
    font-size: var(--scott-text-sm);
    font-weight: var(--scott-weight-medium);
    font-family: var(--scott-font-sans);
    line-height: 1.4;
}
.btn:hover {
    background: var(--scott-primary-hover);
    color: var(--scott-surface);
}
.btn-secondary {
    background: var(--scott-surface);
    color: var(--scott-primary);
    border: 1px solid var(--scott-primary);
}
.btn-secondary:hover {
    background: var(--scott-primary-light);
    color: var(--scott-primary);
}
.btn-success { background: var(--scott-success); }
.btn-success:hover { background: var(--scott-success); filter: brightness(0.9); }
.btn-warning { background: var(--scott-warning); color: var(--scott-ink); }
.btn-warning:hover { background: var(--scott-warning); filter: brightness(0.9); }
.btn-danger { background: var(--scott-error); }
.btn-danger:hover { background: var(--scott-error); filter: brightness(0.9); }
.btn-lg { padding: var(--scott-space-3) var(--scott-space-6); font-size: var(--scott-text-base); }
.btn-block { display: block; width: 100%; text-align: center; }


/* .card family */
.card {
    background: var(--scott-surface);
    border-radius: var(--scott-radius-md);
    padding: var(--scott-space-6);
    box-shadow: var(--scott-shadow-sm);
    margin-bottom: var(--scott-space-4);
    border: 1px solid var(--scott-border);
}


/* .toolbar family */
.toolbar {
    display: flex;
    gap: var(--scott-space-3);
    align-items: center;
    margin-bottom: var(--scott-space-3);
    flex-wrap: wrap;
}


/* Form controls — minimal default so existing label+input markup works.
 * (scott_common's components.css ships .scott-form-control for swept
 * templates; this keeps the bare <input> styling consistent meanwhile.) */
input[type=text], input[type=password], input[type=email],
input[type=date], input[type=time], input[type=datetime-local],
input[type=number], input[type=tel], input[type=search],
select, textarea {
    width: 100%;
    padding: var(--scott-space-2) var(--scott-space-3);
    border: 1px solid var(--scott-border);
    border-radius: var(--scott-radius-sm);
    font-size: var(--scott-text-base);
    font-family: var(--scott-font-sans);
}
textarea { resize: vertical; }
label {
    display: block;
    margin: var(--scott-space-3) 0 var(--scott-space-1);
    font-weight: var(--scott-weight-semibold);
    font-size: var(--scott-text-sm);
}


/* Tables — preserve sr-trucking's table-heavy list layouts */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: var(--scott-space-2) var(--scott-space-3);
    border-bottom: 1px solid var(--scott-border);
}
th {
    background: var(--scott-surface-tint);
    font-weight: var(--scott-weight-semibold);
    font-size: var(--scott-text-sm);
}


/* .status-pill family — bridges to canonical {% scott_badge %} until
 * every <span class="status-pill ..."> is swept to {% scott_badge %}. */
.status-pill {
    display: inline-block;
    padding: 2px var(--scott-space-2);
    border-radius: var(--scott-radius-full);
    font-size: var(--scott-text-xs);
    font-weight: var(--scott-weight-semibold);
    color: var(--scott-surface);
}
.status-scheduled  { background: var(--scott-muted); }
.status-dispatched { background: var(--scott-primary); }
.status-picked_up  { background: var(--scott-warning); color: var(--scott-ink); }
.status-in_transit { background: var(--scott-warning); color: var(--scott-ink); }
.status-delivered  { background: var(--scott-success); }
.status-invoiced   { background: var(--scott-success); filter: brightness(1.1); }
.status-paid       { background: var(--scott-success); filter: brightness(0.7); }
.status-cancelled  { background: var(--scott-muted); filter: brightness(0.85); }
.status-open       { background: var(--scott-primary); }
.status-completed  { background: var(--scott-success); }
.status-blocked    { background: var(--scott-warning); color: var(--scott-ink); }


/* Misc utilities the staff templates use */
.muted {
    color: var(--scott-muted);
    font-size: var(--scott-text-sm);
}
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--scott-space-4);
}
@media (max-width: 720px) {
    .grid-2 { grid-template-columns: 1fr; }
}
.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--scott-space-4);
}
.messages li {
    padding: var(--scott-space-2) var(--scott-space-3);
    border-radius: var(--scott-radius-sm);
    background: var(--scott-info);
    color: var(--scott-surface);
    margin-bottom: var(--scott-space-1);
}


/* Driver-portal SOS button (used on driver "today" page).
 * Distinct from the office SOS *banner* (red full-width bar above navbar). */
.sos-button {
    background: var(--scott-error);
    color: var(--scott-surface);
}
