/*
 * Iridium VERUS brand overrides.
 *
 * Kept in its own file (rather than edited into site.css) so upstream LubeLogger
 * CSS changes merge cleanly. Loaded after site.css in Views/Shared/_Layout.cshtml.
 *
 * Scoping hook: _Layout sets <body data-controller="..."> to the current MVC
 * controller name, so page-specific brand rules can be written without editing
 * individual upstream views.
 */

/*
 * Upstream's .lubelogger-logo assumes a wide wordmark (their logo is 204x48, a
 * 4.25:1 ratio) and pins height to 48px. The VERUS lockup is a squarer 2.7:1, so
 * at height:48px it only renders ~128px wide and the wordmark becomes unreadable.
 *
 * On the auth pages the logo sits alone in a 204px-wide card, so let it fill that
 * width instead and derive its own height (~77px). The navbar emblem is a separate,
 * square asset and is deliberately left at upstream's 48px.
 */
body[data-controller="Login"] .lubelogger-logo {
    height: auto;
    width: 100%;
    max-width: 204px;
    margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------------------
 * The weekly time-record entry grid (Phase 4b, spec 5.1).
 *
 * This screen is keyed every morning against a stack of paper timecards, so it
 * is built for speed: a whole week of the fleet on one screen, every cell a real
 * <button> so the grid is keyboard-navigable without any JavaScript at all, and
 * status carried by colour AND an icon so a red/green distinction is never the
 * only signal.
 *
 * Colours are Bootstrap's own semantic variables rather than fixed hex values,
 * so the grid follows whichever theme the user has chosen - including the dark
 * themes upstream ships.
 * ------------------------------------------------------------------------- */

/* Deliberately NOT table-layout:fixed. On a narrow window fixed layout squeezes the
   day columns until "06:00-17:00" wraps or clips; letting the content size the table
   and scrolling the wrapper instead keeps every cell readable at any width. */
.verus-timegrid table {
    width: auto;
    min-width: 100%;
}

.verus-timegrid-driver {
    width: 11rem;
    min-width: 9rem;
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
}

.verus-timegrid-today {
    box-shadow: inset 0 -3px 0 0 var(--bs-primary);
}

.verus-timegrid-cell {
    min-width: 6.75rem;
}

/* The cell itself. A button so Tab and Enter work with no scripting, and so
   screen readers announce it as something you can act on. */
.verus-timegrid-button {
    display: block;
    width: 100%;
    min-height: 3.25rem;
    padding: 0.25rem 0.3rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    text-align: center;
    line-height: 1.15;
    cursor: pointer;
}

.verus-timegrid-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.verus-timegrid-times {
    display: block;
    font-size: 0.75rem;
    white-space: nowrap;
}

.verus-timegrid-hours {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.verus-timegrid-flags {
    display: block;
    font-size: 0.7rem;
    min-height: 0.9rem;
}

.verus-timegrid-off {
    display: block;
    padding-top: 0.6rem;
    opacity: 0.55;
}

/* An unkeyed day is deliberately blank rather than green - nothing recorded is
   not the same as nothing wrong. The "+" only appears on hover or focus so a
   half-filled week does not read as a screen full of plus signs. */
/* An unkeyed day is deliberately blank rather than green - nothing recorded is not the
   same as nothing wrong. The "+" stays faintly visible rather than hidden until hover,
   because a grid of invisible targets is not discoverable to somebody keying it for the
   first time. */
.verus-timegrid-empty {
    display: block;
    padding-top: 0.7rem;
    opacity: 0.25;
    font-size: 1.1rem;
}

.verus-timegrid-button:hover .verus-timegrid-empty,
.verus-timegrid-button:focus-visible .verus-timegrid-empty {
    opacity: 0.75;
}

.verus-timegrid-green { background-color: rgba(var(--bs-success-rgb), 0.14); }
.verus-timegrid-amber { background-color: rgba(var(--bs-warning-rgb), 0.24); }
.verus-timegrid-red   { background-color: rgba(var(--bs-danger-rgb), 0.24); }
.verus-timegrid-off   { background-color: rgba(var(--bs-secondary-rgb), 0.12); }

/* Session W. Two states that are NOT green and NOT a problem.

   "recorded" - the day was kept, but no commercial motor vehicle was operated, so
   49 CFR Part 395 never reached it. Green would assert a compliance nobody checked.
   Deliberately a neutral blue rather than a shade of green, so it cannot be mistaken
   for a pass at a glance across a fleet-week.

   "unknown" - VERUS cannot tell whether the rules apply. An open question for a
   person, so it carries the same weight as an amber without claiming a breach. */
.verus-timegrid-recorded { background-color: rgba(var(--bs-info-rgb), 0.16); }
.verus-timegrid-unknown  { background-color: rgba(var(--bs-secondary-rgb), 0.28);
                           background-image: repeating-linear-gradient(45deg,
                               transparent, transparent 4px,
                               rgba(var(--bs-warning-rgb), 0.30) 4px,
                               rgba(var(--bs-warning-rgb), 0.30) 8px); }

.verus-timegrid-button:hover {
    filter: brightness(1.15);
}

/* Legend swatches. */
.verus-timegrid-key {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 0.35rem;
    vertical-align: -0.1rem;
    border: 1px solid var(--bs-border-color);
}

.verus-timegrid-empty-key { background-color: transparent; }

/* ---------------------------------------------------------------------------
   The driver portal (Phase 7b, spec 5.1/5.2).

   Phone first. This is opened one-handed, standing next to a vehicle, often
   outdoors - so tap targets are generous, the band colour is a left edge rather
   than a fill (readable in sunlight, and it does not fight the text), and
   nothing depends on hovering.
   --------------------------------------------------------------------------- */

.verus-portal-days .verus-portal-day {
    border-left: 4px solid transparent;
    padding: 0.75rem 0.85rem;
}

/* Matches the office grid's ordering exactly, so the two screens cannot tell
   different stories about the same day. Blank is blank - never green. */
.verus-portal-day-green { border-left-color: var(--bs-success); }
.verus-portal-day-amber { border-left-color: var(--bs-warning); }
.verus-portal-day-off { border-left-color: var(--bs-secondary); }
.verus-portal-day-empty { border-left-color: var(--bs-border-color); }

.verus-portal-today {
    background-color: rgba(var(--bs-primary-rgb), 0.06);
}

.verus-portal-times {
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
}

/* Big enough for a thumb on a moving vehicle. */
.verus-portal-actions .btn {
    min-width: 5.5rem;
    min-height: 2.5rem;
}

.verus-attest-figures dt {
    font-weight: 400;
    color: var(--bs-secondary-color);
}

.verus-attest-figures dd {
    font-variant-numeric: tabular-nums;
}

/* The words being affirmed. Set apart from the page so it reads as a statement
   somebody is signing rather than as more interface. */
.verus-attest-statement {
    background-color: var(--bs-tertiary-bg);
}

/* The office grid's attestation mark. Its own indicator, never folded into the
   band - an unsigned day is not a compliance problem, and colouring it as one
   would turn every record keyed before Phase 7 amber. */
.verus-timegrid-attested {
    color: var(--bs-success);
}

.verus-timegrid-reattest {
    color: var(--bs-warning);
}

/* ---------------------------------------------------------------------------
   Vehicle inspections on the portal (Phase 5b).

   Same phone-first reasoning as the rest of the portal: this gets used standing
   next to a vehicle at the end of a shift, one-handed, often in poor light.
   --------------------------------------------------------------------------- */

/* The pass/fault/N-A choice has to be hittable with a thumb without zooming. */
.verus-inspection-component .btn-group-sm > .btn {
    min-width: 3.75rem;
    min-height: 2.5rem;
}

.verus-inspection-component {
    background-color: var(--bs-body-bg);
}

/* A component marked as a fault stands out from the ones left alone, so a driver
   scrolling back up can see what they have flagged without reading every row. */
.verus-inspection-component:has(.btn-check[value="Defect"]:checked) {
    border-color: var(--bs-danger) !important;
}

.verus-defect-detail {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.5rem;
}
