/**
 * 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;
  display: inline-flex;
  align-items: center;
}

.chalksta-page-matchscores .chalksta-ms-live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.45rem;
  border-radius: 50%;
  background: var(--espn-red);
  box-shadow: 0 0 0 0 rgba(227, 24, 55, 0.65);
  animation: chalksta-ms-live-pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
  flex: 0 0 auto;
}

.chalksta-page-matchscores .chalksta-ms-live-dot[hidden] {
  display: none !important;
}

@keyframes chalksta-ms-live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(227, 24, 55, 0.55);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(227, 24, 55, 0);
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chalksta-page-matchscores .chalksta-ms-live-dot {
    animation: none;
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.28);
  }
}

.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-x: auto;
  overflow-y: hidden;
  background: var(--idx-surface-alt);
}

.chalksta-page-matchscores .chalksta-ms-past-wrap .table-responsive,
.chalksta-page-matchscores .chalksta-ms-today-wrap .table-responsive {
  filter: none;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-table,
.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table {
  width: max-content !important;
  max-width: none !important;
  margin-left: auto;
  margin-right: auto;
  table-layout: auto;
}

.chalksta-page-matchscores #matchtable.chalksta-ms-table td,
.chalksta-page-matchscores #matchtable.chalksta-ms-table th,
.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table td,
.chalksta-page-matchscores #today_matches_table.chalksta-ms-today-table th {
  white-space: nowrap !important;
}

.chalksta-page-matchscores #today_matches_table .chalksta-ms-teamwrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* 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%);
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row .chalksta-ms-when-badge {
  display: inline-block;
  margin-right: 0.55rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-family: "Oswald", sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row .chalksta-ms-date-label {
  vertical-align: middle;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--today {
  background: linear-gradient(90deg, rgba(227, 24, 55, 0.22) 0%, var(--idx-surface) 58%);
  box-shadow: inset 4px 0 0 0 var(--espn-red);
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--today .chalksta-ms-when-badge--today {
  background: var(--espn-red);
  color: #fff;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--future {
  background: linear-gradient(90deg, rgba(126, 200, 255, 0.14) 0%, var(--idx-surface) 58%);
  box-shadow: inset 4px 0 0 0 #5aa7d6;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--future .chalksta-ms-when-badge--upcoming {
  background: transparent;
  color: #3d7ea8;
  border: 1px solid #5aa7d6;
  font-style: italic;
}

.chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--future .chalksta-ms-date-label {
  color: var(--idx-muted);
  font-style: italic;
}

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

body.dark-theme.chalksta-app .chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--future {
  background: linear-gradient(90deg, rgba(126, 200, 255, 0.16) 0%, var(--idx-surface) 58%);
  box-shadow: inset 4px 0 0 0 #7ec8ff;
}

body.dark-theme.chalksta-app .chalksta-page-matchscores #matchtable td.chalksta-ms-date-row--future .chalksta-ms-when-badge--upcoming {
  color: #7ec8ff;
  border-color: #7ec8ff;
}

/* 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-scores {
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid var(--idx-border) !important;
  min-width: 6.5rem;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-scores-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.15rem 0.25rem;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-team-label {
  font-weight: 600;
  color: var(--idx-fg);
}

.chalksta-page-matchscores #matchtable .chalksta-ms-official-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}

.chalksta-page-matchscores #matchtable .chalksta-ms-official-badge--posted {
  color: #0d5c2e;
  background: rgba(46, 204, 113, 0.18);
  border: 1px solid rgba(46, 204, 113, 0.45);
}

.chalksta-page-matchscores #matchtable .chalksta-ms-official-badge--pending {
  color: var(--idx-muted);
  background: var(--idx-surface-alt);
  border: 1px solid var(--idx-border);
}

.chalksta-page-matchscores #matchtable .chalksta-ms-a-view-scores {
  color: var(--espn-red) !important;
  font-weight: 700;
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

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

/* Sheet picker modal (injected by newscores_functions.js) */
.chalksta-ms-sheet-picker-modal .modal-title {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-matchup {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--idx-fg, #1d1d1f);
  line-height: 1.35;
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-list .chalksta-ms-picker-item {
  padding: 0.55rem 0.75rem;
  border-color: var(--idx-border, #d2d2d7);
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-item-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--idx-fg, #1d1d1f);
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-item-desc {
  font-size: 0.75rem;
  color: var(--idx-muted, #6e6e73);
  margin-top: 0.15rem;
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-item--primary {
  border-left: 3px solid var(--espn-red, #e31837);
}

.chalksta-ms-sheet-picker-modal .chalksta-ms-picker-item--primary .chalksta-ms-picker-item-label {
  color: var(--espn-red, #e31837);
}

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

body.dark-theme.chalksta-app.chalksta-page-matchscores #matchtable .chalksta-ms-a-view-scores:hover,
body.dark-theme.chalksta-app.chalksta-page-matchscores #matchtable .chalksta-ms-a-view-scores:focus {
  color: #fff !important;
}

body.dark-theme .chalksta-ms-sheet-picker-modal .modal-content {
  background: #1a1a1a;
  color: #fff;
  border-color: #333;
}

body.dark-theme .chalksta-ms-sheet-picker-modal .chalksta-ms-picker-matchup,
body.dark-theme .chalksta-ms-sheet-picker-modal .chalksta-ms-picker-item-label {
  color: #fff;
}

body.dark-theme .chalksta-ms-sheet-picker-modal .list-group-item {
  background: #262626;
  color: #fff;
}

body.dark-theme .chalksta-ms-sheet-picker-modal .list-group-item:hover {
  background: #333;
}

/* -------------------------------------------------------------------------- */
/* 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-official-badge--posted {
  color: #9be7b8;
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.35);
}

