/**
 * Matches (matchscores) — chalksta-app companion
 * body.chalksta-app.chalksta-page-matchscores
 *
 * Past / today tables use classes from newscores_functions.js + popmatchscores.js
 * (--idx-* tokens, ESPN red accents). No hardcoded white-on-white.
 */

.chalksta-page-matchscores .chalksta-ts-main {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.chalksta-page-matchscores .chalksta-ts-toolbar--crossnav {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 0.75rem 0;
  margin-bottom: 0.5rem;
}

/* Tabs */
.chalksta-page-matchscores .nav-tabs {
  border-bottom-color: var(--idx-border);
}

.chalksta-page-matchscores .nav-tabs .nav-link {
  color: var(--idx-muted);
  border: 1px solid transparent;
}

.chalksta-page-matchscores .nav-tabs .nav-link:hover {
  color: var(--idx-fg);
  border-color: var(--idx-border);
}

.chalksta-page-matchscores .nav-tabs .nav-link.active {
  color: var(--idx-fg);
  background: var(--idx-surface);
  border-color: var(--idx-border) var(--idx-border) var(--idx-surface);
}

.chalksta-page-matchscores .tab-content {
  background: var(--idx-surface);
  border: 1px solid var(--idx-border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.75rem;
}

.chalksta-page-matchscores .chalksta-ms-today-hint {
  color: var(--idx-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Table wrappers — sit on tab surface (no fake dark slab on light theme) */
.chalksta-page-matchscores .chalksta-ms-past-wrap,
.chalksta-page-matchscores .chalksta-ms-today-wrap {
  border-radius: 8px;
  border: 1px solid var(--idx-border);
  padding: 0;
  overflow: hidden;
  background: var(--idx-surface-alt);
}

/* Cap width on large screens: table stays content-sized, centered (no full-bleed stretch) */
.chalksta-page-matchscores .chalksta-ms-past-wrap .table-responsive,
.chalksta-page-matchscores .chalksta-ms-today-wrap .table-responsive {
  filter: none;
  width: 100%;
  max-width: min(42rem, 100%);
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1200px) {
  .chalksta-page-matchscores .chalksta-ms-past-wrap .table-responsive,
  .chalksta-page-matchscores .chalksta-ms-today-wrap .table-responsive {
    max-width: min(40rem, 100%);
  }
}

/* -------------------------------------------------------------------------- */
/* Past matches — #matchtable.chalksta-ms-table                               */
/* -------------------------------------------------------------------------- */

.chalksta-page-matchscores #matchtable.chalksta-ms-table {
  color: var(--idx-fg);
  background: transparent;
  margin-bottom: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-collapse: separate;
  border-spacing: 0;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-table td {
  vertical-align: middle;
  border-color: var(--idx-border);
}

/* Column header row (first tbody row) — ESPN red band like data tables */
.chalksta-page-matchscores #matchtable.chalksta-ms-head-row td.chalksta-ms-head {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.45rem;
  border-bottom: none;
  background: linear-gradient(105deg, var(--espn-red) 0%, var(--espn-red-dark) 100%);
  color: rgba(255, 255, 255, 0.92) !important;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-head-row td.chalksta-ms-head-major {
  font-size: 0.8125rem;
  color: #fff !important;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-head-row td.chalksta-ms-head-minor {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.88) !important;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-head-row td.chalksta-ms-split-right {
  border-right: 2px solid rgba(255, 255, 255, 0.35) !important;
}

/* Date section headers — distinct from column header row; left-aligned + ESPN accent */
.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row {
  text-align: left;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.65rem 0.85rem 0.65rem 0.95rem !important;
  color: var(--idx-fg) !important;
  border-top: 1px solid var(--idx-border);
  border-bottom: 1px solid var(--idx-border);
  background: linear-gradient(90deg, rgba(227, 24, 55, 0.12) 0%, var(--idx-surface) 52%);
  box-shadow: inset 4px 0 0 0 var(--espn-red);
}

body.dark-theme.chalksta-app .chalksta-page-matchscores #matchtable td.chalksta-ms-date-row {
  background: linear-gradient(90deg, rgba(227, 24, 55, 0.2) 0%, var(--idx-surface) 55%);
}

/* Stronger top edge when a new date section follows a match row */
.chalksta-page-matchscores #matchtable tr.chalksta-ms-stat-row + tr td.chalksta-ms-date-row {
  border-top-width: 2px;
  border-top-color: var(--idx-border);
}

@media (max-width: 575px) {
  .chalksta-page-matchscores #matchtable td.chalksta-ms-date-row {
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.65rem 0.55rem 0.8rem !important;
  }
}

/* Stat rows */
.chalksta-page-matchscores #matchtable tr.chalksta-ms-stat-row td {
  padding: 0.45rem 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-bottom: 1px solid var(--idx-border) !important;
}

.chalksta-page-matchscores #matchtable tr.chalksta-ms-stripe-a td {
  background: var(--idx-surface) !important;
}

.chalksta-page-matchscores #matchtable tr.chalksta-ms-stripe-b td {
  background: var(--idx-surface-alt) !important;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-td-num {
  text-align: center;
  font-weight: 600;
  color: var(--idx-fg) !important;
  font-variant-numeric: tabular-nums;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-td-name {
  color: var(--idx-fg);
}

.chalksta-page-matchscores #matchtable .chalksta-ms-a-team {
  color: var(--espn-red) !important;
  font-weight: 600;
  text-decoration: none;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-a-team:hover {
  color: var(--espn-red-dark) !important;
  text-decoration: underline;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-split-right {
  border-right: 2px solid var(--idx-border) !important;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-td-official {
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid var(--idx-border) !important;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-a-official {
  color: var(--idx-muted) !important;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-a-official:hover {
  color: var(--espn-red) !important;
}

/* -------------------------------------------------------------------------- */
/* Today's matches — .chalksta-ms-today-table                                 */
/* -------------------------------------------------------------------------- */

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table {
  color: var(--idx-fg);
  background: transparent;
  margin-bottom: 0;
  font-size: 0.8125rem;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table thead th {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.45rem;
  vertical-align: middle;
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(105deg, var(--espn-red) 0%, var(--espn-red-dark) 100%) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table thead th.chalksta-ms-th-major {
  font-size: 0.8125rem;
  color: #fff !important;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table thead th.chalksta-ms-th-minor {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.88) !important;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table tbody td {
  padding: 0.45rem 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-color: var(--idx-border);
  vertical-align: middle;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table tbody tr:nth-child(odd) td {
  background: var(--idx-surface) !important;
}

.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table tbody tr:nth-child(even) td {
  background: var(--idx-surface-alt) !important;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-today-mid {
  color: var(--idx-muted) !important;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-today-teamname {
  color: var(--idx-fg) !important;
  font-weight: 600;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-share {
  color: var(--espn-red) !important;
  cursor: pointer;
  opacity: 1;
  font-size: 0.8125rem;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-share:hover {
  color: var(--espn-red-dark) !important;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-share .chalksta-ms-share-label {
  font-size: 0.75rem;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-status-link {
  color: var(--espn-red) !important;
  text-decoration: none;
  font-weight: 500;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-status-link:hover {
  color: var(--espn-red-dark) !important;
  text-decoration: underline;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-status-idle {
  color: var(--idx-muted) !important;
}

.chalksta-page-matchscores #today_matches_table td.chalksta-ms-split-today {
  border-right: 2px solid var(--idx-border) !important;
}

/* Dark theme: same link treatment as chalksta-data-tables (playerstats / teamstandings body links) */
body.dark-theme.chalksta-app.chalksta-page-matchscores #matchtable .chalksta-ms-a-team,
body.dark-theme.chalksta-app.chalksta-page-matchscores #today_matches_table .chalksta-ms-share,
body.dark-theme.chalksta-app.chalksta-page-matchscores #today_matches_table .chalksta-ms-status-link {
  color: #7ec8ff !important;
}

body.dark-theme.chalksta-app.chalksta-page-matchscores #matchtable .chalksta-ms-a-team:hover,
body.dark-theme.chalksta-app.chalksta-page-matchscores #today_matches_table .chalksta-ms-share:hover,
body.dark-theme.chalksta-app.chalksta-page-matchscores #today_matches_table .chalksta-ms-status-link:hover {
  color: #fff !important;
}

body.dark-theme.chalksta-app.chalksta-page-matchscores #matchtable .chalksta-ms-a-official:hover {
  color: #7ec8ff !important;
}

