/* ============================================================
   AE Partners theme — the only place colours and font names live.
   Warm light: cream canvas, coral / peach accents, sage secondary.
   Every module token in app.css and the scoped *.razor.css files
   points at these, so the dark set below re-themes the whole app.
   ============================================================ */

:root {
    /* Brand */
    --brand-primary: #F0564A;        /* coral red – bars, dots, borders, focus */
    --brand-primary-hover: #D9463B;
    --brand-primary-strong: #C63D32; /* buttons + link text: white on it is 5.1:1, on cream 4.9:1 (AA) */
    --brand-primary-soft: #F7A399;   /* salmon – secondary accents, badges */
    --brand-primary-tint: #FDE3DD;   /* very light coral – selected rows, chips bg */
    --brand-accent: #EE8A4A;         /* warm orange – highlights, charts */
    --brand-accent-soft: #FBC9A8;    /* peach */
    --brand-secondary: #A8B59A;      /* sage green – secondary/neutral accent */
    --brand-secondary-tint: #E6EBDF;

    /* Surfaces */
    --bg-app: #FDF9F4;
    --bg-surface: #FFFFFF;
    --bg-subtle: #FAF3EB;
    --border: #EFE4D8;
    --border-strong: #E0D2C3;

    /* Text */
    --text-primary: #0F1720;
    --text-secondary: #4A5260;
    --text-tertiary: #6B707A;  /* meta text: dates, counts, sublabels (AA 4.5:1+ on every light surface) */
    --text-muted: #8A8F98;     /* placeholders, disabled, decoration only (3.1:1) */
    --text-on-brand: #FFFFFF;
    --text-on-dark: #FFFFFF;         /* text on fills that stay dark in both themes */

    /* Status */
    --success: #5E8C61;  --success-tint: #E4EFE3;
    --warning: #E39B3B;  --warning-tint: #FCEFD9;
    --danger: #D64545;   --danger-tint: #FBE1E1;
    --info: #4F7FA8;     --info-tint: #E2ECF5;
    /* text-safe status inks (AA on white / tints) */
    --success-ink: #3F6B42;
    --warning-ink: #8A5A12;
    --danger-ink: #B23434;
    --info-ink: #36628A;

    /* Effects */
    --focus-ring: 0 0 0 3px rgba(240, 86, 74, 0.25);
    --shadow-sm: 0 1px 2px rgba(15, 23, 32, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 32, 0.07);
    --shadow-lg: 0 12px 32px rgba(15, 23, 32, 0.12);
    --scrim: rgba(15, 23, 32, 0.45);
    --gradient-brand: linear-gradient(135deg, #F0564A 0%, #EE8A4A 100%);
    --scrim-strong: rgba(15, 23, 32, 0.82); /* image lightbox */
    --media-bg: #000000;                     /* video / image letterbox */

    /* Third-party brand marks — fixed by their owners, not themed */
    --ms-red: #F25022;
    --ms-green: #7FBA00;
    --ms-blue: #00A4EF;
    --ms-yellow: #FFB900;
    /* Office file-type badges in the Inbox — the apps' own colours */
    --file-generic: #6B7280;
    --file-word: #2B579A;
    --file-excel: #217346;
    --file-powerpoint: #C43E1C;
    --file-pdf: #C62828;
    --file-zip: #8D6E1F;
    --file-image: #6A4FB3;
    --file-mail: #0F6CBD;

    /* Fonts */
    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    color-scheme: light;
}

/* Dark: warm charcoal with the same coral. Buttons flip to dark ink on a lighter coral. */
:root[data-theme="dark"] {
    --brand-primary: #F26B5F;
    --brand-primary-hover: #F5857A;
    --brand-primary-strong: #F07A6F;
    --brand-primary-soft: #B8645B;
    --brand-primary-tint: rgba(242, 107, 95, 0.16);
    --brand-accent: #F09A5F;
    --brand-accent-soft: #8A5735;
    --brand-secondary: #A8B59A;
    --brand-secondary-tint: rgba(168, 181, 154, 0.16);

    --bg-app: #15120F;
    --bg-surface: #1D1915;
    --bg-subtle: #241F1A;
    --border: #332B24;
    --border-strong: #463C32;

    --text-primary: #F4EEE7;
    --text-secondary: #C4BAAF;
    --text-tertiary: #A39A90;
    --text-muted: #978D83;
    --text-on-brand: #1A0F0C;

    --success: #7DB081;  --success-tint: rgba(125, 176, 129, 0.16);
    --warning: #EBB15E;  --warning-tint: rgba(235, 177, 94, 0.16);
    --danger: #F07070;   --danger-tint: rgba(240, 112, 112, 0.16);
    --info: #7FA8CC;     --info-tint: rgba(127, 168, 204, 0.16);
    --success-ink: #8FC293;
    --warning-ink: #EBB15E;
    --danger-ink: #F28A8A;
    --info-ink: #93B7D6;

    --focus-ring: 0 0 0 3px rgba(242, 107, 95, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --scrim: rgba(6, 5, 4, 0.72);

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand-primary: #F26B5F;
        --brand-primary-hover: #F5857A;
        --brand-primary-strong: #F07A6F;
        --brand-primary-soft: #B8645B;
        --brand-primary-tint: rgba(242, 107, 95, 0.16);
        --brand-accent: #F09A5F;
        --brand-accent-soft: #8A5735;
        --brand-secondary: #A8B59A;
        --brand-secondary-tint: rgba(168, 181, 154, 0.16);

        --bg-app: #15120F;
        --bg-surface: #1D1915;
        --bg-subtle: #241F1A;
        --border: #332B24;
        --border-strong: #463C32;

        --text-primary: #F4EEE7;
        --text-secondary: #C4BAAF;
        --text-tertiary: #A39A90;
        --text-muted: #978D83;
        --text-on-brand: #1A0F0C;

        --success: #7DB081;  --success-tint: rgba(125, 176, 129, 0.16);
        --warning: #EBB15E;  --warning-tint: rgba(235, 177, 94, 0.16);
        --danger: #F07070;   --danger-tint: rgba(240, 112, 112, 0.16);
        --info: #7FA8CC;     --info-tint: rgba(127, 168, 204, 0.16);
        --success-ink: #8FC293;
        --warning-ink: #EBB15E;
        --danger-ink: #F28A8A;
        --info-ink: #93B7D6;

        --focus-ring: 0 0 0 3px rgba(242, 107, 95, 0.35);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
        --scrim: rgba(6, 5, 4, 0.72);

        color-scheme: dark;
    }
}

body {
    font-family: var(--font-body);
    background: var(--bg-app);
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }

/* Figures line up in tables and dashboard numbers */
td, th, .tabular, .kpi-value { font-variant-numeric: tabular-nums; }

/* Native checkboxes, radios, range sliders and progress bars */
:root { accent-color: var(--brand-primary-strong); }

/* Bootstrap hardcodes its blue in these states rather than reading --bs-primary;
   the html prefix out-ranks bootstrap.min.css, which loads after this file. */
html .form-control:focus,
html .form-select:focus,
html .form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: var(--focus-ring);
}

html .form-check-input:checked {
    background-color: var(--brand-primary-strong);
    border-color: var(--brand-primary-strong);
}

::selection { background: var(--brand-primary-tint); color: var(--text-primary); }

/* Bootstrap picks up the theme through its own variables. html:root out-ranks
   bootstrap.min.css's :root, which loads after this file. */
html:root, html[data-bs-theme] {
    --bs-body-font-family: var(--font-body);
    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-bg: var(--bg-subtle);
    --bs-border-color: var(--border);
    --bs-primary: var(--brand-primary-strong);
    --bs-primary-rgb: 198, 61, 50;
    --bs-link-color: var(--brand-primary-strong);
    --bs-link-color-rgb: 198, 61, 50;
    --bs-link-hover-color: var(--brand-primary-hover);
    --bs-success: var(--success);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-info: var(--info);
    --bs-focus-ring-color: rgba(240, 86, 74, 0.25);
    --bs-emphasis-color: var(--text-primary);
}
