/*
 * ScanCloud theme tokens.
 *
 * Loaded by every page shell before any other site CSS. Holds the design tokens
 * (--sc-*) for light and dark mode and maps Bootstrap 5.3 and DataTables 2.3
 * variables onto them. Component rules live in main.css.
 *
 * Fills (backgrounds under white text) keep the same brand value in both themes.
 * Only text tints and surfaces change in dark mode.
 *
 * See docs/theme.md for how to use the tokens.
 */

:root,
[data-bs-theme="light"] {
    /* Brand: red */
    --sc-red: #d3121a;
    --sc-red-rgb: 211, 18, 26;
    --sc-red-dark: #a90f16;
    --sc-red-text: #d3121a;
    --sc-red-light: #fdeced;
    --sc-red-focus-ring: #f2b8bb;

    /* Brand: grey */
    --sc-grey: #5b5b5b;
    --sc-grey-rgb: 91, 91, 91;
    --sc-grey-dark: #3f3f3f;
    --sc-grey-mid: #8a8a8a;
    --sc-grey-light: #eeeeee;

    /* Brand: gold. --sc-gold is for accents only (borders, underlines), never text
       and never under white text: it fails WCAG AA for both. */
    --sc-gold: #c9973a;
    --sc-gold-strong: #8a6420;
    --sc-gold-text: #8a6420;
    --sc-gold-light: #fbf3e3;
    --sc-gold-accent-text: #e2bd76;

    /* Surfaces and text */
    --sc-bg: #f3f3f3;
    --sc-card: #ffffff;
    --sc-line: #e0e0e0;
    --sc-input-border: #cfcfcf;
    --sc-text: #222222;
    --sc-text-rgb: 34, 34, 34;
    --sc-muted: #6f6f6f;
    --sc-row-hover: var(--sc-red-light);
    --sc-row-stripe: rgba(0, 0, 0, 0.025);

    /* Status */
    --sc-ok: #1f7a44;
    --sc-ok-light: #e3f3e9;
    --sc-warn: #a65d00;
    --sc-warn-light: #fff1dc;

    /* Status fills: backgrounds under white text, the same in both themes */
    --sc-ok-fill: #1f7a44;
    --sc-warn-fill: #a65d00;

    /* Default (white) button text */
    --sc-btn-text: #3f3f3f;

    /* Warehouse validation states. These carry business meaning; keep the hues. */
    --sc-validated: #c5e0b4;
    --sc-validated-rgb: 197, 224, 180;
    --sc-part-validated: #ffd966;
    --sc-part-validated-rgb: 255, 217, 102;
    --sc-not-validated: #f9c3c3;
    --sc-not-validated-rgb: 249, 195, 195;

    /* Shape and type */
    --sc-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.05);
    --sc-shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.18);
    --sc-radius: 6px;
    --sc-radius-sm: 4px;
    --sc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol";
    --sc-font-size: 0.8125rem; /* 13px */
    --sc-nav-height: 48px;

    /* Bootstrap 5.3 */
    --bs-body-bg: var(--sc-bg);
    --bs-body-bg-rgb: 243, 243, 243;
    --bs-body-color: var(--sc-text);
    --bs-body-color-rgb: var(--sc-text-rgb);
    --bs-body-font-family: var(--sc-font);
    --bs-body-font-size: var(--sc-font-size);
    --bs-body-line-height: 1.4;
    --bs-border-color: var(--sc-line);
    --bs-border-radius: var(--sc-radius-sm);
    --bs-border-radius-lg: var(--sc-radius);
    --bs-primary: var(--sc-red);
    --bs-primary-rgb: var(--sc-red-rgb);
    --bs-primary-text-emphasis: var(--sc-red-dark);
    --bs-primary-bg-subtle: var(--sc-red-light);
    --bs-primary-border-subtle: #f2b8bb;
    --bs-secondary: var(--sc-grey);
    --bs-secondary-rgb: var(--sc-grey-rgb);
    --bs-secondary-color: var(--sc-muted);
    --bs-tertiary-bg: var(--sc-grey-light);
    --bs-emphasis-color: #000000;
    --bs-link-color: var(--sc-red-text);
    --bs-link-color-rgb: var(--sc-red-rgb);
    --bs-link-hover-color: var(--sc-red-dark);
    --bs-link-hover-color-rgb: 169, 15, 22;
    --bs-focus-ring-color: rgba(var(--sc-red-rgb), 0.3);
    --bs-success: #1f7a44;
    --bs-success-rgb: 31, 122, 68;
    --bs-warning-text-emphasis: var(--sc-warn);
    --bs-danger: var(--sc-red);
    --bs-danger-rgb: var(--sc-red-rgb);

    /* DataTables 2.3 */
    --dt-row-selected: 251, 243, 227;
    --dt-row-selected-text: 34, 34, 34;
    --dt-row-selected-link: 169, 15, 22;
    --dtfc-tbody-cell_background: var(--sc-card);
    --dtfc-thead-cell_background: var(--sc-red);
}

[data-bs-theme="dark"] {
    --sc-red-text: #ef5a60;
    --sc-red-light: #3a1416;
    --sc-red-focus-ring: #7a2a2e;
    --sc-grey-light: #2f2f2f;
    --sc-gold-text: #e2bd76;
    --sc-gold-light: #3a2f1a;

    --sc-bg: #1b1b1b;
    --sc-card: #242424;
    --sc-line: #3a3a3a;
    --sc-input-border: #4a4a4a;
    --sc-text: #e8e8e8;
    --sc-text-rgb: 232, 232, 232;
    --sc-muted: #a8a8a8;
    --sc-row-hover: #333333;
    --sc-row-stripe: rgba(255, 255, 255, 0.03);

    --sc-ok: #5cc28a;
    --sc-ok-light: #16301f;
    --sc-warn: #f0a650;
    --sc-warn-light: #3a2a12;

    --sc-btn-text: #e8e8e8;

    --sc-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --sc-shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);

    --bs-body-bg: var(--sc-bg);
    --bs-body-bg-rgb: 27, 27, 27;
    --bs-body-color: var(--sc-text);
    --bs-body-color-rgb: var(--sc-text-rgb);
    --bs-border-color: var(--sc-line);
    --bs-primary-text-emphasis: var(--sc-red-text);
    --bs-primary-bg-subtle: var(--sc-red-light);
    --bs-primary-border-subtle: #7a2a2e;
    --bs-secondary-color: var(--sc-muted);
    --bs-tertiary-bg: var(--sc-grey-light);
    --bs-emphasis-color: #ffffff;
    --bs-link-color: var(--sc-red-text);
    --bs-link-color-rgb: 239, 90, 96;
    --bs-link-hover-color: #f58a8e;
    --bs-link-hover-color-rgb: 245, 138, 142;
    --bs-success-rgb: 31, 122, 68;
    --bs-warning-text-emphasis: var(--sc-warn);

    --dt-row-selected: 58, 47, 26;
    --dt-row-selected-text: 232, 232, 232;
    --dt-row-selected-link: 239, 90, 96;
    --dtfc-tbody-cell_background: var(--sc-card);
    --dtfc-thead-cell_background: var(--sc-red);
}
