/* =====================================================
   INRADR Design System — Colors (Ch. 01)
   Ported from .docs/context/design/design-system-inradr.html
   inradr-design layer · Light (default) and Dark appearance

   Tokens only: the light ':root' block, then the one ':root[data-theme="dark"]' block of the
   Dark appearance. _Host.cshtml sets data-theme on <html> from XAF's Fluent theme mode, so
   the tokens and the DevExpress theme always show the same appearance. Components follow
   the tokens; a component rule keys on the theme only where the spec gives one role two
   different tokens. Every token mirrored as a constant in
   INRADR.Module.Blazor/Features/Dashboards/Viz/InradrVizColors.cs
   stays a literal '#RRGGBB' value in the light block: INRADR.Module.Tests/Dashboards/InradrVizColorTokenTests
   reads '--token: #hex;' from it. Synonyms are var() aliases.
   ===================================================== */

:root {
    /* --- Brand & Accent --- */
    --inradr-color-accent: #009DE2;
    --inradr-color-accent-hover: #0089C5;                     /* accent -10% L — primary btn hover */
    --inradr-color-accent-tint-8: rgba(0, 157, 226, 0.08);    /* secondary btn hover fill */
    --inradr-color-accent-tint-16: rgba(0, 157, 226, 0.16);   /* secondary btn active fill */
    --inradr-color-accent-light: #70D4FF;
    --inradr-color-accent-dark: var(--inradr-color-navy);            /* Deep Sea — same colour as the navy chrome */
    --inradr-color-accent-secondary: #0B4F6C;

    /* --- Surface --- */
    --inradr-color-surface-muted: #F5F5F5;
    --inradr-color-surface: #FFFFFF;       /* page canvas, cards, panels, table rows */
    --inradr-color-navy: #01374E;
    --inradr-color-navigation: var(--inradr-color-navy);   /* header and main navigation, navy in both appearances */
    /* Page canvas (body, shell, content column), DSX-19: white in Light (since the delivery of 2026-09-30), the muted
       Deep Sea in Dark. The spec of 2026-11-15 names surface-muted as the canvas in both appearances (FB-15). */
    --inradr-color-canvas: var(--inradr-color-surface);
    /* A white plate for content that stays light in both appearances (DSX-20): the splash screen, whose logo has
       black lettering, and the dark-filled illustrations of the error states. */
    --inradr-color-light-plate: #FFFFFF;

    /* --- On-navy chrome (header, footer) --- */
    --inradr-color-divider-on-navy: rgba(255, 255, 255, 0.1);    /* footer top border */
    --inradr-color-separator-on-navy: rgba(255, 255, 255, 0.6);  /* status bar separators */

    /* --- Borders --- */
    --inradr-color-border: #D3D3D2;

    /* --- Text --- */
    --inradr-color-text-primary: #1F2324;
    --inradr-color-text-secondary: #56676B;
    --inradr-color-text-body: #3F3F3E;
    --inradr-color-text-chart: #4E4E4E;        /* chart axis labels and values; literal: InradrVizColors.VizStandardGray */
    --inradr-color-text-muted: #7E8C91;
    --inradr-color-text-placeholder: #94A2A8;  /* placeholder and empty-selection text, never a label */
    --inradr-color-text-on-navy: #FFFFFF;
    --inradr-color-text-heading: var(--inradr-color-accent-dark);   /* page, section, card and popup headings; KPI values */

    /* --- Semantic Status --- */
    --inradr-color-status-ok: #64C34D;
    --inradr-color-status-ok-bg: #DCFCE7;
    --inradr-color-status-warn: #F49200;
    --inradr-color-status-warn-bg: #FEF3C7;
    --inradr-color-status-danger: #9E0409;
    --inradr-color-status-danger-hover: #840307;    /* danger btn hover  — -10% L */
    --inradr-color-status-danger-active: #6B0205;   /* danger btn active — -20% L */
    --inradr-color-status-danger-bg: #FEE2E2;
    --inradr-color-status-info: #2563EB;
    --inradr-color-status-info-bg: #DBEAFE;
    /* Strong status fills for the navy status bar with white text (message states). */
    --inradr-color-status-ok-strong-bg: #1B4332;
    --inradr-color-status-warn-strong-bg: #5C3D0A;
    --inradr-color-status-danger-strong-bg: var(--inradr-color-status-danger-active);
    /* Danger as a foreground on the page surfaces: negative values, error text, invalid borders (DSX-19). Not on the
       danger tint (alert, badge), which keeps --inradr-color-status-danger in both appearances. */
    --inradr-color-status-danger-text: var(--inradr-color-status-danger);

    /* --- Buttons ---
       The spec defines the button tokens for the Dark appearance only; their light values here are the colours the
       buttons have always had, so one set of rules serves both appearances and the DevExpress adapter
       (inradr-feature-button.css) reads the same tokens (DSX-19). The tertiary tokens wait for a consumer (OQ-35). */
    --inradr-color-button-primary-bg: var(--inradr-color-accent);
    --inradr-color-button-primary-hover-bg: var(--inradr-color-accent-hover);
    --inradr-color-button-primary-active-bg: var(--inradr-color-accent-dark);
    --inradr-color-button-primary-text: var(--inradr-color-text-on-navy);
    --inradr-color-button-secondary-bg: var(--inradr-color-surface);
    --inradr-color-button-secondary-text: var(--inradr-color-accent);
    --inradr-color-button-secondary-hover-bg: var(--inradr-color-accent-tint-8);
    --inradr-color-button-secondary-hover-text: var(--inradr-color-accent);
    --inradr-color-button-secondary-active-bg: var(--inradr-color-accent-tint-16);
    --inradr-color-button-text-color: var(--inradr-color-accent);
    --inradr-color-button-text-hover-bg: var(--inradr-color-surface-muted);
    --inradr-color-button-danger-bg: var(--inradr-color-status-danger);
    --inradr-color-button-danger-hover-bg: var(--inradr-color-status-danger-hover);
    --inradr-color-button-danger-active-bg: var(--inradr-color-status-danger-active);
    --inradr-color-button-danger-text: var(--inradr-color-text-on-navy);
    --inradr-color-button-danger-border: var(--inradr-color-status-danger);
    --inradr-color-button-danger-hover-border: var(--inradr-color-status-danger-hover);
    --inradr-color-button-danger-active-border: var(--inradr-color-status-danger-active);
    --inradr-button-danger-border-width: 1px;
    --inradr-color-button-focus: var(--inradr-focus-ring-color);
    --inradr-color-button-danger-focus: var(--inradr-focus-ring-color);
    --inradr-color-button-disabled-bg: var(--inradr-color-surface-muted);
    --inradr-color-button-disabled-text: var(--inradr-color-text-muted);
    --inradr-color-button-disabled-border: var(--inradr-color-border);

    /* --- Table / Grid --- */
    --inradr-color-row-selected: #F0F9FD;   /* --inradr-color-accent at 6% on white — shared hover/focus/selected row tint */

    /* --- Overlays --- */
    --inradr-color-backdrop: rgba(0, 0, 0, 0.45);   /* scrim behind own modal layers and the product tour */

    /* --- Focus --- */
    --inradr-focus-ring-color: var(--inradr-color-accent);
    --inradr-focus-ring-width: 2px;
    --inradr-focus-ring-offset: 2px;

    /* --- Icons ---
       XAF action icons are <img> elements and cannot take a colour token. This filter chain tints a
       black icon to approximately --inradr-color-accent (#009DE2); recompute it when the accent changes. */
    --inradr-icon-filter-accent: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(1352%) hue-rotate(175deg) brightness(96%) contrast(101%);
    --inradr-icon-filter-on-navy: brightness(0) invert(1);   /* white icons on the navy header */

    /* --- Data Visualization — axis --- */
    --inradr-color-grid-line: #D6D6D6;
    --inradr-color-viz-axis: #4E4E4E;
    --inradr-color-viz-tick: #4E4E4E;

    /* --- Data Visualization — series palette (1–15) --- */
    --inradr-color-viz-1: #2F6690;    /* strong blue (primary anchor) */
    --inradr-color-viz-2: #E17C05;    /* orange */
    --inradr-color-viz-3: #4E9F3D;    /* green */
    --inradr-color-viz-4: #B84A62;    /* red */
    --inradr-color-viz-5: #7A5195;    /* purple */
    --inradr-color-viz-6: #D6C84F;    /* yellow */
    --inradr-color-viz-7: #1B3A4B;    /* dark blue */
    --inradr-color-viz-8: #8FB9A8;    /* muted teal */
    --inradr-color-viz-9: #F2A7A0;    /* light coral */
    --inradr-color-viz-10: #6C8EAD;   /* soft blue */
    --inradr-color-viz-11: #A1C181;   /* light green */
    --inradr-color-viz-12: #C2B8C6;   /* neutral */
    --inradr-color-viz-13: #1E6A70;   /* deep teal */
    --inradr-color-viz-14: #6B5A8E;   /* muted purple */
    --inradr-color-viz-15: #8A5A2B;   /* earth brown */

    /* --- Data Visualization — tints ---
       Badge and legend backgrounds, each paired with its series colour. viz-5-bg and viz-14-bg share one
       value in the spec (feedback FB-11 of the design-system record); kept as two tokens on purpose. */
    --inradr-color-viz-1-bg: #EAF2F8;
    --inradr-color-viz-2-bg: #FAF1E5;
    --inradr-color-viz-4-bg: #FDECE9;
    --inradr-color-viz-5-bg: #F0ECF7;
    --inradr-color-viz-7-bg: #E9EEF0;
    --inradr-color-viz-13-bg: #E6F3F4;
    --inradr-color-viz-14-bg: #F0ECF7;
    --inradr-color-viz-15-bg: #F8EFE5;

    /* --- Data Visualization — standard anchors ---
       Brand highlight, and the neutral fallback for "other" and "not specified" categories. */
    --inradr-color-viz-standard-blue: var(--inradr-color-accent);
    --inradr-color-viz-standard-blue-bg: var(--inradr-color-accent-tint-8);
    --inradr-color-viz-standard-gray: var(--inradr-color-text-chart);
    --inradr-color-viz-standard-gray-bg: var(--inradr-color-surface-muted);

    /* --- Data Visualization — semantic series roles ---
       The spec prefers these over the numbered tokens in new chart and badge code. */
    --inradr-color-viz-series-primary: var(--inradr-color-viz-1);
    --inradr-color-viz-series-compare: var(--inradr-color-viz-2);
    --inradr-color-viz-series-alert: var(--inradr-color-viz-4);
    --inradr-color-viz-series-support: var(--inradr-color-viz-5);
    --inradr-color-viz-series-cluster: var(--inradr-color-viz-13);
    --inradr-color-viz-series-type: var(--inradr-color-viz-14);
    --inradr-color-viz-series-value: var(--inradr-color-viz-15);
    --inradr-color-viz-series-neutral: var(--inradr-color-viz-standard-gray);
    --inradr-color-viz-series-primary-bg: var(--inradr-color-viz-1-bg);
    --inradr-color-viz-series-compare-bg: var(--inradr-color-viz-2-bg);
    --inradr-color-viz-series-alert-bg: var(--inradr-color-viz-4-bg);
    --inradr-color-viz-series-support-bg: var(--inradr-color-viz-5-bg);
    --inradr-color-viz-series-cluster-bg: var(--inradr-color-viz-13-bg);
    --inradr-color-viz-series-type-bg: var(--inradr-color-viz-14-bg);
    --inradr-color-viz-series-value-bg: var(--inradr-color-viz-15-bg);

    /* --- Data Visualization — sequential ramp (1–5) ---
       Magnitude in one hue, light to dark: the classes of the country map. Step 4 is viz-1 and
       step 5 the brand navy, so the ramp continues the palette; the lightest step stands clear of
       the map's land colour (surface-muted). Adjacent steps are at least 12 OKLab units apart. */
    --inradr-color-viz-seq-1: #B7D6F1;
    --inradr-color-viz-seq-2: #83B2D9;
    --inradr-color-viz-seq-3: #538DBA;
    --inradr-color-viz-seq-4: #2F6690;
    --inradr-color-viz-seq-5: #01374E;
}

/* =====================================================
   Dark appearance (delivery of 2026-11-15, design-system-inradr.html ':root[data-theme="dark"]')
   The spec's values first, verbatim; then the own additions of DSX-19. The canvas and muted surfaces
   take Deep Sea, cards and panels charcoal, text turns white or light grey; the navigation stays navy.
   The chart series keep their colours (spec); the Plotly charts do not follow yet (C# palette).
   ===================================================== */
:root[data-theme="dark"] {
    color-scheme: dark;

    /* --- Spec --- */
    --inradr-color-accent-dark: var(--inradr-color-accent-light);
    --inradr-color-surface-muted: #01374E;
    --inradr-color-surface: #1F2324;
    --inradr-color-navigation: #01374E;
    --inradr-color-text-primary: var(--inradr-color-text-on-navy);
    --inradr-color-text-heading: #F5F5F5;
    --inradr-color-status-danger-on-dark: #FF7A88;
    --inradr-color-text-secondary: var(--inradr-color-border);
    --inradr-color-text-body: var(--inradr-color-border);
    --inradr-color-text-chart: var(--inradr-color-border);
    --inradr-color-text-muted: var(--inradr-color-border);
    --inradr-color-text-placeholder: var(--inradr-color-border);
    --inradr-color-row-selected: var(--inradr-color-accent-tint-16);
    --inradr-color-grid-line: var(--inradr-color-border);
    --inradr-color-viz-axis: var(--inradr-color-border);
    --inradr-color-viz-tick: var(--inradr-color-border);
    --inradr-color-button-primary-bg: #55BCE6;
    --inradr-color-button-primary-hover-bg: #82D2F0;
    --inradr-color-button-primary-text: #062D38;
    --inradr-color-button-secondary-text: #8ADFFF;
    --inradr-color-button-secondary-hover-bg: #164F64;
    --inradr-color-button-secondary-hover-text: #BDEEFF;
    --inradr-color-button-tertiary-text: #D3D3D2;
    --inradr-color-button-tertiary-hover-bg: #164F64;
    --inradr-color-button-tertiary-hover-text: #FFFFFF;
    --inradr-color-button-danger-bg: #B84A62;
    --inradr-color-button-danger-hover-bg: #A13E53;
    --inradr-color-button-danger-text: #FFFFFF;
    --inradr-color-button-danger-border: #FF7A88;
    --inradr-color-button-focus: #70D4FF;
    --inradr-color-button-disabled-bg: #315765;
    --inradr-color-button-disabled-text: #B4C4C9;
    --inradr-color-button-disabled-border: #54727D;

    /* --- Own (DSX-19): what the spec states in prose or in its component rules --- */
    /* The page canvas takes the muted Deep Sea, the cards and panels on it the charcoal surface. */
    --inradr-color-canvas: var(--inradr-color-surface-muted);
    /* Danger foregrounds, focus rings and action icons in Accent Blue Light (spec, Inputs & Forms). */
    --inradr-color-status-danger-text: var(--inradr-color-status-danger-on-dark);
    --inradr-focus-ring-color: var(--inradr-color-accent-light);
    /* Tints a black icon to about #70D4FF (computed like the light chain; recompute when the colour changes). */
    --inradr-icon-filter-accent: brightness(0) saturate(100%) invert(69%) sepia(16%) saturate(1286%) hue-rotate(164deg) brightness(106%) contrast(104%);
    /* Buttons: default and active look the same; secondary transparent; text buttons in Accent Blue Light with the
       secondary hover fill; danger with a 2px border that also colours its focus outline. */
    --inradr-color-button-primary-active-bg: var(--inradr-color-button-primary-bg);
    --inradr-color-button-secondary-bg: transparent;
    --inradr-color-button-secondary-active-bg: transparent;
    --inradr-color-button-text-color: var(--inradr-color-accent-light);
    --inradr-color-button-text-hover-bg: var(--inradr-color-button-secondary-hover-bg);
    --inradr-color-button-danger-active-bg: var(--inradr-color-button-danger-bg);
    --inradr-color-button-danger-hover-border: var(--inradr-color-button-danger-border);
    --inradr-color-button-danger-active-border: var(--inradr-color-button-danger-border);
    --inradr-color-button-danger-focus: var(--inradr-color-button-danger-border);
    --inradr-button-danger-border-width: 2px;
}
