/* =============== */
/*  GLOBAL THEME   */
/* =============== */
:root {
  color-scheme: dark;
}

body {
  margin: 0;
  background: #0b0e14;
  color: #e8eefc;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}



.card {
  background: #10131a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  margin: 10px;
  overflow: hidden;
  /* contain any inner overflow */
}

.body-container {
  max-width: 96vw;
  margin: 0 auto;
  padding: 14px 0 32px;
}

/* Header */
.card.teams-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.tab-team-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
}

.card.teams-header {
  padding: 10px 12px; /* reduced padding from default card padding */
  margin: 10px 10px 8px 10px; /* tighten margins */
}

.team-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px; /* reduced from 14px 16px */
  border-radius: 0;
  background: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.team-pill.left {
  box-shadow: inset 0 0 0 1px rgba(70, 130, 180, 0.35);
}

.team-pill.right {
  box-shadow: inset 0 0 0 1px rgba(255, 0, 0, 0.35);
}

.team-name {
  font-size: 14px; /* reduced from 18px */
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-name.left {
  color: #63a0d4;
}

.team-name.right {
  color: #ff7a7a;
}

.team-points {
  font-size: 15px; /* reduced from 16px */
  font-weight: 700;
  opacity: 0.95;
  letter-spacing: 0.5px;
}

/* ===================== */
/*      TABLES (FIX)     */
/* ===================== */
.table-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  /* allow shrinking in grid */
  gap: 18px;
  width: 100%;
  align-items: start;
}

.table-wrapper {
  max-width: 100%;
  min-width: 0;
  /* critical for grid children */
  overflow: auto;
  /* scroll instead of spilling */
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  color: #e8eefc;
  font-size: 12px;
  background: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  table-layout: fixed;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 4px !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 12px !important;
}

.data-table thead th {
  position: static !important;
  top: auto !important;
  z-index: 1 !important;
  background: #121722 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

/* === Name column: give it proper space + prevent line wrapping === */
.data-table th:first-child,
.data-table td:first-child {
  text-align: left !important;
  width: 22% !important;
  min-width: 110px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 13px !important;
}

.data-table th:not(:first-child),
.data-table td:not(:first-child) {
  width: 6.5% !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.table-compact thead th,
.table-compact td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-out {
  color: #ff6b6b;
}

.player-dtd {
  color: #ffd166;
}

a {
  color: #63a0d4;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .table-container {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    max-width: 200px;
  }
}

/* Graph sections */
.graph-section {
  padding: 16px 18px;
}

.graph-section h2,
.graph-section p {
  text-align: center;
  margin: 0 0 12px;
}

.chart-area {
  display: flex;
  justify-content: center;
  width: 100%;
}

#chart {
  background: #0b0e14;
  padding: 12px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  max-width: 800px;
  width: 100%;
}

/* Grid for categories page */
.grid-container.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
  align-items: stretch;
}

.chart-card {
  background: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 !important;
  padding: 14px 16px 8px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: visible;
}

.chart-title {
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted, #8b949e);
  margin-bottom: 10px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 210px;
}

.chart-card svg {
  display: block;
  width: 100% !important;
  height: 210px;
  overflow: visible;
}

.chart-card.points-chart-card {
  min-height: 520px !important;
}

.chart-card.points-chart-card svg,
.chart-card svg.points-svg {
  height: 480px !important;
}

@media (max-width: 1200px) {
  .grid-container.chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .grid-container.chart-grid {
    grid-template-columns: 1fr;
  }
}

/* Axes - Matching player_stats.html D3 style */
.axis text {
  font-size: 11px;
  fill: #8b949e;
  font-family: system-ui, -apple-system, sans-serif;
}

.axis path,
.axis line {
  stroke: #2a3040;
  stroke-width: 1;
}

svg .tick text {
  fill: #8b949e;
  font-size: 11px;
  font-family: system-ui, -apple-system, sans-serif;
}

svg .domain,
svg .tick line {
  stroke: #2a3040;
}

.grid line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-dasharray: 2,2;
}

/* Category Legend - Matching Segmented Toggle / Pill Style */
#category-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: center;
  margin: 12px 0 20px;
  padding: 8px 16px;
  background: #10131a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0 !important;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c9d1d9;
  font-size: 12px;
  font-weight: 500;
  font-family: system-ui, -apple-system, sans-serif;
}

.legend .swatch {
  width: 16px;
  height: 3px;
  border-radius: 1px;
  display: inline-block;
}

.swatch.solid.blue {
  background: #38bdf8;
}

.swatch.solid.red {
  background: #f87171;
}

.swatch.dashed.blue {
  background: repeating-linear-gradient(to right, #38bdf8 0 3px, transparent 3px 6px);
}

.swatch.dashed.red {
  background: repeating-linear-gradient(to right, #f87171 0 3px, transparent 3px 6px);
}

/* Player-stats style legend (shared by both compare pages) */
.legend {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-top: 12px;
  opacity: .95;
  font-size: 16px;
  flex-wrap: wrap;
}

.legend .swatch {
  width: 26px;
  height: 4px;
  border-radius: 0;
  display: inline-block;
}

/* Solid swatches */
.legend .swatch.blue-line {
  background: steelblue;
}

.legend .swatch.red-line {
  background: red;
}

/* Dashed swatches to represent "Predicted" */
.legend .swatch.blue-dashed {
  background-image: linear-gradient(to right,
      steelblue 0 40%, transparent 40% 60%, steelblue 60% 100%);
  background-size: 10px 4px;
  background-repeat: repeat-x;
  background-color: transparent;
}

.legend .swatch.red-dashed {
  background-image: linear-gradient(to right,
      red 0 40%, transparent 40% 60%, red 60% 100%);
  background-size: 10px 4px;
  background-repeat: repeat-x;
  background-color: transparent;
}

/* ====== ODDS (v2) — single centered bar per category ====== */
.odds-card-v2 {
  padding: 16px 18px;
}

.odds-list-v2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0px;
}

/* Each row stacks: centered label -> full-width bar */
.odds-item-v2 {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0px;
}

.odds-label-v2 {
  text-align: center;
  font-weight: 700;
  letter-spacing: .2px;
  opacity: .95;
}

/* Full-width bar — midpoint is exactly the visual center */
.odds-bar-v2 {
  position: relative;
  height: 26px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Both sides visible (baseline softness) */
.odds-left-v2,
.odds-right-v2 {
  position: absolute;
  top: 0;
  bottom: 0;
}

.odds-left-v2 {
  left: 0;
  background: rgba(70, 130, 180, 0.30);
}

.odds-right-v2 {
  right: 0;
  background: rgba(255, 72, 72, 0.30);
}

.odds-middle-v2 {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(175, 175, 175, 0.4);
  pointer-events: none;
}


/* Winner more intense; loser a bit more faded */
.odds-bar-v2.winner-left .odds-left-v2 {
  background: rgba(70, 130, 180, 0.66);
}

.odds-bar-v2.winner-left .odds-right-v2 {
  background: rgba(255, 72, 72, 0.22);
}

.odds-bar-v2.winner-right .odds-right-v2 {
  background: rgba(255, 72, 72, 0.66);
}

.odds-bar-v2.winner-right .odds-left-v2 {
  background: rgba(70, 130, 180, 0.22);
}

/* Tie: both sides use their "winning" intensity */
.odds-bar-v2.is-tie .odds-left-v2 {
  background: rgba(70, 130, 180, 0.66);
}

.odds-bar-v2.is-tie .odds-right-v2 {
  background: rgba(255, 72, 72, 0.66);
}

/* Midpoint marker at exact 50% */
.odds-mid-v2 {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 10;
}

/* Percent chips overlay the bar; don't shift layout */
.odds-tag-v2 {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  color: #e8eefc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.odds-tag-v2.left {
  left: 8px;
}

.odds-tag-v2.right {
  right: 8px;
}

.odds-tag-v2.strong {
  opacity: 0.98;
  font-weight: 600;
}

.odds-tag-v2.muted {
  opacity: 0.62;
}

/* Fix for compact summary tables */
.data-table.table-compact {
  table-layout: auto;
  margin-top: 10px;
  /* Space between player table and summary table */
}

.data-table.table-compact th,
.data-table.table-compact td {
  text-align: center;
}

/* User request: Right-align the last two headers/columns */
.data-table.table-compact th:nth-child(2),
.data-table.table-compact th:nth-child(3),
.data-table.table-compact td:nth-child(2),
.data-table.table-compact td:nth-child(3) {
  text-align: right;
}

/* Fix games view to match stats view layout consistency */
.games-table {
  table-layout: fixed !important;
  width: 100% !important;
}

.games-table th,
.games-table td {
  padding: 6px 4px !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 12px !important;
}

.games-table thead th {
  position: static !important;
  top: auto !important;
  z-index: 1 !important;
  background: #121722 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

.games-table th:first-child,
.games-table td:first-child {
  width: 22% !important;
  min-width: 110px !important;
  text-align: left !important;
  font-size: 13px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.games-table th:not(:first-child),
.games-table td:not(:first-child) {
  width: 11.1% !important;
  text-align: center !important;
  font-size: 12px !important;
  white-space: nowrap !important;
}

.game-cell.no-game {
  background: transparent !important;
  color: transparent !important;
}
.game-cell.dnp {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
}

.games-table td:empty::after {
  content: "\00a0";
}
/* Force normal font weight for names to override any phantom bolding */
.games-table td:first-child,
.games-table td:first-child a {
  font-weight: normal !important;
}

/* Modern Segmented Toggle Selectors (Matching Trade Search & Analyzer) */
.segmented-toggle-group {
  display: inline-flex;
  background: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px;
  gap: 4px;
  user-select: none;
  border-radius: 0;
  align-items: center;
}

.segmented-toggle-group .view-mode-btn,
.segmented-toggle-group .main-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #9fb2cf;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 0;
  margin: 0;
  text-transform: uppercase;
}

.segmented-toggle-group .view-mode-btn:hover,
.segmented-toggle-group .main-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.segmented-toggle-group .view-mode-btn.active,
.segmented-toggle-group .main-tab-btn.active {
  background: rgba(70, 130, 180, 0.28) !important;
  border: 1px solid var(--accent, #4da6ff) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 8px rgba(77, 166, 255, 0.2) !important;
}
