/* Single source of truth for warning/error colours of turbine status and minlog rows.
   Used by the dashboard, the management view and the wall. Change colours here only.
   Soft tint + a stripe of the strong colour on the left (Bootstrap 5 "subtle" palette) */
:root {
    /* The amber row used to be so pale it read as white on a phone in daylight. It is
       a step down now: same hue as the #ffc107 stripe beside it (82 against 84), and
       the chroma stays modest, because on a large area it is chroma that shouts. The
       red is untouched -- it was never the complaint, and the stripe and the offline
       pill stay the most saturated things on the card. */
    --wl-warning-bg: #ffda9e;
    --wl-warning-stripe: #ffc107;
    --wl-danger-bg: #f8d7da;
    --wl-danger-stripe: #dc3545;
    /* alarm text: dark enough to read both on white and on a danger row */
    --wl-alarm-fg: #842029;
    --wl-stripe-width: 4px;

    /* Text on a tinted row. The greys of the rest of the interface are chosen to be
       gentle on white and lose too much on a tint -- the units fall to 3.6:1 on the
       amber above. These keep the same three-step hierarchy the table has always had
       (current reading, older rows, units) with every step still legible: 10.7, 7.2
       and 4.8 to one. */
    --wl-tint-text: #262b31;
    --wl-tint-text-soft: #3f454d;
    --wl-tint-text-muted: #5a5f67;
}

/* !important: must win over Bootstrap 3/4 table, list and contextual backgrounds.
   On table rows the cells get the background, and the first cell the stripe */
.wl-warning:not(tr), tr.wl-warning > td, tr.wl-warning > th {
    background-color: var(--wl-warning-bg) !important;
}
.wl-warning:not(tr), tr.wl-warning > :first-child {
    box-shadow: inset var(--wl-stripe-width) 0 0 var(--wl-warning-stripe);
}

.wl-danger:not(tr), tr.wl-danger > td, tr.wl-danger > th {
    background-color: var(--wl-danger-bg) !important;
}
.wl-danger:not(tr), tr.wl-danger > :first-child {
    box-shadow: inset var(--wl-stripe-width) 0 0 var(--wl-danger-stripe);
}

/* room between the stripe and the text. Minlog tables (windTab*, management + wall)
   pad every row, so coloured and plain rows stay aligned */
tr.wl-warning > :first-child, tr.wl-danger > :first-child,
table[id^="windTab"] tr > :first-child {
    padding-left: calc(var(--wl-stripe-width) + 8px) !important;
}

/* boxes (alarm box, list items) with a left stripe look wrong with rounded corners */
.wl-warning:not(tr), .wl-danger:not(tr) {
    border-radius: 0 !important;
}

/* The three steps, spelled out for tinted rows. The specificity has to beat
   turbine-card.css's `.minlogs tbody tr:not(:first-child) td`, or the quiet grey wins. */
.minlogs tbody tr.wl-warning td, .minlogs tbody tr.wl-danger td { color: var(--wl-tint-text); }
.minlogs tbody tr:not(:first-child).wl-warning td,
.minlogs tbody tr:not(:first-child).wl-danger td { color: var(--wl-tint-text-soft); }
.minlogs tbody tr.wl-warning .unit, .minlogs tbody tr.wl-danger .unit,
.minlogs tbody tr.wl-warning .log-date, .minlogs tbody tr.wl-danger .log-date { color: var(--wl-tint-text-muted); }

/* Green is deliberately absent from the minlog tables -- a row that is merely fine
   should not shout. The customer dashboard is the exception it was built for: one
   status, on its own, where "all good" is the thing the reader came to check. */
.wl-success:not(tr), tr.wl-success > td, tr.wl-success > th {
    background-color: var(--wl-green-bg) !important;
}
.wl-success:not(tr), tr.wl-success > :first-child {
    box-shadow: inset var(--wl-stripe-width) 0 0 var(--wl-green);
}

/* alarm descriptions: text inside minlog rows (wall), or the alarm box (management view) */
.wl-alarm, .alarms.wl-danger {
    color: var(--wl-alarm-fg) !important;
}
