/* ---------------------------------------------------------------------------
   Yankee: the styles the web portal and the mobile app share, built on yankee-tokens.css.
   The design system (Documents/03-Architecture/design-system) is the reference; each app's app.css keeps only what
   is specific to that surface. Load order: bootstrap → yankee-tokens.css → yankee.css → app.css → scoped styles.
   --------------------------------------------------------------------------- */

/* Bootstrap onto the tokens. The brand orange stays the accent for marks that aren't text; anything carrying white
   text uses `action` (4.96:1), links use `brand-orange-dark` (4.54:1 on ground). */
:root {
    --bs-primary: var(--brand-orange);
    --bs-primary-rgb: 232, 98, 44;
    --bs-link-color: var(--brand-orange-dark);
    --bs-link-color-rgb: 193, 73, 28;
    --bs-link-hover-color: var(--brand-orange-darker);
    --bs-border-radius: var(--radius-base);
    --bs-border-color: var(--line);
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--ground);
}

html, body {
    background-color: var(--ground);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.01em;
    color: var(--brand-charcoal);
}
h1 { font-weight: 600; }
h1:focus { outline: none; }

a, .btn-link { color: var(--brand-orange-dark); text-decoration: none; }
a:hover, .btn-link:hover { color: var(--brand-orange-darker); text-decoration: underline; }

/* Buttons. A filled primary is `action` with `on-action` text; the brand orange alone is 3.38:1 under white. */
.btn-primary {
    --bs-btn-color: var(--on-action);
    --bs-btn-bg: var(--action);
    --bs-btn-border-color: var(--action);
    --bs-btn-hover-color: var(--on-action);
    --bs-btn-hover-bg: var(--brand-orange-darker);
    --bs-btn-hover-border-color: var(--brand-orange-darker);
    --bs-btn-active-color: var(--on-action);
    --bs-btn-active-bg: var(--brand-orange-darker);
    --bs-btn-active-border-color: var(--brand-orange-darker);
    --bs-btn-disabled-color: var(--on-action);
    --bs-btn-disabled-bg: var(--action);
    --bs-btn-disabled-border-color: var(--action);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-orange-dark);
    --bs-btn-border-color: var(--brand-orange);
    --bs-btn-hover-color: var(--on-action);
    --bs-btn-hover-bg: var(--action);
    --bs-btn-hover-border-color: var(--action);
    --bs-btn-active-color: var(--on-action);
    --bs-btn-active-bg: var(--brand-orange-darker);
    --bs-btn-active-border-color: var(--brand-orange-darker);
}
.badge.text-bg-primary { background-color: var(--action) !important; color: var(--on-action) !important; }
.badge.text-bg-info { background-color: var(--badge-info) !important; }
.form-check-input:checked { background-color: var(--action); border-color: var(--action); }

/* Keyboard focus: a solid 2px ring (at least 5.79:1 on every surface) plus the soft halo. The halo alone was under
   3:1. Mouse clicks don't draw the ring (:focus-visible). */
.btn:focus-visible, a:focus-visible, .nav-link:focus-visible,
.form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    box-shadow: var(--shadow-focus);
}
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand-orange); box-shadow: var(--shadow-focus); }

/* Cards and tables: one radius and one header for both apps (the mobile 0.5rem corners and tinted header were drift). */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-card);
}
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    color: var(--brand-charcoal);
}
.table { --bs-table-bg: transparent; }
.table > thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom: 2px solid var(--line);
}

/* Validation and the framework error UI. A red outline is never the only signal: a message says what to fix. */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--validation-valid); }
.invalid { outline: 1px solid var(--validation-error); }
.validation-message { color: var(--validation-error); }
.blazor-error-boundary { background: var(--error-boundary); padding: 1rem; color: #fff; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* Highlight action (ST-01-19; design system Button, "Highlight action"): the one blue full-width button, Home's "New request".
   action-highlight / on-action-highlight, light and dark from the tokens; never used for anything else. It is an anchor
   (a link to the Requests page, or Capture on the phone) and carries an icon (aria-hidden) and its word, never colour alone. */
.btn-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    min-height: var(--touch-target, 48px);
    padding: .6rem 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--on-action-highlight);
    background-color: var(--action-highlight);
    border: 2px solid var(--action-highlight);
    border-radius: .5rem;
    text-decoration: none;
}
.btn-highlight:hover, .btn-highlight:active {
    color: var(--on-action-highlight);
    background-color: var(--action-highlight);
    border-color: var(--on-action-highlight);
    filter: brightness(1.12);
    text-decoration: none;
}
.btn-highlight:focus-visible {
    color: var(--on-action-highlight);
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    box-shadow: var(--shadow-focus);
}
.btn-highlight-icon {
    display: inline-block;
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    text-align: center;
    background-color: currentColor;
    -webkit-mask: var(--btn-highlight-icon) center / contain no-repeat;
    mask: var(--btn-highlight-icon) center / contain no-repeat;
    --btn-highlight-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8.5 6.5a.5.5 0 0 0-1 0V8H6a.5.5 0 0 0 0 1h1.5v1.5a.5.5 0 0 0 1 0V9H10a.5.5 0 0 0 0-1H8.5V6.5z'/%3E%3Cpath d='M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z'/%3E%3Cpath d='M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z'/%3E%3C/svg%3E");
}
/* A plain glyph (the phone's tile style) has no mask. */
.btn-highlight-glyph { background: none; -webkit-mask: none; mask: none; width: auto; height: auto; line-height: 1; font-size: 1.3rem; }
/* Forced colours (Windows high contrast): the system palette replaces the fill, so keep an outline, the word and the icon in it. */
@media (forced-colors: active) {
    .btn-highlight { forced-color-adjust: none; color: LinkText; background-color: Canvas; border-color: LinkText; }
    .btn-highlight:hover, .btn-highlight:focus-visible { color: Highlight; border-color: Highlight; background-color: Canvas; filter: none; }
}

/* Touch targets (NFR-UX-001): any control a driver uses on the road is at least 48px high. */
.yk-touch {
    min-height: var(--touch-target);
    font-size: 1.05rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.yk-touch-field { min-height: var(--touch-target); font-size: 1.05rem; }

/* StatusBadge and JobMarkers (Yankee.Clients.Shared/Display): every state is an icon AND a word in its own colour
   pair (NFR-UX-004). The `badge` class stays for layout and for the tests that find a status by it. */
.yk-status, .yk-marker {
    --bs-badge-color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: .3em;
    font-weight: 700;
}
.yk-ico { font-weight: 700; line-height: 1; }
.yk-status--pending    { color: var(--status-pending-fg);    background-color: var(--status-pending-bg); }
.yk-status--scheduled  { color: var(--status-scheduled-fg);  background-color: var(--status-scheduled-bg); }
.yk-status--inprogress { color: var(--status-inprogress-fg); background-color: var(--status-inprogress-bg); }
.yk-status--deferred   { color: var(--status-deferred-fg);   background-color: var(--status-deferred-bg); }
.yk-status--completed  { color: var(--status-completed-fg);  background-color: var(--status-completed-bg); }
.yk-status--failed     { color: var(--status-failed-fg);     background-color: var(--status-failed-bg); }
.yk-status--cancelled  { color: var(--status-cancelled-fg);  background-color: var(--status-cancelled-bg); }
.yk-status--unknown    { color: var(--status-pending-fg);    background-color: var(--status-pending-bg); }
.yk-marker--urgent     { color: var(--urgent-fg);            background-color: var(--urgent-bg); }
.yk-marker--promise    { color: var(--promise-fg);           background-color: var(--promise-bg); }
.yk-marker--redirected { color: var(--status-deferred-fg);   background-color: var(--status-deferred-bg); }
.yk-marker--approval   { color: var(--promise-fg);           background-color: var(--promise-bg); white-space: normal; text-align: left; }
.yk-markers { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; }


/* ST-03-05: a re-route's two stops. Each is an icon AND a word; the colour only reinforces it. */
.yk-marker--leg { background: var(--yk-surface-2, #eef2f7); color: var(--yk-text, #1f2933); border: 1px solid var(--yk-border, #c8d1dc); }
.yk-marker--link { background: transparent; color: var(--yk-text-muted, #52606d); border: 1px dashed var(--yk-border, #c8d1dc); }
.yk-marker--part { background: var(--yk-warning-bg, #fff4d6); color: var(--yk-warning-text, #6b4e00); border: 1px solid var(--yk-warning-border, #e0b84a); white-space: normal; text-align: left; }
.yk-marker--held { background: var(--yk-warning-bg, #fff4d6); color: var(--yk-warning-text, #6b4e00); border: 1px solid var(--yk-warning-border, #e0b84a); }
