/* =============================================================================
   Hardball Dynasty design tokens (2026 redesign)

   Source: Figma "What If Sports Page Foundational Structure"
     Light: node 191:21909   Dark: node 141:13029   (Team Statistics page)

   Two layers:
     1. Palette constants (--hbd-color-*)  - every raw hex value from the mocks,
        named for what the color IS. Never reference these from page CSS.
     2. Theme tokens (--hbd-*)             - named for what the color is FOR.
        Page CSS only uses these, so light/dark switching is automatic.

   The active theme comes from <html data-theme="light|dark">, which
   BaseTemplate.Master sets from the user's Appearance setting
   (Light / Dark / System). Team colors come from CityStyle.aspx (--team-*).

   NOTE: The Figma file has no color variables yet, so these values were
   sampled from the rendered mocks. Flat fills are exact; anything marked
   "estimated" (translucent cards over the photo background) needs
   confirmation from design.
   ========================================================================== */

:root {
    /* ---- 1. Palette constants -------------------------------------------- */

    /* Base */
    --hbd-color-white:            #ffffff;
    --hbd-color-white-85:         rgba(255, 255, 255, 0.85);
    --hbd-color-gray-85-white:    #d9d9d9;   /* white-85 flattened over black, for places with no photo behind */

    /* Neutral grays (light theme surfaces + text) */
    --hbd-color-gray-30:          #f6f6f6;
    --hbd-color-gray-50:          #ebebeb;
    --hbd-color-gray-100:         #e7e7e7;
    --hbd-color-gray-150:         #e3e3e3;
    --hbd-color-gray-200:         #e2e2e2;
    --hbd-color-gray-250:         #dcdbdb;
    --hbd-color-gray-300:         #cdcccc;
    --hbd-color-gray-400:         #c1c1c1;
    --hbd-color-gray-600:         #6c6c6c;
    --hbd-color-gray-650:         #6d6e71;
    --hbd-color-gray-700:         #5d5d5d;
    --hbd-color-gray-750:         #565656;
    --hbd-color-gray-800:         #4a4a4a;
    --hbd-color-gray-850:         #3a3a3a;
    --hbd-color-gray-900:         #363636;
    --hbd-color-gray-950:         #2d2d2d;

    /* Navy (dark theme surfaces) */
    --hbd-color-navy-600:         #252d3d;
    --hbd-color-navy-650:         #1e2537;
    --hbd-color-navy-700:         #1a1f2e;
    --hbd-color-navy-750:         #17191f;
    --hbd-color-navy-800:         #13171f;
    --hbd-color-navy-850:         #0f1422;
    --hbd-color-navy-900:         #0d1215;
    --hbd-color-navy-950:         #060c1d;
    --hbd-color-charcoal-650:     #38404a;
    --hbd-color-charcoal-700:     #25272c;
    --hbd-color-charcoal-900:     #1f2126;

    /* Slate (dark theme text) */
    --hbd-color-slate-50:         #e8edf8;
    --hbd-color-slate-100:        #e2e8f0;
    --hbd-color-slate-200:        #e1e1e1;
    --hbd-color-slate-300:        #c7c8cb;
    --hbd-color-slate-400:        #9aaac5;
    --hbd-color-slate-500:        #8e9197;
    --hbd-color-slate-600:        #5e6f8a;
    --hbd-color-slate-700:        #545966;

    /* Teal (primary action, sort indicator) */
    --hbd-color-teal-400:         #0ca9b9;
    --hbd-color-teal-600:         #05808c;
    --hbd-color-teal-700:         #056973;
    --hbd-color-teal-800:         #044c54;

    /* Gold (highlight: your team row, sorted column, leading stat) */
    --hbd-color-gold-100:         #e6dcc1;
    --hbd-color-gold-150:         #e3d9be;
    --hbd-color-gold-200:         #dfcfa6;
    --hbd-color-gold-300:         #dfc88c;
    --hbd-color-gold-350:         #dec47e;
    --hbd-color-gold-400:         #fbbf24;
    --hbd-color-gold-700:         #54451d;
    --hbd-color-gold-750:         #504527;
    --hbd-color-gold-800:         #3b372a;
    --hbd-color-gold-850:         #2f291e;
    --hbd-color-gold-900:         #292620;
    --hbd-color-gold-950:         #654b06;

    /* Orange (fallback accent when no team color is available) */
    --hbd-color-orange-700:       #a94e1c;

    /* Status (not in mocks: legacy win/loss and fatigue colors; the 400s are lightened for dark) */
    --hbd-color-green-400:        #4ade80;
    --hbd-color-green-700:        #008000;
    --hbd-color-red-400:          #f87171;
    --hbd-color-red-700:          #d40000;
    --hbd-color-blue-400:         #60a5fa;
    --hbd-color-blue-700:         #0000ff;
}

/* ---- 2. Theme tokens: shared by both themes ------------------------------ */
/* The main nav (header-* / nav-menu-*) is themed: dark in the mocks, light in light mode (2a/2b). */
:root {
    --hbd-accent:                       var(--team-accent, var(--hbd-color-orange-700));

    --hbd-nav-bg:                       var(--hbd-color-navy-900);
    --hbd-nav-text:                     var(--hbd-color-slate-300);
    --hbd-nav-button-border:            var(--hbd-color-navy-600);

    /* On-page help popup (Figma node 191:24779, "Help Info"): one light panel in both themes */
    --hbd-help-bg:                      var(--hbd-color-gray-30);
    --hbd-help-border:                  color-mix(in srgb, var(--hbd-color-navy-650) 60%, transparent);
    --hbd-help-shadow:                  rgba(0, 0, 0, 0.45);
    --hbd-help-title-bg:                var(--hbd-color-navy-850);
    --hbd-help-title-text:              var(--hbd-color-white);
    --hbd-help-location-bg:             color-mix(in srgb, var(--hbd-color-navy-850) 70%, transparent);
    --hbd-help-location-text:           var(--hbd-color-white);
    --hbd-help-text:                    var(--hbd-color-gray-900);
    --hbd-help-icon:                    var(--hbd-color-charcoal-900);
    --hbd-help-scrollbar:               var(--hbd-color-charcoal-650);

    --hbd-button-primary-bg:            var(--hbd-color-teal-700);
    --hbd-button-primary-text:          var(--hbd-color-white);
    --hbd-filter-icon:                  url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 14 14%27%3E%3Cpath d=%27M1.5 2.5h11L8.5 7.3v4.4l-3-1.4v-3z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E");  /* phone filter button funnel; fill = white */

    --hbd-table-title-text:             var(--hbd-color-white);

    /* Table sizing: tighter than the mocks (42/38/5px) so a full league fits on screen
       about as it did before the redesign (legacy rows are 25px). The row gap started at
       1.5px and was opened up to 4px after review (whole pixels render evenly). */
    --hbd-table-header-height:          30px;
    --hbd-table-row-height:             24px;
    --hbd-table-row-gap:                4px;
}

/* ---- 2a. Light theme (default when no data-theme is set) ----------------- */
:root,
:root[data-theme="light"] {
    /* Main nav: departs from the mocks (dark there) - a white card like the rest of light mode */
    --hbd-header-bg:                    rgba(255, 255, 255, 0.94);
    --hbd-header-divider:               var(--hbd-color-gray-300);
    --hbd-header-text:                  var(--hbd-color-gray-950);
    --hbd-header-eyebrow-text:          var(--hbd-color-gray-700);
    --hbd-header-tab-text:              var(--hbd-color-gray-700);
    --hbd-header-tab-active-text:       var(--hbd-color-gray-950);
    --hbd-header-tab-active-indicator:  var(--hbd-color-gray-950);

    --hbd-nav-menu-bg:                  var(--hbd-color-white);
    --hbd-nav-menu-sub-bg:              var(--hbd-color-gray-30);    /* phone: nested pages under a section */
    --hbd-nav-menu-border:              var(--hbd-color-gray-300);
    --hbd-nav-menu-text:                var(--hbd-color-gray-850);
    --hbd-nav-menu-hover-bg:            var(--hbd-table-row-hover-tint-bg);
    --hbd-nav-menu-hover-text:          var(--hbd-color-gray-950);
    --hbd-nav-menu-shadow:              rgba(0, 0, 0, 0.2);

    /* Departs from the mocks on purpose (contrast): white rows/components on an 85% white page surface. */
    --hbd-page-bg:                      var(--hbd-color-white-85);  /* surfaces sitting directly on the photo */
    --hbd-page-solid-bg:                var(--hbd-color-gray-85-white);  /* same surface where there is no photo (popups, phones) */
    --hbd-card-bg:                      var(--hbd-color-white);     /* components inside the page */
    --hbd-card-secondary-bg:            var(--hbd-color-white-85);  /* Quick Links / footer */
    --hbd-page-divider:                 var(--hbd-color-gray-600);   /* rules drawn directly on the page surface */
    --hbd-card-divider:                 var(--hbd-color-gray-250);
    --hbd-card-secondary-divider:       var(--hbd-color-gray-300);

    --hbd-text-heading:                 var(--hbd-color-gray-950);
    --hbd-text-body:                    var(--hbd-color-gray-850);
    --hbd-text-secondary:               var(--hbd-color-gray-800);   /* darkened from mocks: these all need to read on the 85% white page */
    --hbd-text-muted:                   var(--hbd-color-gray-800);
    --hbd-text-link:                    var(--hbd-color-gray-800);
    --hbd-text-accent:                  var(--hbd-color-teal-800);   /* not in mocks: legacy teal links/buttons, darkened for the 85% white page */
    --hbd-icon:                         var(--hbd-color-gray-950);

    --hbd-control-bg:                   var(--hbd-color-white);
    --hbd-control-border:               var(--hbd-color-gray-400);
    --hbd-control-field-border:         var(--hbd-color-gray-400);   /* not in mocks: drop-downs/text boxes in page content */
    --hbd-control-label-text:           var(--hbd-color-gray-800);   /* darkened from mocks (gray-600 read as faint next to the value) */
    --hbd-control-label-weight:         600;
    --hbd-control-value-text:           var(--hbd-color-gray-950);
    --hbd-select-arrow:                 url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 10 6%27%3E%3Cpath d=%27M1 1l4 4 4-4%27 fill=%27none%27 stroke=%27%23565656%27 stroke-width=%271.5%27/%3E%3C/svg%3E");  /* stroke = gray-750 */

    --hbd-table-title-bg:               var(--hbd-color-gray-900);
    --hbd-table-header-bg:              var(--hbd-color-gray-700);   /* departs from mocks: must stand out from the 85% white page and white rows */
    --hbd-table-header-text:            var(--hbd-color-white);
    --hbd-table-body-bg:                var(--hbd-color-white);
    --hbd-strip-bg:                     var(--hbd-color-gray-30);    /* tabs, info strips, popup menus: light fill, dark text */
    --hbd-table-row-bg:                 var(--hbd-color-white);
    --hbd-table-row-mine-bg:            var(--hbd-color-gold-100);
    --hbd-table-row-hover-bg:           var(--hbd-color-gray-200);   /* not in mocks */
    --hbd-table-row-hover-tint-bg:      color-mix(in srgb, var(--hbd-color-teal-700) 14%, var(--hbd-color-white));  /* not in mocks: row under the cursor */
    --hbd-table-averages-bg:            var(--hbd-color-gray-700);   /* not in mocks: matches table header */
    --hbd-table-averages-text:          var(--hbd-color-white);
    --hbd-table-sorted-header-bg:       var(--hbd-color-gold-200);
    --hbd-table-sorted-header-text:     var(--hbd-color-teal-800);
    --hbd-table-sorted-cell-bg:         var(--hbd-color-gold-150);
    --hbd-stat-highlight-bg:            var(--hbd-color-gold-300);
    --hbd-stat-highlight-mine-bg:       var(--hbd-color-gold-350);
    --hbd-stat-highlight-text:          var(--hbd-color-gold-950);

    --hbd-footer-text:                  var(--hbd-color-gray-800);

    --hbd-status-positive:              var(--hbd-color-green-700);   /* win, healthy */
    --hbd-status-negative:              var(--hbd-color-red-700);     /* loss, tired */
    --hbd-status-info:                  var(--hbd-color-blue-700);    /* needs rest */

    /* Page message boxes (PageMessageControl): tone tints the box, text is the label color */
    --hbd-alert-success:                var(--hbd-color-green-700);
    --hbd-alert-success-text:           var(--hbd-color-green-700);
    --hbd-alert-error:                  var(--hbd-color-red-700);
    --hbd-alert-error-text:             var(--hbd-color-red-700);
    --hbd-alert-warning:                var(--hbd-color-gold-400);    /* time-gated: not available yet */
    --hbd-alert-warning-text:           var(--hbd-color-gold-950);
}

/* The background photo only renders from 980px up (style.css), so narrower screens use the solid surface. */
@media only screen and (max-width: 979px) {
    :root,
    :root[data-theme="light"] {
        --hbd-page-bg:                  var(--hbd-page-solid-bg);
        --hbd-card-secondary-bg:        var(--hbd-page-solid-bg);
    }
}

/* ---- 2b. Dark theme ------------------------------------------------------ */
:root[data-theme="dark"] {
    --hbd-page-solid-bg:                var(--hbd-color-navy-800);
    --hbd-header-bg:                    rgba(6, 11, 14, 0.92);    /* estimated: translucent over photo */
    --hbd-header-divider:               var(--hbd-color-navy-650);
    --hbd-header-text:                  var(--hbd-color-white);
    --hbd-header-eyebrow-text:          var(--hbd-color-slate-200);
    --hbd-header-tab-text:              var(--hbd-color-slate-500);
    --hbd-header-tab-active-text:       var(--hbd-color-slate-100);
    --hbd-header-tab-active-indicator:  var(--hbd-color-white);

    /* Nav dropdown menus (not in mocks: dark like the header they hang from) */
    --hbd-nav-menu-bg:                  var(--hbd-color-navy-850);
    --hbd-nav-menu-sub-bg:              var(--hbd-color-navy-700);   /* phone: nested pages under a section */
    --hbd-nav-menu-border:              var(--hbd-color-navy-650);
    --hbd-nav-menu-text:                var(--hbd-color-slate-300);
    --hbd-nav-menu-hover-bg:            color-mix(in srgb, var(--hbd-accent) 30%, var(--hbd-color-navy-850));
    --hbd-nav-menu-hover-text:          var(--hbd-color-white);
    --hbd-nav-menu-shadow:              rgba(0, 0, 0, 0.45);

    --hbd-page-bg:                      var(--hbd-color-navy-800);
    --hbd-card-bg:                      var(--hbd-color-navy-800);
    --hbd-card-secondary-bg:            rgba(17, 13, 10, 0.88);   /* estimated: translucent over photo */
    --hbd-page-divider:                 var(--hbd-color-navy-650);
    --hbd-card-divider:                 var(--hbd-color-navy-650);
    --hbd-card-secondary-divider:       var(--hbd-color-navy-650);

    --hbd-text-heading:                 var(--hbd-color-white);
    --hbd-text-body:                    var(--hbd-color-slate-50);
    --hbd-text-secondary:               var(--hbd-color-slate-400);
    --hbd-text-muted:                   var(--hbd-color-slate-400);
    --hbd-text-link:                    var(--hbd-color-slate-100);
    --hbd-text-accent:                  var(--hbd-color-teal-400);   /* not in mocks: legacy teal links/buttons, lightened for contrast */
    --hbd-icon:                         var(--hbd-color-slate-400);

    --hbd-control-bg:                   var(--hbd-color-navy-700);
    --hbd-control-border:               var(--hbd-color-navy-600);
    --hbd-control-field-border:         var(--hbd-color-slate-700);  /* not in mocks: control-border vanishes on table rows */
    --hbd-control-label-text:           var(--hbd-color-slate-600);
    --hbd-control-label-weight:         400;
    --hbd-control-value-text:           var(--hbd-color-white);
    --hbd-select-arrow:                 url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 10 6%27%3E%3Cpath d=%27M1 1l4 4 4-4%27 fill=%27none%27 stroke=%27%239aaac5%27 stroke-width=%271.5%27/%3E%3C/svg%3E");  /* stroke = slate-400 */

    --hbd-table-title-bg:               var(--hbd-color-navy-950);
    --hbd-table-header-bg:              var(--hbd-color-navy-850);
    --hbd-table-header-text:            var(--hbd-color-slate-400);
    --hbd-table-body-bg:                var(--hbd-color-navy-750);
    --hbd-strip-bg:                     var(--hbd-color-navy-850);
    --hbd-table-row-bg:                 var(--hbd-color-charcoal-700);
    --hbd-table-row-mine-bg:            color-mix(in srgb, var(--hbd-accent) 18%, var(--hbd-color-charcoal-700));  /* replaces mock gold-850 (read as brown) */
    --hbd-table-row-hover-bg:           var(--hbd-color-navy-600);   /* not in mocks */
    --hbd-table-row-hover-tint-bg:      color-mix(in srgb, var(--hbd-color-teal-400) 20%, var(--hbd-color-charcoal-700));  /* not in mocks: row under the cursor */
    --hbd-table-averages-bg:            var(--hbd-color-navy-850);   /* not in mocks: matches table header */
    --hbd-table-averages-text:          var(--hbd-color-slate-400);
    --hbd-table-sorted-header-bg:       color-mix(in srgb, var(--hbd-color-teal-400) 16%, var(--hbd-color-navy-850));  /* replaces mock gold-900 */
    --hbd-table-sorted-header-text:     var(--hbd-color-teal-400);
    --hbd-table-sorted-cell-bg:         color-mix(in srgb, var(--hbd-color-teal-400) 10%, var(--hbd-color-charcoal-700));  /* replaces mock gold-800 */
    --hbd-stat-highlight-bg:            var(--hbd-color-gold-750);
    --hbd-stat-highlight-mine-bg:       var(--hbd-color-gold-700);
    --hbd-stat-highlight-text:          var(--hbd-color-gold-400);

    --hbd-footer-text:                  var(--hbd-color-gray-650);

    --hbd-status-positive:              var(--hbd-color-green-400);
    --hbd-status-negative:              var(--hbd-color-red-400);
    --hbd-status-info:                  var(--hbd-color-blue-400);

    --hbd-alert-success:                var(--hbd-color-green-400);
    --hbd-alert-success-text:           var(--hbd-color-green-400);
    --hbd-alert-error:                  var(--hbd-color-red-400);
    --hbd-alert-error-text:             var(--hbd-color-red-400);
    --hbd-alert-warning:                var(--hbd-color-gold-400);
    --hbd-alert-warning-text:           var(--hbd-color-gold-400);
}

/* ---- 3. Coach pages (Coach Profile popup, Coach Negotiations) --------------
   Exact fills from Figma "Design Exploration (Coach Profile Page)" (copied as SVG):
   dark 593:6672 / 596:8162, light 680:13372 / 681:15358. Cards there sit on their own
   panel color rather than the page card color, and the rating bars, budget bar and
   impact bar keep fixed hues in both themes. */
:root {
    /* Coach Ratings impact panel: this coach (bar) vs the role/league average (dashed line); checked
       with the dataviz palette validator against both themes' tile surfaces (the league side is
       --hbd-coach-league-text, per theme below). */
    --hbd-coach-impact-coach:           #0a8f78;
    --hbd-coach-growth:                #1d8778;   /* rating gain, impact above league, potential */
    --hbd-coach-marker:                 #f7f9fc;
    --hbd-coach-budget-signed:          #224da8;
    --hbd-coach-budget-pending:         #5f89e2;
    --hbd-coach-budget-required:        #d4a017;
    --hbd-coach-pill-bg:                #ffea63;
    --hbd-coach-pill-text:              #3b3200;
    --hbd-coach-identity-bg:            #0b0d12;   /* no-team identity card: dark in both themes (Negotiations mocks) */
    --hbd-coach-identity-border:        #242424;
    --hbd-coach-identity-divider:       rgba(43, 43, 43, 0.5);
    --hbd-coach-chip-bg:                rgba(255, 255, 255, 0.04);
}
:root,
:root[data-theme="light"] {
    --hbd-coach-panel-bg:               var(--hbd-color-white);
    --hbd-coach-panel-border:           var(--hbd-color-gray-400);
    --hbd-coach-panel-divider:          rgba(197, 197, 197, 0.3);
    --hbd-coach-tile-bg:                color-mix(in srgb, #777777 10%, var(--hbd-color-white));
    --hbd-coach-tile-border:            #eae9e9;
    --hbd-coach-bar-track:              #414a5c;
    --hbd-coach-bar-from:               #9da9bb;
    --hbd-coach-impact-track:           #d8d8d8;
    --hbd-coach-from-text:              #6f7d92;
    --hbd-coach-league-text:            #0963a8;
    --hbd-coach-context-bg:             #f4f4f4;
    --hbd-coach-context-border:         #e2e2e2;
    --hbd-coach-input-bg:               #ececec;
    --hbd-coach-input-border:           #dddddd;
    --hbd-coach-budget-track:           #e4e6ea;
}
:root[data-theme="dark"] {
    --hbd-coach-panel-bg:               color-mix(in srgb, var(--hbd-color-white) 5%, #11141b);
    --hbd-coach-panel-border:           transparent;
    --hbd-coach-panel-divider:          rgba(43, 43, 43, 0.5);
    --hbd-coach-tile-bg:                rgba(255, 255, 255, 0.02);
    --hbd-coach-tile-border:            rgba(255, 255, 255, 0.06);
    --hbd-coach-bar-track:              #414a5c;
    --hbd-coach-bar-from:               #9da9bb;
    --hbd-coach-impact-track:           #2a3140;
    --hbd-coach-from-text:              #9aaac5;
    --hbd-coach-league-text:            #4b91ff;
    --hbd-coach-context-bg:             rgba(8, 11, 17, 0.24);
    --hbd-coach-context-border:         #222938;
    --hbd-coach-input-bg:               rgba(255, 255, 255, 0.15);
    --hbd-coach-input-border:           #333333;
    --hbd-coach-budget-track:           #3a4150;
}
