/* ═══════════════════════════════════════════════════════════════════════════
   BS Trader — Shared Button Contrast Layer
   File: src/main/resources/static/css/bs-buttons.css
   Served at: /css/bs-buttons.css

   Loaded by every admin / manager / portal screen (directly, or through
   /css/bs-responsive.css which @imports it).

   WHY THIS FILE EXISTS
   Every screen carries its own inline <style>, and each one hard-coded its
   button colours: bright brand fills (#4a9eff, #00ff88, #ff6b6b, #feca57,
   #10b981, #3b82f6 ...) with white text, brand-coloured text on light tints,
   and light-theme blanket rules such as `.light-theme button[class*="btn"]
   { color: inherit !important }` or `.light-theme .sidebar * { color: ... }`
   that recolour button text without looking at the button background.
   Result: white-on-white hovers and dark-on-dark pressed states.

   HOW IT WORKS
   1. PALETTE TOKENS (section 1). One token set per semantic hue, defined
      for the dark theme on :root and for the light theme on `.light-theme`
      (the class the theme switch puts on <html> and <body>). Screens that
      have no theme switch and are permanently light (login, MT import /
      converter) put `bsb-light` on <body> to get the light set. Each hue has:
        --bsb-<hue>-fill      solid button background
        --bsb-<hue>-fill-2    darker stop for gradients
        --bsb-<hue>-hover     background on :hover / :focus
        --bsb-<hue>-active    background on :active (pressed)
        --bsb-<hue>-on        text/icon colour on any of the four fills
        --bsb-<hue>-text      the hue used as text on the page surface or on
                              a translucent tint of the same hue
      Every pair is ≥ 4.5:1 (WCAG AA normal text) in its theme, so a button
      keeps its colour identity (blue/green/red/amber ...) and stays readable
      in every state. Page styles reference these tokens instead of literals.
   2. NEUTRAL TOKENS (section 2) for ghost/secondary buttons.
   3. STATE LAYER (section 3). Rules for the controls every screen shares:
      the disabled state of every button type (custom, Bootstrap,
      SweetAlert), the Dark/Light theme switch, the LIVE/DEMO server tabs,
      the logout button and the Bootstrap close icon on dark surfaces. (The
      canonical sidebar items use the same tokens in bs-responsive.css.)
      They carry `:not(#bsb)`, which adds ID-level specificity without
      changing what matches, so they win over page-local
      `.light-theme ... !important` rules wherever the page's <style> sits.

   HOW TO STYLE A NEW BUTTON
      solid:  background: var(--bsb-green-fill); color: var(--bsb-green-on);
              :hover  -> var(--bsb-green-hover)   :active -> var(--bsb-green-active)
      tinted: background: rgba(<hue>, .1–.2);    color: var(--bsb-green-text);
      Never pair a fill with a hard-coded #fff, and never give a light-theme
      rule a blanket `color` for every button.

   Hues: blue, indigo, violet, pink, red, orange, amber, green, teal, slate.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. Palette tokens — dark theme (default) ──────────────────────────── */
:root {
    --bsb-blue-fill: #2f6fde;   --bsb-blue-fill-2: #1d4ed8;   --bsb-blue-hover: #1d4ed8;   --bsb-blue-active: #1e40af;   --bsb-blue-on: #ffffff;   --bsb-blue-text: #9ccbff;
    --bsb-indigo-fill: #5b5be6; --bsb-indigo-fill-2: #4338ca; --bsb-indigo-hover: #4338ca; --bsb-indigo-active: #3730a3; --bsb-indigo-on: #ffffff; --bsb-indigo-text: #b4bffd;
    --bsb-violet-fill: #7c3aed; --bsb-violet-fill-2: #6d28d9; --bsb-violet-hover: #6d28d9; --bsb-violet-active: #5b21b6; --bsb-violet-on: #ffffff; --bsb-violet-text: #c9b8fd;
    --bsb-pink-fill: #db2777;   --bsb-pink-fill-2: #be185d;   --bsb-pink-hover: #be185d;   --bsb-pink-active: #9d174d;   --bsb-pink-on: #ffffff;   --bsb-pink-text: #fcc0e0;
    --bsb-red-fill: #dc2626;    --bsb-red-fill-2: #b91c1c;    --bsb-red-hover: #b91c1c;    --bsb-red-active: #991b1b;    --bsb-red-on: #ffffff;    --bsb-red-text: #ffa8a8;
    --bsb-orange-fill: #fb923c; --bsb-orange-fill-2: #f97316; --bsb-orange-hover: #fdba74; --bsb-orange-active: #f97316; --bsb-orange-on: #1a1a2e; --bsb-orange-text: #fec58f;
    --bsb-amber-fill: #feca57;  --bsb-amber-fill-2: #f5b52e;  --bsb-amber-hover: #fdd77d;  --bsb-amber-active: #f5b52e;  --bsb-amber-on: #1a1a2e;  --bsb-amber-text: #fde68a;
    --bsb-green-fill: #00e07a;  --bsb-green-fill-2: #00c46b;  --bsb-green-hover: #33f09a;  --bsb-green-active: #00c46b;  --bsb-green-on: #06281a;  --bsb-green-text: #86f5bd;
    --bsb-teal-fill: #22d3ee;   --bsb-teal-fill-2: #06b6d4;   --bsb-teal-hover: #67e8f9;   --bsb-teal-active: #06b6d4;   --bsb-teal-on: #082f49;   --bsb-teal-text: #7ee6f7;
    --bsb-slate-fill: #475569;  --bsb-slate-fill-2: #334155;  --bsb-slate-hover: #334155;  --bsb-slate-active: #1e293b;  --bsb-slate-on: #ffffff;  --bsb-slate-text: #c0c7d9;
}

/* ── 1b. Palette tokens — light theme ──────────────────────────────────── */
.light-theme,
.bsb-light {
    --bsb-blue-fill: #2563eb;   --bsb-blue-fill-2: #1d4ed8;   --bsb-blue-hover: #1d4ed8;   --bsb-blue-active: #1e40af;   --bsb-blue-on: #ffffff;   --bsb-blue-text: #1e40af;
    --bsb-indigo-fill: #4f46e5; --bsb-indigo-fill-2: #4338ca; --bsb-indigo-hover: #4338ca; --bsb-indigo-active: #3730a3; --bsb-indigo-on: #ffffff; --bsb-indigo-text: #3730a3;
    --bsb-violet-fill: #7c3aed; --bsb-violet-fill-2: #6d28d9; --bsb-violet-hover: #6d28d9; --bsb-violet-active: #5b21b6; --bsb-violet-on: #ffffff; --bsb-violet-text: #5b21b6;
    --bsb-pink-fill: #db2777;   --bsb-pink-fill-2: #be185d;   --bsb-pink-hover: #be185d;   --bsb-pink-active: #9d174d;   --bsb-pink-on: #ffffff;   --bsb-pink-text: #9d174d;
    --bsb-red-fill: #dc2626;    --bsb-red-fill-2: #b91c1c;    --bsb-red-hover: #b91c1c;    --bsb-red-active: #991b1b;    --bsb-red-on: #ffffff;    --bsb-red-text: #991b1b;
    --bsb-orange-fill: #c2410c; --bsb-orange-fill-2: #9a3412; --bsb-orange-hover: #9a3412; --bsb-orange-active: #7c2d12; --bsb-orange-on: #ffffff; --bsb-orange-text: #9a3412;
    --bsb-amber-fill: #f59e0b;  --bsb-amber-fill-2: #d97706;  --bsb-amber-hover: #fbbf24;  --bsb-amber-active: #d97706;  --bsb-amber-on: #1c1917;  --bsb-amber-text: #854d0e;
    --bsb-green-fill: #047857;  --bsb-green-fill-2: #065f46;  --bsb-green-hover: #065f46;  --bsb-green-active: #064e3b;  --bsb-green-on: #ffffff;  --bsb-green-text: #065f46;
    --bsb-teal-fill: #0e7490;   --bsb-teal-fill-2: #155e75;   --bsb-teal-hover: #155e75;   --bsb-teal-active: #164e63;   --bsb-teal-on: #ffffff;   --bsb-teal-text: #164e63;
    --bsb-slate-fill: #475569;  --bsb-slate-fill-2: #334155;  --bsb-slate-hover: #334155;  --bsb-slate-active: #1e293b;  --bsb-slate-on: #ffffff;  --bsb-slate-text: #334155;
}

/* ── 2. Neutral tokens ─────────────────────────────────────────────────── */
:root {
    --bsb-muted-text: #b0b9cf;          /* secondary/ghost button text        */
    --bsb-strong-text: #ffffff;         /* ghost button text on hover/press   */
    --bsb-ghost-hover-bg: rgba(255, 255, 255, 0.10);
    --bsb-soft-on: #1e293b;             /* text on light neutral fills        */
    --bsb-disabled-bg: #2a3142;         /* disabled button (any variant)      */
    --bsb-disabled-border: #3a4357;
    --bsb-disabled-text: #a3adc4;
}
.light-theme,
.bsb-light {
    --bsb-muted-text: #475569;
    --bsb-strong-text: #0f172a;
    --bsb-ghost-hover-bg: rgba(15, 23, 42, 0.07);
    --bsb-soft-on: #1e293b;
    --bsb-disabled-bg: #e2e8f0;
    --bsb-disabled-border: #cbd5e1;
    --bsb-disabled-text: #475569;
}

/* ── 3. State layer for controls shared by every screen ────────────────── */

/* 3a. Disabled — every button type.
   Pages used `opacity: .35–.6` on top of their colours, and buttons without
   their own disabled style fell back to the browser's 30%-alpha grey; both
   left the label below 3:1. A disabled control is shown the same way
   everywhere: neutral fill + readable neutral label (≥ 4.5:1 in both
   themes), no glow/lift, not-allowed cursor. */
html body :is(button, input[type="button"], input[type="submit"], input[type="reset"], .btn, a.btn, [role="button"]):not(.btn-close):is(:disabled, .disabled, [aria-disabled="true"]):not(#bsb) {
    opacity: 1 !important;
    filter: none !important;
    background: var(--bsb-disabled-bg) !important;
    border-color: var(--bsb-disabled-border) !important;
    color: var(--bsb-disabled-text) !important;
    -webkit-text-fill-color: currentColor !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}
html body :is(button, input[type="button"], input[type="submit"], input[type="reset"], .btn, a.btn, [role="button"]):not(.btn-close):is(:disabled, .disabled, [aria-disabled="true"]):not(#bsb) * {
    color: inherit !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* 3b. Dark / Light theme switch in the top bar. Several screens never gave
   the switch's track a light-theme colour (it stayed 30% black). */
.light-theme div.theme-toggle:not(#bsb) {
    background: rgba(15, 23, 42, 0.06) !important;
}
html body .theme-btn:not(.active):not(#bsb) {
    color: var(--bsb-muted-text) !important;
}
html body .theme-btn:not(.active):is(:hover, :focus-visible, :active):not(#bsb) {
    color: var(--bsb-strong-text) !important;
    background: var(--bsb-ghost-hover-bg) !important;
}
html body .theme-btn.active:not(#bsb) {
    background: linear-gradient(45deg, var(--bsb-blue-fill), var(--bsb-blue-fill-2)) !important;
    color: var(--bsb-blue-on) !important;
}
html body .theme-btn:not(#bsb) i,
html body .theme-btn:not(#bsb) span {
    color: inherit !important;
}

/* 3c. LIVE / DEMO server tabs (translucent tinted pills). */
html body .server-tab:not(#bsb) {
    color: var(--bsb-muted-text) !important;
}
html body .server-tab:is(:hover, :focus-visible, :active, .active):not(#bsb) {
    color: var(--bsb-strong-text) !important;
}
html body .server-tab:not(.active):is(:hover, :focus-visible, :active):not(#bsb) {
    background: var(--bsb-ghost-hover-bg) !important;
}
html body .server-tab:not(#bsb) > :not(.tab-badge) {
    color: inherit !important;
}

/* 3d. Logout button (red in every screen). */
html body .logout-btn:not(#bsb) {
    background: linear-gradient(135deg, var(--bsb-red-fill), var(--bsb-red-fill-2)) !important;
    color: var(--bsb-red-on) !important;
}
html body .logout-btn:is(:hover, :focus-visible):not(#bsb) {
    background: linear-gradient(135deg, var(--bsb-red-hover), var(--bsb-red-active)) !important;
}
html body .logout-btn:active:not(#bsb) {
    background: var(--bsb-red-active) !important;
}
html body .logout-btn:not(#bsb) * {
    color: inherit !important;
}

/* 3e. Bootstrap close (×) icon placed on a dark surface: the stock icon is a
   black SVG at 50% opacity — invisible there. Same treatment as
   Bootstrap's own .btn-close-white. */
html body :is(.bg-dark, .text-bg-dark, .table-dark) .btn-close:not(#bsb) {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
    opacity: 0.85 !important;
}

/* ── 4. Layering: messages above every window (2026-11-09) ──────────────
   One scale for every screen (broker, manager, portal - this file is loaded
   by all of them):
     page content  <  sticky bars (--bsz-sticky)  <  menus (--bsz-dropdown)
     <  windows and their backdrops (the pages' own modals / drawers /
        loaders, 2000 - 20000, all far below the next two layers)
     <  dialogs (SweetAlert2, --bsz-dialog)
     <  messages: toasts, notices, page alerts (--bsz-toast).
   A message is never behind an open window or its backdrop: every message
   element of the panel is listed here (or carries .bs-msg-layer, added by
   the scripts that build one), and the rule wins over the pages' own
   z-index values and inline styles. Position on screen is not changed. */
:root {
    --bsz-sticky: 1000;
    --bsz-dropdown: 1200;
    --bsz-dialog: 2147482000;
    --bsz-toast: 2147483000;
}
html body .swal2-container:not(#bsz) {
    z-index: var(--bsz-dialog) !important;
}
/* a SweetAlert2 toast (toast: true) is a message, not a dialog */
html body .swal2-container:has(> .swal2-toast):not(#bsz) {
    z-index: var(--bsz-toast) !important;
}
html body :is(.bs-msg-layer, #bs-notification-container, #notification.notification,
              #notification-2.notification, #toastContainer, #toast.toast, #uiToast,
              #mhToast, #successAlert, #errorAlert, #infoAlert, #alert.alert,
              #bsMsgStack):not(#bsz) {
    z-index: var(--bsz-toast) !important;
}
