/* ============================================================
   CGov overrides.css — last stylesheet in the cascade.

   Lives at the END of the <link> chain in App.razor so it wins
   over Bootswatch Flatly (_content/CGov.Shared/bootstrap.min.css)
   without needing !important. Put any rule here that needs to
   beat Flatly's defaults.
   ============================================================ */

/* ── Bootstrap success / link / nav recoloring (light theme) ──
   Flatly uses bright teal-green (#18bc9c) across link/nav/
   navbar/btn/pagination/form-valid surfaces. That hue confuses
   the red-green colorblind among us — darkening it doesn't
   help. Replace with a true cyan-blue teal (#0e7490) which
   sits well outside the red-green confusion line and still
   reads as a positive/success cue. Dark theme is left alone.

   Scope to html:not([data-bs-theme="dark"]) — NOT :root.
   :root has specificity (0,1,0), same as [data-bs-theme="dark"].
   Since this file loads after Flatly's bootstrap.min.css, a
   :root rule here would win the cascade tie against Flatly's
   own [data-bs-theme="dark"] block and bleed our light-mode
   colors into dark mode. Anchoring on the explicit non-dark
   selector keeps the override contained.
   ─────────────────────────────────────────────────────────── */
html:not([data-bs-theme="dark"]) {
    /* Bootstrap success palette */
    --bs-success:                     #0E7490;
    --bs-success-rgb:                 14, 116, 144;
    --bs-success-text-emphasis:       #062E3A;
    --bs-success-bg-subtle:           #CFE3EB;
    --bs-success-border-subtle:       #86B7C9;
    /* Default links */
    --bs-link-color:                  #0E7490;
    --bs-link-color-rgb:              14, 116, 144;
    --bs-link-hover-color:            #0A5870;
    --bs-link-hover-color-rgb:        10, 88, 112;
    /* Navbar hover / active / brand-hover */
    --bs-navbar-hover-color:          #0E7490;
    --bs-navbar-active-color:         #0E7490;
    --bs-navbar-brand-hover-color:    #0E7490;
    /* Form valid state */
    --bs-form-valid-color:            #0E7490;
    --bs-form-valid-border-color:     #0E7490;
}

/* Nav tabs — Flatly hard-codes --bs-nav-tabs-link-active-color
   INSIDE the .nav-tabs selector (not at :root), so a top-level
   override never reaches it. Re-scope here. */
html:not([data-bs-theme="dark"]) .nav-tabs {
    --bs-nav-tabs-link-active-color:  #0E7490;
}

/* Dark mode body background — slightly lighter than Flatly's
   stock #212529 for a softer canvas. */
[data-bs-theme="dark"] {
    --bs-body-bg:      #282828;
    --bs-body-bg-rgb:  40, 40, 40;
}

/* .btn-success — Bootswatch hard-codes the teal inside the
   .btn-success rule, so we override at the same scope. */
html:not([data-bs-theme="dark"]) .btn-success {
    --bs-btn-bg:                      #0E7490;
    --bs-btn-border-color:            #0E7490;
    --bs-btn-hover-bg:                #0A5870;
    --bs-btn-hover-border-color:      #084C61;
    --bs-btn-active-bg:               #084C61;
    --bs-btn-active-border-color:     #084C61;
    --bs-btn-disabled-bg:             #0E7490;
    --bs-btn-disabled-border-color:   #0E7490;
}

/* Pagination — Flatly defines ALL pagination tokens on the
   parent .pagination element (normal bg, hover, active, etc.),
   so the cascade flows down to .page-link from there. Override
   at the same parent scope. */
html:not([data-bs-theme="dark"]) .pagination {
    --bs-pagination-bg:                  #0E7490;
    --bs-pagination-hover-bg:             #0A5870;
    --bs-pagination-active-bg:            #0A5870;
    --bs-pagination-active-border-color:  #0A5870;
    --bs-pagination-disabled-bg:          #5BA3B8;
}

/* Deep Dive (web search) offcanvas — pin to half the viewport.
   BlazorBootstrap's OffcanvasSize sets the panel width via its own
   class/inline style, so !important is needed to win here regardless
   of which mechanism it uses. Class applied in WebSearchPanel.razor. */
.offcanvas.deepdive-offcanvas {
    width: 50vw !important;
}

/* Subtle, theme-aware Fulfill-By row tints for /sales. Override the table's
   cell-background var (--bs-table-bg) with Bootstrap *-bg-subtle tokens so the
   row tints gently while text stays the default body color (legible). These
   reference theme-aware tokens (resolved per [data-bs-theme]), so no light/dark
   split is needed. Used by SalesLogic.BandRowClass on the /sales masterlist. */
.fulfill-row-success { --bs-table-bg: var(--bs-success-bg-subtle); }
.fulfill-row-info    { --bs-table-bg: var(--bs-info-bg-subtle); }
.fulfill-row-primary { --bs-table-bg: var(--bs-primary-bg-subtle); }
.fulfill-row-warning { --bs-table-bg: var(--bs-warning-bg-subtle); }
.fulfill-row-danger  { --bs-table-bg: var(--bs-danger-bg-subtle); }
