/**
 * 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 — soft inset glow + row tint (no 2px ring per cell); side halo on first/last td only */
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.06) !important;
  box-shadow: inset 0 0 16px rgba(227, 24, 55, 0.28) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightfavoriterow > td:first-child {
  box-shadow:
    inset 0 0 16px rgba(227, 24, 55, 0.28),
    -5px 0 18px -3px rgba(227, 24, 55, 0.38) !important;
}

body.chalksta-app:not(.dark-theme) table.chalksta-data-table tbody tr.playerhiglightfavoriterow > td:last-child {
  box-shadow:
    inset 0 0 16px rgba(227, 24, 55, 0.28),
    5px 0 18px -3px rgba(227, 24, 55, 0.38) !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). No dark rule before → sat on legacy sitestyles.
 */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightfavoriterow > td {
  outline: none !important;
  background-color: rgba(255, 176, 0, 0.34) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 120, 0.85) !important;
  border-color: rgba(255, 190, 80, 0.4) !important;
}

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

/* Both at once: gold bias on leading edge, cyan on trailing — still obvious */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightfavoriterow.row-selected > td {
  background: linear-gradient(90deg, rgba(255, 176, 0, 0.42) 0%, rgba(60, 160, 255, 0.36) 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.7), inset 0 -2px 0 0 rgba(100, 190, 255, 0.85) !important;
}

/* Logged-as-you row (playerstats) — mint, separate from favorite + selection */
body.dark-theme.chalksta-app table.chalksta-data-table tbody tr.playerhiglightrow > td {
  outline: none !important;
  background-color: rgba(72, 220, 160, 0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(120, 235, 190, 0.65) !important;
  border-color: rgba(90, 210, 150, 0.35) !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;
}
