/* tables.css — alle tabel-styling (stand, klassementen, prijzen,
   stats-vergelijk). Kleuren/maten via var(--token) uit tokens.css. */

/* General tables styling */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
  font-family: var(--font-body);
  margin: 1.25rem 0;
  font-size: 1rem;
  overflow: hidden;
  background: var(--background-box);
  border-left: 1px solid rgba(176, 170, 170, 0.3);
  border-right: 1px solid rgba(176, 170, 170, 0.3);
  border-bottom: 1px solid #ddd;
  border-radius: 8px 8px 0 0;
}

table th {
  background-color: var(--primary);
  color: var(--header-color);
  padding: 10px 0.5rem;
  text-transform: uppercase;
  border: none;
}

table td {
  padding: 8px 4px;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid rgba(176, 170, 170, 0.1);
}

table td:last-child {
  border-right: none;
}

table tr:nth-child(even) {
  background-color: rgba(151, 151, 151, 0.1);
}

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

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

/* Uniforme uitlijning voor tabel-headers/cellen die vroeger inline
   text-align/width kregen (ranking.php, riders_status.php, my_picks.php). */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-muted {
  color: #9aa1b0;
}
.text-muted-italic {
  color: #999;
  font-style: italic;
}

.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;
}

/* ------------------------------------------
    tour_gc.php — compacte GC-tabel, alleen geladen via AJAX-fetch in
    #classifica-generale-container (zie index.php). Scoped onder die
    container-id zodat dit de "grote" .standings-table op andere pagina's
    (bv. ranking.php) 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;
}
.fi {
  margin-right: 1px;
  margin-top: 3px;
  vertical-align: top;
  font-size: 0.8rem;
}

/* ------------------------------------------
    Index.php - tables
  ------------------------------------------ */
.standings-table {
  font-size: 1rem;
  text-align: left;
  width: fit-content;
}

.standings-table th {
  font-size: 0.85rem;
}

.standings-table th:first-child,
.standings-table td:first-child {
  text-align: center;
  color: var(--primary);
}

.standings-table td:nth-child(3) {
  color: #666;
  font-size: 0.9rem;
}

.standings-table td:last-child {
  color: #666;
  text-align: right;
  font-size: 0.75rem;
  padding-right: 10px;
}

.standings-table th:last-child {
  text-align: right;
  padding-right: 10px;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table td {
  vertical-align: top;
  padding: 6px 0;
}

.standings-table td.team-label {
  font-size: 0.85em;
  color: #666;
  display: block;
  margin-top: 3px;
}

/* ------------------------------------------
    Picks.php - tables
  ------------------------------------------ */
.rider_categories {
  font-size: 0.8rem;
  text-align: left;
}
.rider_categories td:first-child {
  white-space: nowrap;
  width: 1%;
  vertical-align: top;
  padding-left: 8px;
}

/* ------------------------------------------
    Ranking.php - tables
  ------------------------------------------ */
.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);
}

/* Subleague header kleuren via data-attributes */
#subleague-table[data-color="gc"] thead tr:first-child th {
  background-color: var(--secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  color: black;
}
#subleague-table[data-color="mountain"] thead tr:first-child th {
  background-color: #ffffff;
  background-image: radial-gradient(#ff0000 20%, transparent 20%),
                    radial-gradient(#ff0000 20%, transparent 20%);
  background-position: 0px 5px, 30px 35px;
  background-size: 50px 50px;
}

#subleague-table[data-color="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 {
  background-color: var(--points-jersey);
  color: white;
}

#subleague-table td:last-child {
  text-align: right !important;
}

.classification-table[id="table-gc"] thead tr:first-child th,
#table-gc thead tr:first-child th {
  background: var(--secondary);
  color: black;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
}
#table-mountain thead tr:first-child th {
  background-color: #ffffff;
  background-image: radial-gradient(#ff0000 20%, transparent 20%),
                    radial-gradient(#ff0000 20%, transparent 20%);
  background-position: 0px 5px, 30px 35px;
  background-size: 50px 50px;
  color: black;
  border-bottom: 1px solid rgba(255, 255, 255, 0);
}

#table-mountain thead tr:first-child th span {
  background-color: white;
  color: #000;
  display: inline-block;
  padding: 0 6px;
  border-radius: 3px;
}

#table-points thead tr:first-child th {
  background: var(--points-jersey);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0);
}

/* Stage Container Basis */
.update_ranking {
  padding: 15px 0;
  border-top: 1px solid #eee;
}

.stage-container {
  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;
}

/* Prijzentabellen */
.table-prizes {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 25px;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  table-layout: fixed;
}

.table-prizes thead {
  background-color: #333;
  color: #ffffff;
}

.table-prizes th:first-child,
.table-prizes td:first-child {
  text-align: left;
  padding-left: 15px;
  white-space: nowrap;
}

.table-prizes th.amount,
.table-prizes td.amount {
  width: 100px;
  text-align: right;
  padding-right: 15px;
  font-weight: bold;
  white-space: nowrap;
}

.table-prizes tbody tr:hover {
  background-color: #f7f7f7;
}

@media (max-width: 600px) {
  .table-prizes th.amount,
  .table-prizes td.amount {
    width: 80px;
  }
}

/* ------------------------------------------
    Stats.php - tables
  ------------------------------------------ */
.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-picks td:first-child,
.hun-picks th:first-child {
  max-width: 18px;
  min-width: 18px;
}

.table-vergelijk {
  width: 100% !important;
  table-layout: fixed;
  border-collapse: collapse;
  padding: 4px;
}

.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: 40px;
  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) {
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

@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;
  }
}

/* =====================================================
    . RESPONSIVE
   ===================================================== */

@media (max-width: 499px) {
  .rotate-icon {
    display: inline-block;
  }

  .stage-container {
    justify-content: center;
    margin-left: 0;
    text-align: left;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
  }

  .label-text {
    width: 100%;
  }

  .stage-info {
    width: 100%;
    justify-content: start;
    white-space: normal;
  }

  .table-stats td,
  .table-stats th {
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .table-vergelijk {
    font-size: 0.65rem;
  }

  .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;
  }

  .btn-toggle {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #eee;
    opacity: 0.6;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
  }

  .btn-toggle i.fa-shirt .icon-gc {
    background: transparent !important;
    padding: 4px;
    transition: all 0.3s ease;
  }
  .btn-toggle i.fa-shirt {
    background: transparent !important;
    padding: 4px;
    transition: all 0.3s ease;
  }

  .btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    opacity: 1;
  }

  .btn-toggle.active[onclick*="col-gc"] {
    background: var(--primary);
    border-color: var(--primary);
  }

  .btn-toggle.active[onclick*="col-points"] {
    background: var(--points-jersey);
    border-color: var(--points-jersey);
  }

  .btn-toggle.active[onclick*="col-mountain"] {
    background: var(--mountain-jersey);
    border-color: var(--mountain-jersey);
  }

  .btn-toggle.active i.fa-shirt {
    background: var(--white) !important;
  }

  .btn-toggle.active i.fa-shirt.icon-gc {
    background: black !important;
  }

  .hun-vergelijk {
    font-size: 0.6rem;
  }
}

/* .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"/"Topscore":
   zelfde opzet als .spellen-historie-table, plus kolom "Prijs" (links). */
.spellen-prestaties-table th,
.spellen-prestaties-table td {
  text-align: left;
  padding-left: 0.5rem;
}
.spellen-prestaties-table td:first-child {
  font-weight: 500;
  color: var(--text-color);
}
@media (max-width: 499px) {
  .spellen-prestaties-table {
    font-size: 0.9rem;
  }
}
