/* =====================================================================
   FinRiskLens AI — brand theme tokens (switchable)

   Theme 1 — IDBI Bank's own site palette:
       Dark Green   #00836C   primary
       Light Green  #4FA9A7   secondary
       Orange       #F37021   accent / action buttons
       Yellow       #FFAA0A   secondary accent
   Theme 2 (default) — classic maroon & gold (the original FinRiskLens palette).

   The active theme is the data-theme attribute on <html>, set by
   /js/theme.js (persisted in localStorage, key "frl-theme"). Bare :root
   — no attribute yet, or scripts blocked — falls back to Theme 2.
   All page/component CSS must reference these --brand-* variables
   instead of hardcoded brand hexes.
   ===================================================================== */

:root[data-theme="theme1"] {
    /* The four brand colours, verbatim from IDBI. Everything below is
       derived from them — shades step toward black, tints toward white —
       so the whole theme moves if IDBI ever revises one of these. */
    --brand-primary: #00836C;          /* Dark Green */
    --brand-primary-strong: #00735F;
    --brand-primary-hover: #006452;
    --brand-primary-dark: #005647;
    --brand-primary-deep: #00372D;
    --brand-secondary: #4FA9A7;        /* Light Green */
    --brand-secondary-container: #9ED0CF;
    --brand-accent: #F37021;           /* Orange */
    --brand-accent-soft: #FCD9B8;
    --brand-accent-deep: #B35F0C;
    /* Yellow is the fourth brand colour — a categorical accent for chart
       series and highlights. It carries dark text only: white on #FFAA0A
       measures 1.91:1, so never pair it with --brand-btn-fg. */
    --brand-accent-alt: #FFAA0A;       /* Yellow */
    --brand-accent-alt-soft: #FFE9BC;
    --brand-on-primary: #ffffff;
    --brand-on-primary-muted: #C7E4DF; /* light text on primary gradients */
    --brand-on-primary-faint: #9ED0C7;
    --brand-tint-bg: #F4F9F8;          /* faint primary-tinted surface */
    --brand-tint-bg-2: #EBF5F3;
    --brand-tint-border: #D4EAE6;      /* primary-tinted hairline */
    --brand-primary-rgb: 0, 131, 108;
    --brand-primary-dark-rgb: 0, 86, 71;
    --brand-secondary-rgb: 79, 169, 167;
    /* These read 245,130,32 before — the RGB of #F58220, an older orange
       the hex tokens had already moved off. Now they match #F37021. */
    --brand-accent-rgb: 243, 112, 33;
    --brand-accent-soft-rgb: 252, 217, 184;
    --brand-accent-deep-rgb: 179, 95, 12;
    --brand-accent-alt-rgb: 255, 170, 10;
    /* Action buttons — IDBI theme uses the brand orange */
    --brand-btn-bg: #F37021;
    --brand-btn-bg-hover: #D96114;
    --brand-btn-fg: #ffffff;
    --brand-btn-bg-rgb: 243, 112, 33;
    /* Dashboard sidebar logout chip */
    --brand-logout-bg: #FFD2AC;
    --brand-logout-bg-hover: #FFC291;
    /* Scrollbar thumb (see the Scrollbars section below) */
    --sb-thumb-color: #F37021;
    /* Chart "track" / backdrop series (the Maximum bars, the residual slice).
       --brand-tint-bg-2 was used for this, but it is a *surface* colour — at
       #EBF5F3 on a white card the bar was all but invisible. This is the same
       hue at ~38% over white: clearly readable, still recessive against the
       accent-coloured Earned bar. */
    --brand-chart-track: #9ED0C7;

    /* ── Surfaces ──────────────────────────────────────────────────────
       The page background and the card/hover tones stacked on it. These
       were a single hardcoded warm ramp on :root in Dashboard.css and
       Index.css, derived from the maroon seed — correct for Theme 2, but
       Theme 1 inherited a rose-tinted page under a green UI. Same lightness
       ladder as Theme 2 (95 / 92 / 87 / 82 / 77 / 71), tinted with the
       brand's dark green.
       ------------------------------------------------------------------ */
    --brand-surface: #F6FBFA;              /* page background */
    --brand-surface-low: #F0F8F6;
    --brand-surface-mid: #E6F3F0;
    --brand-surface-high: #DBEEEA;
    --brand-surface-highest: #D1E9E5;
    --brand-surface-dim: #C2E1DC;
    --brand-on-surface: #14201C;           /* body text  16.0:1 on surface */
    --brand-on-surface-variant: #3C534D;   /* muted text   7.9:1 */
    --brand-outline: #62786F;              /* hairlines    4.5:1 */
    --brand-ivory: #F5FAF9;
    --brand-ink: #172724;
}

:root,
:root[data-theme="theme2"] {
    --brand-primary: #8B1538;
    --brand-primary-strong: #7A1230;
    --brand-primary-hover: #74112F;
    --brand-primary-dark: #57001D;
    --brand-primary-deep: #36081A;
    --brand-secondary: #974354;
    --brand-secondary-container: #FD95A7;
    --brand-accent: #D4A537;
    --brand-accent-soft: #F3E2B2;
    --brand-accent-deep: #725C1E;
    /* Fourth categorical colour, the counterpart to Theme 1's yellow. Bronze
       rather than another gold so a four-slice chart stays readable next to
       --brand-accent. Dark text only, as with Theme 1. */
    --brand-accent-alt: #B8763A;
    --brand-accent-alt-soft: #F0D8BE;
    --brand-accent-alt-rgb: 184, 118, 58;
    --brand-on-primary: #ffffff;
    --brand-on-primary-muted: #F0C9D5;
    --brand-on-primary-faint: #D79AAB;
    --brand-tint-bg: #FAF7F8;
    --brand-tint-bg-2: #F9F1F3;
    --brand-tint-border: #EAD9DF;
    --brand-primary-rgb: 139, 21, 56;
    --brand-primary-dark-rgb: 87, 0, 29;
    --brand-secondary-rgb: 151, 67, 84;
    --brand-accent-rgb: 212, 165, 55;
    --brand-accent-soft-rgb: 243, 226, 178;
    --brand-accent-deep-rgb: 114, 92, 30;
    /* Action buttons — classic theme keeps the maroon CTA */
    --brand-btn-bg: #7A1230;
    --brand-btn-bg-hover: #57001D;
    --brand-btn-fg: #ffffff;
    --brand-btn-bg-rgb: 122, 18, 48;
    /* Dashboard sidebar logout chip */
    --brand-logout-bg: rgba(209, 79, 79, .15);
    --brand-logout-bg-hover: rgba(113, 48, 48, .15);
    /* Scrollbar thumb (see the Scrollbars section below) — medium-light maroon */
    --sb-thumb-color: #C96B80;
    /* Chart track — see the Theme 1 note above. */
    --brand-chart-track: #D6ADB9;

    /* ── Surfaces — the original warm ramp, unchanged. See Theme 1 above. */
    --brand-surface: #fff8f5;              /* page background */
    --brand-surface-low: #fbf2ed;
    --brand-surface-mid: #f5ece7;
    --brand-surface-high: #efe6e2;
    --brand-surface-highest: #e9e1dc;
    --brand-surface-dim: #e1d8d4;
    --brand-on-surface: #1e1b18;
    --brand-on-surface-variant: #564144;
    --brand-outline: #897174;
    --brand-ivory: #FBF8F3;
    --brand-ink: #2B2026;
}

/* ---------------------------------------------------------------------
   Progress bars — follow the theme's action colour (orange on Theme 1,
   maroon on Theme 2). Semantic bars (bg-success/bg-danger/...) keep
   their own colour because Bootstrap's bg-* utilities are !important.
   --------------------------------------------------------------------- */
.progress-bar {
    background-color: var(--brand-btn-bg);
}

.progress-bar.bg-primary {
    background-color: var(--brand-btn-bg) !important;
}

/* ---------------------------------------------------------------------
   Theme toggle icon (rendered by Views/Shared/_ThemeSwitch.cshtml) —
   sits in the header beside the Google translation button. The
   two-tone dot shows the current palette; clicking switches theme.
   Default styling matches a light topbar; .brandbar overrides below
   match the dark landing/onboarding header.
   --------------------------------------------------------------------- */
.frl-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--brand-tint-border);
    border-radius: 10px;
    padding: .3rem .45rem;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.frl-theme-toggle .frl-theme-dot {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .12);
    background: linear-gradient(90deg, var(--brand-primary) 50%, var(--brand-accent) 50%);
}

.frl-theme-toggle:hover {
    background: var(--brand-tint-bg);
    border-color: var(--brand-primary);
}

.brandbar .frl-theme-toggle {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: .75rem;
}

.brandbar .frl-theme-toggle:hover {
    background: rgba(255, 255, 255, .15);
    border-color: var(--brand-accent-soft);
}

@media print {
    .frl-theme-toggle { display: none !important; }
}

/* ---------------------------------------------------------------------
   Scrollbars — thin track/thumb, applied to every scrolling element
   site-wide (panels, tables, sidebars, modals, and the page itself).
   Thumb color follows the active theme (--sb-thumb-color is set per-theme
   above: yellow on Theme 1, medium-light maroon on Theme 2); the track
   stays the same dark slate on both.

   No JS involved — a scrollbar only exists at all once its element's
   content actually overflows, so a full-height page (content ≤ 100vh)
   never shows one; the moment content grows past one screen, the browser
   creates the scrollbar and it's already styled.
   --------------------------------------------------------------------- */
:root {
    --sb-track-color: #232E33;
    --sb-size: 10px;        /* one size, every scrollbar on every page */
}

/* CustLogin only — the site-wide 10px reads too heavy on this page. */
body.sb-size-short {
    --sb-size: 5px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
}

*::-webkit-scrollbar {
    width: var(--sb-size);
    height: var(--sb-size);
}

*::-webkit-scrollbar-track {
    background: var(--sb-track-color);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
    background: var(--sb-thumb-color);
    border-radius: 3px;
}
