/* tables.css — gedeeld sjabloon: standaard tabel-opmaak.
   1. Basisregels (table/th/td) gelden voor elke tabel, ongeacht klasse.
   2. Per-tabel hooks: kleine, losse aanpassingen per tabel-klasse
      (.standings-table, .club-table, ...). Nieuwe tabel-variant? Voeg
      hier een eigen blokje toe naar dit voorbeeld. */

/* Basisregels — voor elke <table> */
/* Kaart-achtige tabellen: alleen boven afgerond, geen kolom-borders, dunne
   rij-scheiding en een dikke afsluitende rand onder de laatste rij. */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
  font-family: var(--font-body);
  margin: 1.25rem 0;
  font-size: 1rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th,
td {
  padding: 0.25rem;
}

.table-divider {
  height: 1rem;
  background-color: var(--white);
  border: none;
}

table th {
  background-color: var(--primary);
  color: var(--white);
  padding: 6px 0.5rem;
  border: none;
  height: 1.4rem;
}

table td {
  padding: 3px;
  border: none;
  border-bottom: 1px solid rgba(176, 170, 170, 0.35);
  background-color: var(--white);
  transition: background-color var(--transition-base);
  line-height: 1.4;
}
table tr:nth-child(even) td {
  background-color: rgba(151, 151, 151, 0.14);
}
table tr:hover td {
  background-color: var(--primary-light);
}
table tr:last-child td {
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--primary); /* afsluitende rand i.p.v. radius onderaan */
}

/* Eerste kolom in primary color; specifieke tabellen kunnen dit overschrijven
   (zie .club-table hieronder). */
table td:first-child {
  color: var(--primary);
  font-weight: 600;
}

.highlight-row {
  background-color: rgba(0, 143, 0, 0.5) !important;
}

/* Per-tabel hooks — elke tabel heeft precies 1 class; elk blok hieronder
   is zelfstandig, geen gedeelde basis-classes. */

/* .standings-table — poule-stand (ranking.php, total + subleague):
   kolom 1 = rangnummer (gecentreerd), kolom 2 = naam (links uitgelijnd),
   kolom 4 = punten (links uitgelijnd, dik), rest = statistieken. */
.standings-table th:first-child,
.standings-table td:first-child {
  text-align: center;
  padding-left: 0.5rem;
}
.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
  text-align: left;
  padding-left: 0.5rem;
}
.standings-table th:nth-child(4),
.standings-table td:nth-child(4) {
  text-align: left;
  padding-left: 0.5rem;
  font-weight: 600;
}
.standings-table td:not(:nth-child(2)) {
  font-size: 0.9rem;
  width: 1rem;
}
.standings-table td:last-child {
  width: fit-content;
  white-space: nowrap;
}
@media (max-width: 499px) {
  .standings-table th,
  .standings-table td {
    padding: 0.25rem 0.2rem;
  }
  .standings-table th:first-child,
  .standings-table td:first-child {
  }
}

/* .eredivisie-standings-table — de Eredivisie-competitiestand
   (php/standings_table.php, index.php en picks.php). Zelfde opbouw als
   .standings-table hierboven, met extra verkleining op mobiel. */
.eredivisie-standings-table th:first-child,
.eredivisie-standings-table td:first-child {
  text-align: center;
  padding-left: 0.5rem;
}
.eredivisie-standings-table th:nth-child(2),
.eredivisie-standings-table td:nth-child(2) {
  text-align: left;
  padding-left: 0.5rem;
}
.eredivisie-standings-table th:nth-child(4),
.eredivisie-standings-table td:nth-child(4) {
  text-align: left;
  padding-left: 0.5rem;
  font-weight: 600;
}
.eredivisie-standings-table td:not(:nth-child(2)) {
  font-size: 0.9rem;
  width: 1rem;
}
@media (max-width: 499px) {
  .eredivisie-standings-table th,
  .eredivisie-standings-table td {
    padding: 0.25rem 0.2rem;
  }
  .eredivisie-standings-table th:first-child,
  .eredivisie-standings-table td:first-child {
    padding: 0rem;
  }
  .eredivisie-standings-table td:not(:nth-child(2)) {
    font-size: 0.75rem;
  }
}

/* .picks-own-table — Hun Picks (stats.php) / Mijn Picks (my_picks.php) /
   ranking's picks-modal: kolom 1 = rondenummer, kolom 2 = wedstrijd,
   laatste 3 kolommen = joker/score/pts (vaste breedte, gecentreerd op
   desktop; op mobiel wisselbaar via .active-col, zie components.css). */
.picks-own-table th:first-child,
.picks-own-table td:first-child {
  text-align: left;
  padding-left: 0.5rem;
}
.picks-own-table td:first-child {
  font-weight: 600;
}
.picks-own-table th:nth-child(2),
.picks-own-table td:nth-child(2) {
  text-align: left;
  padding-left: 0.5rem;
}
.picks-own-table th:nth-last-child(-n + 3),
.picks-own-table td:nth-last-child(-n + 3) {
  width: 1rem;
  text-align: center;
}
@media (max-width: 768px) {
  .picks-own-table .col-joker,
  .picks-own-table .col-score,
  .picks-own-table .col-pts {
    display: none;
  }
  .picks-own-table .active-col {
    display: table-cell !important;
    width: 3rem;
    text-align: center;
  }
}
@media (max-width: 499px) {
  .picks-own-table .logo {
    width: auto;
    height: 1.1rem;
    margin-right: -2px;
    margin-left: -2px;
  }
}

/* .picks-ronde-table — Picks per Ronde (stats.php): zelfde opbouw als
   .picks-own-table, maar kolom 1 is hier een naam (normaal lettergewicht). */
.picks-ronde-table th:first-child,
.picks-ronde-table td:first-child {
  text-align: left;
  padding-left: 0.5rem;
}
.picks-ronde-table td:first-child {
  font-weight: 400;
  color: var(--text-color);
}
.picks-ronde-table th:nth-child(2),
.picks-ronde-table td:nth-child(2) {
  text-align: left;
  padding-left: 0.5rem;
}
.picks-ronde-table th:nth-last-child(-n + 3),
.picks-ronde-table td:nth-last-child(-n + 3) {
  width: 1rem;
  text-align: center;
}
@media (max-width: 768px) {
  .picks-ronde-table .col-joker,
  .picks-ronde-table .col-score,
  .picks-ronde-table .col-pts {
    display: none;
  }
  .picks-ronde-table .active-col {
    display: table-cell !important;
    width: 3rem;
    text-align: center;
  }
}
@media (max-width: 499px) {
  .picks-ronde-table .logo {
    width: auto;
    height: 1rem;
    margin-right: -1px;
    margin-left: -1px;
  }

  .picks-ronde-table td:nth-child(2) {
    font-size: 0.9rem;
  }
}

/* .club-points-table — Hun/Mijn Gekozen Clubs (stats.php/my_picks.php):
   kolom 1 = club (logo + naam, links), laatste 2 kolommen gecentreerd. */
.club-points-table th:first-child,
.club-points-table td:first-child {
  text-align: left;
  padding-left: 0.5rem;
}
.club-points-table td:first-child {
  font-weight: 400;
  color: var(--text-color);
}
.club-points-table th:nth-last-child(-n + 2),
.club-points-table td:nth-last-child(-n + 2) {
  width: 1rem;
  text-align: center;
}
@media (max-width: 499px) {
  .club-points-table .logo {
    width: auto;
    height: 1.1rem;
    margin-right: -2px;
    margin-left: -2px;
  }
}

/* .club-fans-table — Club Fans (stats.php): kolom 1 = naam (links),
   kolom 2 = aantal (vaste breedte, gecentreerd). */
.club-fans-table th:first-child,
.club-fans-table td:first-child {
  text-align: left;
  padding-left: 0.5rem;
}
.club-fans-table td:first-child {
  font-weight: 400;
  color: var(--text-color);
}
.club-fans-table th:last-child,
.club-fans-table td:last-child {
  text-align: center;
  width: 1rem;
}

/* .table-prizes — Prijzenpot (ranking.php): Eindstand + Periodestand
   delen dit blok (2 kolommen: label + bedrag). */
.table-prizes {
  table-layout: fixed;
  box-shadow: var(--shadow-sm);
}
.table-prizes thead {
  background-color: #333;
  color: #ffffff;
}
.table-prizes th:first-child,
.table-prizes td:first-child {
  text-align: left;
  padding-left: 0.5rem;
  white-space: nowrap;
}
.table-prizes td:first-child {
  font-weight: 400;
  color: var(--text-color);
}
.table-prizes .amount {
  text-align: right;
  padding-right: 0.5rem;
  font-weight: bold;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .table-prizes .amount {
    width: 80px;
  }
}

/* .spellen-historie-table — mijn_spellen.php, "Deelname geschiedenis":
   kolom 1 = jaar (links, normaal gewicht). */
.spellen-historie-table th,
.spellen-historie-table td {
  text-align: left;
  padding-left: 0.5rem;
}
.spellen-historie-table td:first-child {
  font-weight: 500;
  color: var(--text-color);
}

@media (max-width: 499px) {
  .spellen-historie-table {
    font-size: 0.9rem;
  }
}
/* .spellen-prestaties-table — mijn_spellen.php, "Prestaties": zelfde opzet
   als .spellen-historie-table, plus kolom "Prijs" (links). */
.spellen-prestaties-table {
  text-align: left;
  padding-left: 0.5rem;
  text-align: left;
}
.spellen-prestaties-table td:first-child {
  font-weight: 500;
  color: var(--text-color);
}
@media (max-width: 499px) {
  .spellen-prestaties-table {
    font-size: 0.9rem;
  }
}

/* =====================================================
    . CYCLING: klassementen (ranking.php), stats-tabellen,
    prijzentabel (index.php-widget) — geport uit tour/css/tables.css.
   ===================================================== */

.fi {
  margin-right: 1px;
  margin-top: 3px;
  vertical-align: top;
  font-size: 0.8rem;
}

.rider_categories {
  font-size: 0.9rem;
  text-align: left;
}
.rider_categories td:first-child {
  white-space: nowrap;
  width: 1%;
  vertical-align: top;
  padding-left: 8px;
  font-weight: 500;
}

.classification-table {
  display: none;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 20px;
}
.classification-table.active {
  display: table;
}
.classification-table td:first-child,
.classification-table th:first-child {
  width: 20px;
  min-width: 20px;
}
.classification-table td:last-child,
.classification-table th:last-child {
  width: 20px;
  max-width: fit-content;
  padding-right: 20px;
}
.classification-table td:last-child {
  text-align: right;
}
.classification-table td:nth-child(2),
.classification-table th:nth-child(2) {
  text-align: left;
}
.classification-table thead tr:first-child th {
  border-bottom: 2px solid var(--white);
}

/* Klassement-kleuren: rood = leiderstrui (--primary, toevallig al gelijk
   aan het Vuelta-rood), blauw = bergtrui (--mountain-jersey — bij de
   Vuelta blauwe bollen i.p.v. het rood van de Tour de France), groen =
   puntentrui (--points-jersey, gelijk bij Tour en Vuelta). */
#subleague-table[data-color="gc"] thead tr:first-child th,
#table-gc thead tr:first-child th {
  background-color: var(--primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  color: var(--white);
}
#subleague-table[data-color="mountain"] thead tr:first-child th,
#table-mountain thead tr:first-child th {
  background-color: #ffffff;
  background-image:
    radial-gradient(#0057b8 20%, transparent 20%),
    radial-gradient(#0057b8 20%, transparent 20%);
  background-position:
    0px 5px,
    30px 35px;
  background-size: 50px 50px;
  color: black;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
}
#subleague-table[data-color="mountain"] thead tr:first-child th span,
#table-mountain thead tr:first-child th span {
  background-color: white;
  color: #000;
  display: inline-block;
  padding: 0 6px;
  border-radius: 3px;
}
#subleague-table[data-color="points"] thead tr:first-child th,
#table-points thead tr:first-child th {
  background-color: var(--points-jersey);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0);
}
#subleague-table td:last-child {
  text-align: right !important;
}

.update_ranking {
  padding: 15px 0;
  border-top: 1px solid #eee;
}
.stage-container {
  padding: 10px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 10px;
  font-family: var(--font-body);
}
.label-text {
  font-weight: normal;
  margin-left: 10px;
  color: var(--text-color);
}
.update-time {
  font-size: 0.85rem;
  text-align: left;
  margin-left: 1.1rem;
}
.stage-info {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.update-time i {
  font-size: 0.85em;
  color: #666;
}
.no-data-msg {
  text-align: center;
  padding: 10px;
}

.hun-picks td:nth-child(2),
.hun-picks th:nth-child(2),
.hun-stage td:nth-child(-n + 2),
.hun-stage th:nth-child(-n + 2),
.hun-teams td:nth-child(-n + 2),
.hun-teams th:nth-child(-n + 2),
.hun-vergelijk td:nth-child(n + 2):nth-child(-n + 3),
.hun-vergelijk th:nth-child(n + 2):nth-child(-n + 3) {
  text-align: left;
}

.hun-stage td:nth-child(-n + 2) {
  font-weight: 400;
  color: var(--text-color);
}

.hun-picks td:first-child,
.hun-picks th:first-child {
  max-width: 18px;
  min-width: 18px;
}

.hun-teams td:first-child {
  color: var(--text-color);
  font-weight: 400;
}

.table-vergelijk {
  width: 100% !important;
  table-layout: fixed;
  border-collapse: collapse;
  padding: 5px;
}
/* col-totaal hergebruikt de generieke .desktop-klasse (display:flex) om de
   hele kolom te verbergen op mobiel, maar staat direct op de <th>/<td> zelf
   i.p.v. op een inner span zoals bij de naam-kolommen. Die flex-cell breekt
   de normale table-cell hoogteberekening, waardoor de rand onderaan de rij
   niet gelijk loopt met de andere kolommen. */
.table-vergelijk th.desktop,
.table-vergelijk td.desktop {
  display: table-cell;
}
.table-vergelijk th:nth-child(1),
.table-vergelijk td:nth-child(1) {
  width: 20px;
  text-align: center;
}
.table-vergelijk th:nth-child(4),
.table-vergelijk td:nth-child(4) {
  width: 70px;
  text-align: right;
  white-space: nowrap;
}
.table-vergelijk th:nth-child(5),
.table-vergelijk td:nth-child(5) {
  width: 70px;
  text-align: right;
  white-space: nowrap;
}
.table-vergelijk th:nth-child(2),
.table-vergelijk td:nth-child(2),
.table-vergelijk th:nth-child(3),
.table-vergelijk td:nth-child(3) {
  /* calc() wordt genegeerd door table-layout:fixed voor kolombreedtes;
     vast percentage (op 700px breedte afgestemd) i.p.v. auto, anders
     vult de rij de resterende ruimte niet en komt "Totaal" niet
     helemaal rechts uit. */
  width: 32.86%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .desktop {
    display: none !important;
  }
  .mobile {
    display: inline !important;
  }
  .table-vergelijk {
    font-size: 12px;
  }
  .table-vergelijk th:nth-child(4),
  .table-vergelijk td:nth-child(4) {
    width: 40px;
    text-align: right;
    white-space: nowrap;
  }
}

.col-diff-negative {
  color: #2ecc71;
}
.col-diff-positive {
  color: #e74c3c;
}
.col-diff-neutral {
  color: #333;
}

.col-w-10 {
  width: 10%;
}
.col-w-15 {
  width: 15%;
}
.col-w-30 {
  width: 30%;
}
.col-w-45 {
  width: 45%;
}

.empty-state-msg {
  text-align: center;
  padding: 20px;
}
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-muted {
  color: #9aa1b0;
}
.text-muted-italic {
  color: #999;
  font-style: italic;
}

/* Mobiele klassement-kolom-toggle (ranking.php) — bewust gescoped onder
   .table-controls i.p.v. een kale .btn-toggle-regel, zodat dit niet
   botst met vuelta's eigen .picks-table-controls .btn-toggle elders. */
@media (max-width: 499px) {
  .col-gc,
  .col-mountain,
  .col-points {
    display: none !important;
  }
  .col-gc.active-col,
  .col-mountain.active-col,
  .col-points.active-col {
    display: table-cell !important;
  }
  .table-controls {
    display: flex;
    gap: 5px;
    margin-bottom: -10px;
    justify-content: flex-end;
  }
  .table-controls .btn-toggle {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #eee;
    opacity: 0.6;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
  }
  .table-controls .btn-toggle i.fa-shirt {
    background: transparent !important;
    padding: 4px;
    transition: all 0.3s ease;
  }
  .table-controls .btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    opacity: 1;
  }
  .table-controls .btn-toggle.active[onclick*="col-gc"] {
    background: var(--primary);
    border-color: var(--primary);
  }
  .table-controls .btn-toggle.active[onclick*="col-points"] {
    background: var(--points-jersey);
    border-color: var(--points-jersey);
  }
  .table-controls .btn-toggle.active[onclick*="col-mountain"] {
    background: var(--mountain-jersey);
    border-color: var(--mountain-jersey);
  }
  .table-controls .btn-toggle.active i.fa-shirt {
    background: var(--white) !important;
  }
  .table-controls .btn-toggle.active i.fa-shirt.icon-gc {
    background: white !important;
  }
}

/* #classifica-generale-container — compacte GC-tabel op index.php/picks.php,
   AJAX-geladen uit vuelta_gc.php. Scoped onder de container-id zodat dit
   vuelta's eigen .standings-table elders niet beïnvloedt. */
#classifica-generale-container .standings-table {
  width: 100%;
  border-collapse: collapse;
}
#classifica-generale-container .standings-table td {
  vertical-align: top;
  padding: 6px 5px;
  border-bottom: 1px solid #eee;
}
#classifica-generale-container .team-label {
  font-size: 0.85em;
  color: #666;
  display: block;
}
#classifica-generale-container .extra-rows {
  display: none;
}
#classifica-generale-container .btn-more {
  margin-top: 15px;
  padding: 10px 20px;
}
