/* =================================================================
 * Custom state colors for Weblate (Realidea FR).
 * Loaded via nginx sub_filter — every Weblate HTML page gets
 * <link rel="stylesheet" href="/custom/weblate-states.css">.
 *
 * Edit + hard-refresh in browser to push (300s nginx cache).
 * ================================================================= */

/* =================================================================
 * PROGRESS BARS (dashboards: project list, component list, etc.)
 * Weblate uses div.progress-stacked > div.progress[title="State"] >
 * div.progress-bar[.progress-bar-success]. We target the [title] of
 * the parent .progress, which is the stable signal of which state
 * the segment represents.
 * ================================================================= */

/* Approved — vivid green, "fully validated, can ship" */
.progress-stacked > .progress[title*="Approved" i] > .progress-bar {
    background-color: #28a745 !important;
}

/* Translated (awaiting review) — blue, "done but needs validation" */
.progress-stacked > .progress[title*="Translated without" i] > .progress-bar,
.progress-stacked > .progress[title*="awaiting review" i] > .progress-bar {
    background-color: #1976d2 !important;
}

/* Translated with checks / needs editing / fuzzy — amber */
.progress-stacked > .progress[title*="check" i] > .progress-bar,
.progress-stacked > .progress[title*="needs editing" i] > .progress-bar,
.progress-stacked > .progress[title*="fuzzy" i] > .progress-bar,
.progress-stacked > .progress[title*="Needs attention" i] > .progress-bar {
    background-color: #f9a825 !important;
}

/* Failing checks — red */
.progress-stacked > .progress[title*="failing" i] > .progress-bar {
    background-color: #d32f2f !important;
}

/* Untranslated — light gray */
.progress-stacked > .progress[title*="Untranslated" i] > .progress-bar,
.progress-stacked > .progress[title*="Not translated" i] > .progress-bar {
    background-color: #adb5bd !important;
}


/* =================================================================
 * UNIT LIST ROWS (the table of strings inside a translation)
 *
 * Weblate marks each row's state via a class on the first <td>:
 *     <td class="unit-state-cell unit-state-XXX" title="...">
 * Where XXX is one of:
 *   - good        approved, no failing checks
 *   - translated  translated, awaiting review
 *   - bad         has failing checks (overrides the actual state in the
 *                 indicator UI — even "approved" strings show as "bad"
 *                 if a check fails)
 *   - fuzzy       needs editing
 *   - empty       untranslated
 *
 * We color the indicator cell itself AND the full row (via :has()
 * selector, supported in Chrome 105+, Firefox 121+, Safari 15.4+).
 * ================================================================= */

/* ----- Indicator cell: colored block at the left of each row ----- */

td.unit-state-good {
    background-color: #28a745 !important;
}
td.unit-state-translated {
    background-color: #1976d2 !important;
}
td.unit-state-bad {
    background-color: #d32f2f !important;
}
td.unit-state-fuzzy {
    background-color: #f9a825 !important;
}
td.unit-state-empty {
    background-color: #adb5bd !important;
}

/* ----- Full-row tint (light version of the cell color) ---------- */

tr:has(td.unit-state-good) {
    background-color: #e6f4ea !important;
}
tr:has(td.unit-state-translated) {
    background-color: #e3f2fd !important;
}
tr:has(td.unit-state-bad) {
    background-color: #fde7e9 !important;
}
tr:has(td.unit-state-fuzzy) {
    background-color: #fff8e1 !important;
}
tr:has(td.unit-state-empty) {
    background-color: #fafbfc !important;
}


/* =================================================================
 * BADGES / LABELS in the unit detail view (right sidebar pills)
 * Weblate uses Bootstrap label-* classes.
 * ================================================================= */

.label-success, .badge-success {
    background-color: #1976d2 !important;
    color: #fff !important;
}
.label-warning, .badge-warning {
    background-color: #f9a825 !important;
    color: #1f2328 !important;
}
.label-danger, .badge-danger {
    background-color: #d32f2f !important;
    color: #fff !important;
}
.label-default, .badge-default {
    background-color: #6c757d !important;
    color: #fff !important;
}
