/* dark mode fixes for components that still used light-only palettes */

/* keeping topbar dropdown trigger buttons readable in dark mode */
html[data-theme="dark"] .topbar-notifications-menu[open] .topbar-notifications-summary,
html[data-theme="dark"] .topbar-profile-menu[open] .topbar-profile-summary {
  background-color: #223a53;
  border-color: #3f5f83;
  color: #e0eeff;
}

/* preserving icon contrast when trigger is open */
html[data-theme="dark"] .topbar-notifications-menu[open] .topbar-notifications-summary .icon-sm,
html[data-theme="dark"] .topbar-profile-menu[open] .topbar-profile-summary .icon-sm {
  filter: brightness(0) invert(1) !important;
}

/* keeping unread dot visible on darker trigger backgrounds */
html[data-theme="dark"] .topbar-notifications-menu[open] .topbar-notifications-summary .topbar-notifications-dot {
  background: #a9e7c3;
}

/* aligning generic light badges with dark surfaces */
html[data-theme="dark"] .text-bg-light {
  background-color: #213852 !important;
  color: #d4e7ff !important;
}

/* preserving border readability for light badges in dark mode */
html[data-theme="dark"] .badge.text-bg-light.border {
  border-color: #53769d !important;
}

/* improving bootstrap dark spinner contrast in dark mode */
html[data-theme="dark"] .spinner-border.text-dark {
  color: #d4e7ff !important;
}

/* tuning admin webstats panel colors for dark mode */
html[data-theme="dark"] .webstats-chart-wrap {
  border-color: #35506f;
  background: #132233;
}

/* improving svg axis and grid readability on dark background */
html[data-theme="dark"] .webstats-axis {
  stroke: #8da6c2;
}

html[data-theme="dark"] .webstats-grid {
  stroke: #304761;
}

html[data-theme="dark"] .webstats-bar:hover,
html[data-theme="dark"] .webstats-bar:focus-visible {
  stroke: #e7f2ff;
}

html[data-theme="dark"] .webstats-axis-label {
  fill: #a7bdd9;
}

html[data-theme="dark"] .webstats-legend-chip {
  color: #d7e8fd;
}

/* replacing bright table hover with dark-compatible state */
html[data-theme="dark"] .js-stat-market-panel .table tbody tr:hover > * {
  background-color: #21364f;
}

/* keeping sticky table headers consistent in dark mode */
html[data-theme="dark"] .stat-analysis-table-wrap thead th {
  background: #132233;
}

/* adapting tab pills used in home and match pages */
html[data-theme="dark"] .match-live-tabs .nav-link {
  border-color: #35506f;
  background: #162739;
  color: #cadcf6;
}

html[data-theme="dark"] .match-live-tabs .nav-link.active {
  border-color: #89b9ff;
  background: #89b9ff;
  color: #07111d;
}

/* preserving analyzer tab identity while matching dark theme */
html[data-theme="dark"] .match-live-tabs .nav-link.nav-link-analyzer {
  border-color: #3f7b63;
  background: linear-gradient(135deg, #1f4c3b 0%, #183d30 100%);
  color: #d8f2e5;
}

html[data-theme="dark"] .match-live-tabs .nav-link.nav-link-analyzer:hover {
  border-color: #4a9275;
  background: linear-gradient(135deg, #255944 0%, #1d4a3a 100%);
}

html[data-theme="dark"] .match-live-tabs .nav-link.nav-link-analyzer.active {
  border-color: #65c39e;
  background: linear-gradient(135deg, #4da783 0%, #3a8569 100%);
  color: #06150f;
}

/* making how-to wiki tabs dark-mode aware */
html[data-theme="dark"] .wiki-tab-btn {
  border-color: #35506f;
  background: #162739;
  color: #cadcf6;
}

html[data-theme="dark"] .wiki-tab-btn:hover {
  border-color: #476687;
  color: #e4efff;
}

html[data-theme="dark"] .wiki-tab-btn.active {
  border-color: #89b9ff;
  background: #89b9ff;
  color: #07111d;
}

html[data-theme="dark"] .wiki-tab-content {
  border-color: #304761;
  background: #132233;
}

/* completing match overview cards that still used light-only surfaces */
html[data-theme="dark"] .match-detail-page .insight-section {
  border-color: #304761;
  background: #132233;
}

html[data-theme="dark"] .match-detail-page .insight-section-header {
  border-bottom-color: #35506f;
  background: #1a2d43;
  color: #dbeaff;
}

html[data-theme="dark"] .match-detail-page .insight-section-toggle-icon {
  color: #9fb8d6;
}

html[data-theme="dark"] .match-detail-page .insight-section-collapse,
html[data-theme="dark"] .match-detail-page .insight-section .insight-team-panel,
html[data-theme="dark"] .match-detail-page .h2h-item,
html[data-theme="dark"] .match-detail-page .recent-item,
html[data-theme="dark"] .match-detail-page .split-mini-market,
html[data-theme="dark"] .match-detail-page .split-mini-option {
  border-color: #35506f;
  background: #162739;
  box-shadow: none;
}

html[data-theme="dark"] .match-detail-page .h2h-date,
html[data-theme="dark"] .match-detail-page .recent-competition,
html[data-theme="dark"] .match-detail-page .metric-chip {
  border-color: #46698f;
  background: #203a55;
  color: #d5e7ff;
}

html[data-theme="dark"] .match-detail-page .h2h-team,
html[data-theme="dark"] .match-detail-page .recent-matchtext,
html[data-theme="dark"] .match-detail-page .split-mini-option > strong,
html[data-theme="dark"] .match-detail-page .stat-value,
html[data-theme="dark"] .match-detail-page .match-compare-value {
  color: #e6f1ff;
}

html[data-theme="dark"] .match-detail-page .h2h-team.is-focus,
html[data-theme="dark"] .match-detail-page .match-panel-title {
  color: #f1f7ff;
}

html[data-theme="dark"] .match-detail-page .h2h-score {
  border-color: #56799f;
  background: #254361;
  color: #f0f7ff;
}

html[data-theme="dark"] .match-detail-page .recent-when,
html[data-theme="dark"] .match-detail-page .split-mini-market-title,
html[data-theme="dark"] .match-detail-page .split-mini-option > span,
html[data-theme="dark"] .match-detail-page .match-compare-head .home-name,
html[data-theme="dark"] .match-detail-page .match-compare-head .away-name,
html[data-theme="dark"] .match-detail-page .match-compare-head .metric-name,
html[data-theme="dark"] .match-detail-page .match-compare-metric {
  color: #a9bed8;
}

html[data-theme="dark"] .match-detail-page .split-mini-progress,
html[data-theme="dark"] .match-detail-page .match-compare-bar-track {
  background: #2b4259;
}

html[data-theme="dark"] .match-detail-page .match-compare-head,
html[data-theme="dark"] .match-detail-page .match-compare-row {
  border-bottom-color: #304761;
}

/* replacing bright anchor highlight with a dark-compatible variant */
html[data-theme="dark"] .howto-anchor-highlight {
  background: #27384b;
  box-shadow: inset 0 0 0 1px #567292;
}

/* improving support chat contrast after dark bubble background switch */
html[data-theme="dark"] .support-chat-row.is-support .support-chat-bubble {
  border-color: #546f8d !important;
  background: #1a2e43;
}

html[data-theme="dark"] .support-chat-name {
  color: #c7dbf4;
}

html[data-theme="dark"] .support-chat-time {
  color: #9fb5d2;
}

html[data-theme="dark"] .support-chat-body {
  color: #e1ecff;
}

/* dark surface baseline for live match cards and panels */
html[data-theme="dark"] .live-scoreboard,
html[data-theme="dark"] .live-event-item,
html[data-theme="dark"] .live-stat-row,
html[data-theme="dark"] .live-subpanel,
html[data-theme="dark"] .live-lineup-team-panel,
html[data-theme="dark"] .live-meta-item,
html[data-theme="dark"] .live-player-team-panel,
html[data-theme="dark"] .live-player-group,
html[data-theme="dark"] .live-player-mobile-card {
  border-color: #35506f;
  background: #132233;
  box-shadow: none;
}

/* keeping soft highlighted live blocks dark but distinguishable */
html[data-theme="dark"] .live-event-side-home,
html[data-theme="dark"] .live-event-side-away,
html[data-theme="dark"] .live-player-group-head,
html[data-theme="dark"] .live-primary-mobile-btn,
html[data-theme="dark"] .live-mobile-scoreline {
  border-color: #3c5a7c;
  background: #1a2d43;
}

html[data-theme="dark"] .live-primary-mobile-btn {
  color: #bdd2ec;
}

html[data-theme="dark"] .live-primary-mobile-btn.is-active {
  border-color: #6e9fd3;
  background: #22415f;
  color: #d8ecff;
}

/* refining live metadata chips and values for dark mode */
html[data-theme="dark"] .live-meta-badge {
  border-color: #4b6b8f;
  background: #243f5d;
  color: #d2e6ff;
}

html[data-theme="dark"] .live-meta-item.is-coach .live-meta-badge {
  border-color: #6f618f;
  background: #3a3254;
  color: #e3d9ff;
}

html[data-theme="dark"] .live-meta-item.is-referee .live-meta-badge {
  border-color: #647a55;
  background: #2d4230;
  color: #d8efc6;
}

html[data-theme="dark"] .live-meta-value,
html[data-theme="dark"] .live-player-mobile-name,
html[data-theme="dark"] .live-player-name-cell {
  color: #dbeaff;
}

/* keeping live textual hierarchy readable on dark backgrounds */
html[data-theme="dark"] .live-event-minute,
html[data-theme="dark"] .live-event-text,
html[data-theme="dark"] .live-player-group-title {
  color: #dbe9fc;
}

html[data-theme="dark"] .live-event-team,
html[data-theme="dark"] .live-sub-extra,
html[data-theme="dark"] .live-sub-separator,
html[data-theme="dark"] .live-player-empty,
html[data-theme="dark"] .live-player-mobile-empty {
  color: #9fb6d3;
}

/* adapting in-pitch and empty states to avoid light flashes */
html[data-theme="dark"] .live-pitch-block {
  border-color: #35506f;
  background: #182c42;
}

html[data-theme="dark"] .live-pitch-metric {
  border-color: #4f6f93;
  background: rgba(22, 37, 54, 0.92);
  color: #d7e8fc;
}

html[data-theme="dark"] .live-pitch-unavailable {
  border-color: #4a6787;
  background: #1a2e43;
}

/* updating table and group details for live players in dark mode */
html[data-theme="dark"] .live-player-group-chevron {
  border-color: #507196;
  background: #22415f;
  color: #cde3ff;
}

html[data-theme="dark"] .live-player-group[open] .live-player-group-head {
  border-bottom-color: #3c5878;
}

html[data-theme="dark"] .live-player-group-count {
  border-color: #4a6b90;
  background: #223f5d;
  color: #d2e6ff;
}

html[data-theme="dark"] .live-player-mobile-main {
  border-bottom-color: #35506f;
}

html[data-theme="dark"] .live-player-table thead th {
  color: #bdd2ec;
  border-bottom-color: #3a5676;
  background: #1a2d43;
}

html[data-theme="dark"] .live-player-table tbody td {
  border-color: #304761;
}

html[data-theme="dark"] .live-player-table tbody tr:nth-child(2n) {
  background: #162739;
}

/* mapping rating and role chips to deeper dark-friendly tones */
html[data-theme="dark"] .live-player-mobile-rating,
html[data-theme="dark"] .live-player-card-pill,
html[data-theme="dark"] .live-player-role-badge,
html[data-theme="dark"] .live-rating-chip-empty {
  border-color: #4b6b8f;
  background: #223a55;
  color: #cfe2fb;
}

html[data-theme="dark"] .live-player-mobile-rating.is-high,
html[data-theme="dark"] .live-rating-chip-high {
  border-color: #4f8d6d;
  background: #1f4637;
  color: #bef2d4;
}

html[data-theme="dark"] .live-player-mobile-rating.is-mid,
html[data-theme="dark"] .live-rating-chip-mid {
  border-color: #5379a2;
  background: #254569;
  color: #cfe6ff;
}

html[data-theme="dark"] .live-player-mobile-rating.is-low,
html[data-theme="dark"] .live-rating-chip-low {
  border-color: #9a6f54;
  background: #4d3526;
  color: #ffd9be;
}

html[data-theme="dark"] .live-player-mobile-rating.is-empty {
  border-color: #4b6b8f;
  background: #223a55;
  color: #b7cee8;
}

html[data-theme="dark"] .live-player-mobile-not-played {
  border-color: #4f6f93;
  background: #213a55;
  color: #bed3ee;
}

html[data-theme="dark"] .live-player-mobile-metric {
  border-color: #4b6b8f;
  background: #223a55;
  color: #cfe2fb;
}

html[data-theme="dark"] .live-player-mobile-metric.is-goal {
  border-color: #5b7faa;
  background: #274b73;
  color: #d7e9ff;
}

html[data-theme="dark"] .live-player-mobile-metric.is-assist {
  border-color: #4f8d6d;
  background: #1f4637;
  color: #bef2d4;
}

html[data-theme="dark"] .live-player-mobile-metric.is-yellow,
html[data-theme="dark"] .live-player-card-pill.yellow {
  border-color: #9a8440;
  background: #4c4020;
  color: #ffe8a5;
}

html[data-theme="dark"] .live-player-mobile-metric.is-red,
html[data-theme="dark"] .live-player-card-pill.red {
  border-color: #986060;
  background: #4f2929;
  color: #ffc8c8;
}

html[data-theme="dark"] .live-player-role-g {
  border-color: #5b7faa;
  background: #274b73;
  color: #d7e9ff;
}

html[data-theme="dark"] .live-player-role-d {
  border-color: #4f8d6d;
  background: #1f4637;
  color: #bef2d4;
}

html[data-theme="dark"] .live-player-role-m {
  border-color: #74639d;
  background: #3f345f;
  color: #e5d9ff;
}

html[data-theme="dark"] .live-player-role-f {
  border-color: #9a6f54;
  background: #4d3526;
  color: #ffd9be;
}

/* fixing mobile sticky pre-match tabs backdrop in dark mode */
@media (max-width: 767.98px) {
  html[data-theme="dark"] .match-detail-page .match-detail-tabs-wrap {
    border-bottom-color: rgba(62, 88, 118, 0.82);
    background: linear-gradient(
      180deg,
      rgba(13, 22, 34, 0.98) 0%,
      rgba(13, 22, 34, 0.94) 72%,
      rgba(13, 22, 34, 0) 100%
    );
  }
}
