/**
 * Chalksta data tables — standings / stats tables styled by styleBootstrapTable()
 * (generalconfig.js sets dark-theme inline colors; these rules restore light mode + polish both themes.)
 *
 * Add class `chalksta-data-table` to any <table> that receives styleBootstrapTable + tablesorter.
 * Load after chalksta-app-shell.css (and after page CSS). Scope: body.chalksta-app.
 */

/* -------------------------------------------------------------------------- */
/* Light theme — readable text, token zebra, accent header                    */
/* -------------------------------------------------------------------------- */

body.chalksta-app:not(.dark-theme) .table-responsive:has(table.chalksta-data-table) {
  color: var(--idx-fg) !important;
}

/* Fallback if :has() unsupported — team / player standings wrappers */
body.chalksta-app:not(.dark-theme).chalksta-page-teamstandings #statstable,
body.chalksta-app:not(.dark-theme).chalksta-page-teamstandings #statstable-tourny-div,
body.chalksta-app:not(.dark-theme).chalksta-page-playerstats #statstable,
body.chalksta-app:not(.dark-theme).chalksta-page-playerstats #statstable-tourny-div,
body.chalksta-app:not(.dark-theme).chalksta-page-playerlookup #resptable {
  color: var(--idx-fg) !important;
}

body.chalksta-app:not(.dark-theme).chalksta-page-teamstats #playerstable,
body.chalksta-app:not(.dark-theme).chalksta-page-teamstats #matchtable,
body.chalksta-app:not(.dark-theme).chalksta-page-playerlifetime #playerstablebydiv_new,
body.chalksta-app:not(.dark-theme).chalksta-page-playerdivscores #gamescorestable_new {
  color: var(--idx-fg) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table {
  color: var(--idx-fg) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table thead th {
  color: #fff !important;
  background: linear-gradient(105deg, var(--espn-red) 0%, var(--espn-red-dark) 100%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.65rem !important;
  vertical-align: middle;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody td,
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody th {
  color: var(--idx-fg) !important;
  border-bottom: 1px solid var(--idx-border) !important;
  padding: 0.45rem 0.65rem !important;
  line-height: 1.35 !important;
  background-color: transparent !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody a {
  color: var(--espn-red) !important;
  font-weight: 600;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody a:hover {
  color: var(--espn-red-dark) !important;
}

/* Favorite stars — accent red (same token light + dark); weight matches legacy “bold star” */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody .fa-star,
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody .fa-star-o {
  color: var(--espn-red) !important;
  font-weight: 600 !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody .fa-star-o {
  opacity: 0.85;
}

/* Zebra: tablesorter widget and pages that set .odd / .even on tr (e.g. player lookup) */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.odd > td {
  background-color: var(--idx-surface) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.even > td {
  background-color: var(--idx-surface-alt) !important;
}

/* Clear JS tr:hover (rgba white) so td backgrounds show */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr:hover {
  background-color: transparent !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr:hover > td {
  background-color: rgba(227, 24, 55, 0.09) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.row-selected > td {
  background-color: rgba(227, 24, 55, 0.16) !important;
}

/* Must beat zebra (tr.odd / tr.even > td) — same specificity as stripe rows but .sorted-column adds a class */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.odd > td.sorted-column,
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.even > td.sorted-column {
  background-color: rgba(227, 24, 55, 0.14) !important;
  background-image: none !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr:hover > td.sorted-column {
  background-color: rgba(227, 24, 55, 0.2) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table thead th.sorted-column {
  background: linear-gradient(105deg, #c4102e 0%, #9e0d24 100%) !important;
  color: #fff !important;
}

/* Favorite row — light: soft tint (avoid competing with billboard-red name links) */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightfavoriterow > td {
  outline: none !important;
  border-color: var(--idx-border) !important;
  background-color: rgba(227, 24, 55, 0.12) !important;
  box-shadow: none !important;
}

/* Logged-in “my row” — light: gentle mint */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightrow > td {
  outline: none !important;
  border-color: var(--idx-border) !important;
  background-color: rgba(34, 170, 95, 0.14) !important;
  box-shadow: none !important;
}

/*
 * Light: on highlighted rows, default tbody `a { color: var(--espn-red) }` reads much louder than the row fill.
 * Mute name links only; .fa-star / .fa-star-o keep their own rules above.
 */
body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightfavoriterow a.playerstats-name-link {
  color: #7a2a32 !important;
  font-weight: 600;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightfavoriterow a.playerstats-name-link:hover {
  color: #5c1f26 !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightrow a.playerstats-name-link {
  color: #1a5c38 !important;
  font-weight: 600;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightrow a.playerstats-name-link:hover {
  color: #144a2d !important;
}

/* -------------------------------------------------------------------------- */
/* Dark theme — align header to tokens; keep body readable on dark stripes    */
/* -------------------------------------------------------------------------- */

body.dark-theme.chalksta-app .table-responsive:has(table.chalksta-data-table) {
  color: var(--idx-fg) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table thead th {
  color: #fff !important;
  background: linear-gradient(105deg, var(--espn-red) 0%, #7a0d1f 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 0.5rem 0.65rem !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody td,
body.dark-theme.chalksta-app table.chalksta-data-table tbody th {
  color: var(--idx-fg) !important;
  border-bottom: 1px solid var(--idx-border) !important;
  padding: 0.45rem 0.65rem !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody a {
  color: #7ec8ff !important;
  font-weight: 600;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody a:hover {
  color: #fff !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody .fa-star,
body.dark-theme.chalksta-app table.chalksta-data-table tbody .fa-star-o {
  color: var(--espn-red) !important;
  font-weight: 600 !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody .fa-star-o {
  opacity: 0.82;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.odd > td {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.even > td {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr:hover {
  background-color: transparent !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr:hover > td {
  background-color: rgba(227, 24, 55, 0.22) !important;
}

/*
 * Dark: clicked / tablesorter row — cool cyan (readable on charcoal; not confused with favorite gold).
 */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.row-selected > td {
  background-color: rgba(60, 160, 255, 0.38) !important;
  box-shadow: inset 0 0 0 1px rgba(140, 215, 255, 0.75) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.row-selected:hover > td {
  background-color: rgba(80, 175, 255, 0.44) !important;
}

/*
 * Dark: favorite row — warm amber/gold (distinct from cyan selection); flat fill only.
 */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightfavoriterow > td {
  outline: none !important;
  background-color: rgba(255, 176, 0, 0.24) !important;
  box-shadow: none !important;
  border-color: var(--idx-border) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightfavoriterow:hover > td {
  background-color: rgba(255, 190, 30, 0.3) !important;
}

/* Both at once: gold → cyan gradient, no inset borders */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightfavoriterow.row-selected > td {
  background: linear-gradient(90deg, rgba(255, 176, 0, 0.32) 0%, rgba(60, 160, 255, 0.34) 100%) !important;
  box-shadow: none !important;
  border-color: var(--idx-border) !important;
}

/* Logged-as-you row (playerstats) — mint tint, flat */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightrow > td {
  outline: none !important;
  background-color: rgba(72, 220, 160, 0.2) !important;
  box-shadow: none !important;
  border-color: var(--idx-border) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.odd > td.sorted-column,
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.even > td.sorted-column {
  background-color: rgba(227, 24, 55, 0.25) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table tbody tr:hover > td.sorted-column {
  background-color: rgba(227, 24, 55, 0.32) !important;
}

body.dark-theme.chalksta-app table.chalksta-data-table thead th.sorted-column {
  background: linear-gradient(105deg, #ff3b54 0%, var(--espn-red-dark) 100%) !important;
}
