/* =========================================================================
   components.css — reusable widgets: pills, chips, generic tables, game
   widgets (score, team logo), standings dots, ad-slots, json-modal viewer
   and the shared game-hero header used on game/team/tournament pages.

   This file plus tokens.css + base.css + header.css replaces the bulk of
   the legacy style.css megaline.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   Generic tables
   --------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 8px;
  text-align: left;
  border: 1px solid #ddd;
}

th {
  background-color: #f4f4f4;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
}

.table-container table {
  table-layout: fixed;
}

.table-container table th {
  padding: 0;
}

.table-container table td {
  border: 0;
}

.table-container table thead {
  font-weight: 700;
  text-shadow: 1px 0 0 currentColor;
}

.table-container thead th {
  background-color: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--color-primary);
}

.table-container tbody tr {
  border-bottom: 1px solid var(--color-soft);
}

.table-container tbody td {
  padding: 5px 5px;
  display: table-cell;
}

/* Common column widths used across schedule / standings tables */
th.gt-game-day      { width: 100px; }
th.gt-game-competition { width: 120px; }
th.gt-game-rival    { width: 190px; }
th.gt-game-result   { width: 110px; }
th.gt-game-partido  { width: 230px; }
th.gt-simple-number { width: 45px; padding: 0; text-align: center; }
th.gt-double-number { width: 50px; text-align: center; }
th.gt-triple-number { width: 65px; }
.gt-simple-mini     { width: 30px; }

tr.table-data-row td:not(:first-child) {
  text-align: center;
  vertical-align: middle;
}

.table-data-no-hover {
  background-color: var(--surface) !important;
}

.table-data-no-border {
  border-bottom: 0 !important;
}

/* Players table (shared by team/coach/etc.) */
.players-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.players-table thead th {
  background-color: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--color-primary);
  padding: 0.75rem 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #222;
}

.players-table tbody tr {
  border-bottom: 1px solid var(--color-soft);
  transition: background-color 0.2s ease;
}

.players-table tbody tr:hover {
  background-color: var(--color-soft-translucent);
}

.players-table tbody tr:last-child {
  border-bottom: 0;
}

.players-table td {
  padding: 1rem;
  vertical-align: middle;
  font-size: 0.95rem;
}

.players-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
}

@media (max-width: 768px) {
  .players-table td,
  .players-table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
  .players-table th {
    font-size: 0.75rem;
  }
  .team-players {
    overflow-x: auto;
  }
}

.team-players {
  padding: 1rem 0;
}

/* ---------------------------------------------------------------------------
   Pills, chips, meta tags
   --------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill.tournament {
  background: var(--color-soft-translucent);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pill.subtle {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #475569;
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 700;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-success-soft);
  color: #15803d;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--color-success-border);
}

.result-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  text-transform: uppercase;
}

.result-chip.win {
  background: rgba(52, 211, 153, 0.16);
  color: #15803d;
  border-color: rgba(52, 211, 153, 0.3);
}

.result-chip.loss {
  background: var(--color-danger-soft);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.28);
}

.result-chip.neutral {
  background: #f8fafc;
  color: var(--ink-strong);
  border-color: var(--line);
}

/* ---------------------------------------------------------------------------
   Game / team widgets shared by tables and lists
   --------------------------------------------------------------------------- */
.game-widget {
  display: flow-root;
}

.gw-teams {
  float: left;
  display: block;
  width: 260px;
}

.gw-date,
.gw-competition {
  font-size: 12px;
}

.gw-competition {
  float: left;
  margin-right: 10px;
}

img.gw-team-logo {
  width: 24px;
  float: left;
}

img.gw-teamLogo {
  height: 24px;
  display: flow-root;
  float: left;
  margin-right: 5px;
  margin-left: 0;
}

.gw-team {
  float: left;
  padding: 0;
  margin: 0;
  display: flow-root;
  width: 80px;
}

.gw-team.gw-team-local {
  text-align: right;
}

.gw-team-local img.gw-teamLogo {
  float: right;
  margin-left: 5px;
  margin-right: 0;
}

span.team-name {
  line-height: 30px;
  width: auto;
  display: inline-table;
  text-shadow: 1px 0 0 currentColor;
}

.team-name.team-name-short {
  display: none;
}

@media screen and (max-width: 700px) {
  .team-name.team-name-full {
    display: none;
  }
  .team-name.team-name-short {
    display: inline-block;
  }
}

.game-score-widget {
  display: flow-root;
  margin: 0 5px;
  float: left;
}

.game-score-widget div {
  padding: 3px 4px;
  border: 1px solid #000;
  min-width: 38px;
  width: auto;
  text-align: center;
  font-weight: 700;
  background-color: var(--surface);
  color: #000;
  text-shadow: 1px 0 0 currentColor;
  font-size: 20px;
  float: left;
}

.game-score-team.game-score-winner {
  background: linear-gradient(to right, var(--color-primary), var(--color-soft));
  color: #000;
  border-color: #000;
}

.game-score-widget.game-score-widget-notstarted {
  width: 80px;
  line-height: 30px;
  text-shadow: 1px 0 0 currentColor;
}

.game-widget .game-score-widget.game-score-widget-notstarted {
  width: 30px;
  text-align: center;
}

/* Match grid (left-side widgets) */
.grids-widget {
  max-width: 230px;
  display: block;
  width: 100%;
}

.grids-widget .gw-team {
  width: 70px;
  font-size: 15px;
}

.grids-widget img.gw-teamLogo {
  width: 23px;
  height: 23px;
}

.grids-widget .game-score-team {
  font-size: 17px;
  width: 33px;
}

.grids-widget .gw-match-date {
  width: 50px;
  margin-bottom: 3px;
  margin-top: 10px;
  float: left;
  margin-right: 0;
}

.grids-widget .gw-teams {
  padding-top: 10px;
  float: right;
  display: block;
  width: 180px;
}

.grids-widget .gw-time {
  float: left;
  padding-left: 5px;
  padding-bottom: 2px;
}

.grids-widget .game-widget {
  border-bottom: 1px solid var(--color-soft);
  padding-bottom: 3px;
}

@media screen and (max-width: 700px) {
  .grids-widget {
    width: 100%;
    max-width: 100% !important;
  }
  .games-list {
    width: 100%;
    max-width: 100%;
  }
  .game-widget {
    display: inline-flex;
    width: 100%;
  }
  .gw-match-date {
    width: 40px !important;
    display: inline-grid;
  }
  .grids-widget .gw-time {
    float: left;
    padding-left: 5px;
    padding-bottom: 2px;
  }
  .gw-teams {
    float: left;
    display: block;
    max-width: 300px;
    margin-top: 9px;
    width: 100%;
  }
}

.gw-time {
  width: 50px;
  font-size: 12px;
  margin-top: 2px;
}

.gw-match-date {
  width: 50px;
  margin-right: 10px;
  display: flow-root;
  float: left;
  flex: 1;
  text-align: left;
}

.gw-match-extra {
  width: 50px;
  height: 30px;
  flex: 1;
  text-align: right;
}

.gw-button {
  display: flow-root;
  background-color: var(--color-primary);
  color: #fff;
  text-align: center;
}

.gw-button a,
.gw-button a:hover {
  color: var(--color-soft);
  padding: 7px 10px;
  text-align: center;
  display: block;
  text-decoration: none;
  font-size: 14px;
}

.gw-button a:hover {
  text-shadow: 1px 0 0 currentColor;
}

.grid-widget-main-links {
  display: flex;
  align-items: center;
  background-color: var(--color-primary);
  padding: 4px 4px;
  font-size: 13px;
  color: #fff;
}

.grid-widget-main-links a {
  color: var(--color-soft);
  text-decoration: none;
  margin: 0 4px;
}

.grid-widget-main-links a:hover {
  text-shadow: 1px 0 0 currentColor;
}

.grid-widget-main-links .right {
  margin-left: auto;
}

/* ---------------------------------------------------------------------------
   Standings: form dots & color legend
   --------------------------------------------------------------------------- */
.game-point {
  display: inline-flex;
  width: 23px;
  height: 23px;
  margin: 6px 2px 0;
  border-radius: 30px;
}

.game-point.game-square-color-red {
  background-color: var(--color-red-standings);
  border: 1px solid var(--color-danger);
}

.game-point.game-square-color-green {
  background: var(--color-green-standings);
  border: 1px solid var(--color-success);
}

.game-point.game-square-color-orange {
  background: var(--color-orange-standings);
  border: 1px solid #ffa46166;
}

.game-square-color-next {
  background: var(--surface);
  border: 1px solid var(--color-primary);
}

.last-5-games {
  padding-top: 0;
  display: inline-flex;
  align-content: center;
  align-items: center;
}

.last-5-games .gw-teamLogo {
  width: 15px;
  height: 15px;
  padding-top: 4px;
  padding-left: 4px;
}

/* Promotion / relegation legend chips */
.ps-color {
  background-color: var(--surface);
  padding: 6px 6px;
  margin-left: 1px;
  width: 13px;
  font-size: 13px;
  display: block;
  border-radius: 3px;
  text-align: left;
}

.ps-color-champions       { background-color: #00cdff9c; }
.ps-color-europa-league   { background-color: #ff9a009c; }
.ps-color-conference-quali{ background-color: #00ff449c; }
.ps-color-playoff-descenso{ background-color: #ffa2a29c; }
.ps-color-descenso        { background-color: #ff00009c; }
.ps-color.ps-color-playoff{ background-color: #00d7ff9c; }
.ps-color.ps-color-playoff-quali { background-color: #00d7ff4d; }
.ps-color.ps-color-promotion     { background-color: #ceff007d; }

/* ---------------------------------------------------------------------------
   Game-center standings table
   --------------------------------------------------------------------------- */
.gc-standings {
  width: 640px;
  float: left;
  margin-right: 10px;
}

.gc-standings .table-container td {
  padding: 0;
  height: 30px;
}

.gc-standings thead th {
  text-align: left;
}

.gc-standings .gt-game-partido {
  padding-left: 8px;
}

td.gt-standing-team {
  text-shadow: 1px 0 0 currentColor;
}

td.gt-standing-team img {
  display: flow-root;
  width: 24px;
  height: 24px;
  margin-top: -5px;
  padding-bottom: 6px;
}

td.gt-standing-team a {
  color: #000;
  text-decoration: none;
  text-shadow: none;
}

td.gt-standing-team a:hover {
  color: var(--color-primary);
  text-shadow: 1px 0 0 currentColor;
}

.gc-team-roster a {
  color: #000;
}

/* Round selector strip */
.gc-round {
  background-color: var(--color-primary);
  color: var(--color-soft);
}

.gc-round-info {
  display: flex;
  padding: 10px 5px;
}

.gc-round-selector.gc-round-selector-left {
  float: left;
  display: flow-root;
}

.gc-round-selector.gc-current-round {
  float: left;
  display: flow;
  margin: 0 auto;
  width: 300px;
  text-align: center;
}

.gc-round-selector.gc-round-selector-right {
  float: right;
  display: flow-root;
}

.gc-round-selector a {
  color: var(--color-soft);
  text-decoration: none;
}

.gc-round-selector a:hover {
  text-shadow: 1px 0 0 currentColor;
}

.game-center-main-content .game-widget {
  margin: 0 auto;
  float: none;
  padding: 5px 0;
  width: 100%;
  border-bottom: 1px solid var(--color-soft);
  display: flex;
  justify-content: space-between;
}

.game-center-main-content .gw-teams {
  float: none;
  width: 450px;
  display: contents;
  align-items: center;
  justify-content: space-around;
  margin: 0 auto;
  flex: 1;
  text-align: center;
}

.game-center-aside {
  display: flow-root;
  margin-left: 10px;
}

.gc-tournament-logo img {
  width: 100px;
}

.gc-tournament-header {
  display: flow-root;
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------------------
   Game hero (shared header used on team / tournament / game pages)
   --------------------------------------------------------------------------- */
.game-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
  color: var(--ink-strong);
}

.game-hero-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.game-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.game-hero-datetime {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #475569;
  font-weight: 700;
}

.game-hero-main {
  position: relative;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.hero-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.hero-team-logo {
  width: 108px;
  height: 108px;
  border-radius: 20px;
  padding: 12px;
  background: linear-gradient(145deg, #f9fafb, #e5e7eb);
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 12px 28px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-team-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-team-tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  font-weight: 700;
}

.hero-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.hero-score-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.hero-score-number {
  font-size: 50px;
  font-weight: 900;
  color: var(--ink-strong);
  min-width: 70px;
  text-align: center;
  line-height: 1;
}

.hero-score-number.win  { color: #10b981; }
.hero-score-number.loss { color: var(--color-danger); }

.hero-score-separator {
  font-size: 16px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  font-weight: 800;
}

.hero-score-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-graph-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
}

@media (max-width: 1100px) {
  .game-hero-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-score {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .game-hero {
    padding: 20px;
  }
  .game-hero-main {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-team-name {
    max-width: 100%;
  }
  .hero-score,
  .hero-score-display {
    width: 100%;
  }
  .hero-score-display {
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------------
   Ad slots (filler backgrounds)
   --------------------------------------------------------------------------- */
.ad-slot {
  background-image: repeating-conic-gradient(#ffffff 0% 25%, #f6f6f6 0% 50%);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  background-color: #f6f6f6;
}

.ad-slot.ad-slot-leaderboard {
  display: block;
  width: 728px;
  height: 90px;
  margin: 50px auto;
}

.ad-slot.ad-slot-wide-skyscraper {
  width: 160px;
  height: 600px;
}

.ad-slot.ad-slot-wide-robadoble {
  width: 300px;
  height: 600px;
}

/* ---------------------------------------------------------------------------
   JSON modal viewer (admin tool reachable from header dropdown)
   --------------------------------------------------------------------------- */
.json-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.json-modal.active {
  display: flex;
}

.json-modal-content {
  background: var(--surface);
  border-radius: 12px;
  max-width: 90%;
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.json-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.json-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.json-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.json-modal-close:hover {
  color: #333;
}

.json-modal-body {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.json-modal-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.json-modal-btn {
  padding: 6px 12px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s;
}

.json-modal-btn:hover  { background: var(--color-primary-strong); }
.json-modal-btn:active { background: #d6431a; }

.json-modal-loading {
  text-align: center;
  padding: 2rem;
  color: #999;
}

.json-modal-error {
  color: #d32f2f;
  padding: 1.5rem;
  background: #ffebee;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}

.json-tree {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
  padding: 12px;
  border-radius: 4px;
}

.json-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  color: var(--ink-muted);
  font-weight: bold;
  font-size: 12px;
  vertical-align: top;
  min-width: 14px;
  text-align: center;
}

.json-toggle:hover { color: #333; }

.json-object,
.json-array {
  display: inline-block;
  vertical-align: top;
}

.json-content {
  display: block;
  border-left: 2px solid #e0e0e0;
  padding-left: 6px;
}

.json-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 20px;
}

.json-key      { color: #881391; font-weight: bold; }
.json-string   { color: #1976d2; }
.json-number   { color: #d4534f; }
.json-boolean  { color: #d4534f; font-weight: bold; }
.json-null     { color: #999;    font-weight: bold; }
.json-bracket  { color: #333;    font-weight: bold; }
.json-index    { color: var(--ink-muted); font-weight: bold; }
