/* ============================================================
   smgr · css/pages/adelantamientos.css — ADELANTAMIENTOS históricos
   Tabla ancha sticky (thead + columna Jugador) con los "sorpassos"
   próximos en los rankings acumulados de carrera. Ordenable por
   cabecera (rincon.js). Tokens en css/tokens.css; componentes base en
   css/rincon.css.
   ============================================================ */

/* ---------- Cabecera de página ---------- */
.adel-head { margin-top: var(--sp-5); }
.adel-head h1 {
  font-family: var(--score); font-size: 26px; font-weight: 700;
  letter-spacing: .01em; color: var(--ink); margin-top: 2px;
}
.adel-head .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.adel-head .sub strong { color: var(--ink); font-weight: 600; }
.adel-head .sub strong.down { color: var(--down); }

/* ---------- Stat-cards: 3 columnas ---------- */
.stat-cards.adel-stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 870px) {
  .stat-cards.adel-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stat-cards.adel-stats { grid-template-columns: 1fr; }
}
/* El protagonista de las cards 2 y 3 es un nombre, no un número */
.adel-stats .stat-card__big .player-cell {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; white-space: nowrap;
}
.adel-stats .stat-card__big .player-cell a { color: var(--accent-deep); }
.adel-stats .stat-card__big .player-cell a:hover { text-decoration: underline; }

/* ---------- Barra de filtros ---------- */
.adel-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--sp-4); padding: var(--sp-4); margin-top: var(--sp-4);
}
.adel-filters .fgroup { display: flex; flex-direction: column; gap: 6px; }
.adel-filters .flabel {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.adel-filters select,
.adel-filters input[type="number"] {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background-color: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 6px 12px;
}
.adel-filters select {
  padding-right: 32px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235B6577' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.adel-filters .adel-max { width: 96px; }
.adel-filters select:focus-visible,
.adel-filters input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.adel-filters .btn { padding: 7px 16px; font-size: 13px; }
.adel-filters__reset {
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  align-self: center; white-space: nowrap;
}
.adel-filters__reset:hover { color: var(--down); }

/* Segmented de enlaces (mismo look que broker/avanzadas/rachas) */
.adel-filters .seg {
  display: inline-flex; background: var(--ground);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px;
}
.adel-filters .seg a {
  font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: var(--r-pill); color: var(--muted); white-space: nowrap;
}
.adel-filters .seg a:hover { color: var(--ink); }
.adel-filters .seg a.is-active { background: var(--ink); color: #fff; }
.adel-filters .seg a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Toggle "en vivo" */
.adel-live__toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
  padding: 6px 4px;
}
.adel-live__toggle input { accent-color: var(--down); cursor: pointer; }
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--down); animation: adel-pulse 1.4s infinite;
}
@keyframes adel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Tabla: thead sticky + columna Jugador sticky ---------- */
.adel-section { margin-top: var(--sp-5); }
.adel-section .section-head h2 {
  font-family: var(--score); font-size: 19px; font-weight: 700; color: var(--ink);
}
.adel-wrap {
  position: relative; overflow: auto; max-height: 78vh;
  border-radius: var(--r-card);
}
.adel-table { min-width: 940px; }
.adel-table th { z-index: 3; white-space: nowrap; }

.adel-table th.stick-1, .adel-table td.stick-1 {
  position: sticky; left: 0; min-width: 186px; max-width: 186px;
  box-shadow: 4px 0 8px -4px rgba(19, 28, 46, .14);
}
.adel-table th.stick-1 { z-index: 4; top: 0; background: var(--ink); }
.adel-table td.stick-1 { background: var(--surface); z-index: 2; }
.adel-table tbody tr:nth-child(even) td.stick-1 { background: var(--zebra); }
.adel-table tbody tr:hover td.stick-1 { background: var(--hover); }
.adel-table td.stick-1 .player-cell { gap: 6px; }
.adel-table td.stick-1 .player-cell a { overflow: hidden; text-overflow: ellipsis; }

/* Separadores entre bloques (jugador | objetivo | brecha) */
.adel-table th.adel-sep, .adel-table td.adel-sep { border-left: 1px solid var(--line); }

/* Flecha jugador → objetivo */
.adel-table th.adel-arrow, .adel-table td.adel-arrow {
  padding-left: 2px; padding-right: 2px; text-align: center;
  color: var(--muted); font-weight: 700;
}

/* Fila con adelantamiento YA conseguido en vivo */
.adel-table tbody tr.is-achieved td { background: var(--up-tint); }
.adel-table tbody tr.is-achieved:nth-child(even) td.stick-1,
.adel-table tbody tr.is-achieved td.stick-1 { background: var(--up-tint); }

/* Objetivo retirado atenuado */
.adel-table td.is-retired { opacity: .62; }

/* Columna de puesto (#) */
.adel-table td.rk-num { font-weight: 700; color: var(--muted); font-size: 13px; }

/* Total del jugador en ámbar del sistema */
.adel-table td.num strong { color: var(--accent-deep); }
.adel-table td.is-retired.num strong { color: inherit; }

/* Equipo (scope=equipo) */
.adel-table td .team-tag { color: var(--ink); font-weight: 600; }
.adel-table td .team-tag:hover { color: var(--accent-deep); text-decoration: none; }

/* ---------- Badge de partidos estimados (PJ Est. / Resta) ---------- */
.est-badge {
  display: inline-block; min-width: 30px; padding: 3px 9px;
  border-radius: var(--r-pill); font-weight: 700; font-size: 12.5px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.est-green { background: var(--up-tint); color: var(--up); }
.est-amber { background: var(--accent-soft); color: #8F5E12; }
.est-grey  { background: var(--ground); color: var(--muted); }

/* ---------- Badge de estadística ---------- */
.stat-badge {
  display: inline-block; min-width: 34px; padding: 2px 8px;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  letter-spacing: .03em; color: #fff; text-align: center;
}
.stat-badge--PTS { background: #2563EB; }
.stat-badge--REB { background: #059669; }
.stat-badge--AST { background: #C2620A; }
.stat-badge--T3  { background: #C03A2E; }
.stat-badge--VAL { background: #7C3AED; }
.stat-badge--PJ  { background: #5B6577; }
.stat-badge--VIC { background: #0E7490; }
.stat-badge--TL  { background: #4338CA; }
.stat-badge--T2  { background: #0369A1; }
.stat-badge--TAP { background: #6B4423; }

/* ---------- Etiquetas en activo / retirado ---------- */
.active-badge {
  display: inline-block; padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--up); color: #fff; font-size: 9.5px; font-weight: 700;
  letter-spacing: .04em; vertical-align: middle;
}
.retired-tag {
  display: inline-block; padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--ground); color: var(--muted); font-size: 9.5px;
  font-weight: 700; letter-spacing: .04em; vertical-align: middle;
}
.adel-note strong .active-badge,
.adel-note .active-badge, .adel-note .retired-tag { margin: 0 1px; }

.adel-note { margin-top: var(--sp-3); font-size: 12.5px; line-height: 1.6; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .adel-head h1 { font-size: 22px; }
  .adel-filters { gap: var(--sp-3); }
  .adel-table { min-width: 0; font-size: 12.5px; }
  .adel-table th, .adel-table td { padding: 7px 8px; }
  .adel-table th.stick-1, .adel-table td.stick-1 { min-width: 150px; max-width: 150px; }
  .adel-table td.stick-1 .pname-full { display: none; }
  .adel-table td.stick-1 .pname-abbr { display: inline; }
}
