/* ============================================================
   smgr · css/pages/ranking.css — estilos de la familia de RANKING
   (valoracion / anotacion / asistencias / rebotes / triples y sus _rec),
   todas servidas por partials/ranking_engine.php.
   (tokens en css/tokens.css; componentes base en css/rincon.css)
   Reutiliza el patrón de tabla ancha sticky del broker, pero con clases
   propias (.val-*) para no acoplarse a broker.css (no se carga aquí).
   ============================================================ */

/* ---------- Conmutadores: estadística (segmented) + scope (toggle) ---------- */
.rk-switch {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4);
}
.rk-switch__stats, .rk-switch__scope {
  display: inline-flex; background: var(--ground);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px;
}
.rk-switch__stats { flex-wrap: wrap; }
.rk-switch__stats a, .rk-switch__scope a {
  font-size: 12.5px; font-weight: 600; padding: 6px 14px;
  border-radius: var(--r-pill); color: var(--muted); white-space: nowrap;
}
.rk-switch__stats a:hover, .rk-switch__scope a:hover { color: var(--ink); }
.rk-switch__stats a.is-active, .rk-switch__scope a.is-active { background: var(--ink); color: #fff; }
.rk-switch__stats a:focus-visible, .rk-switch__scope a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.rk-switch__scope a.is-active { background: var(--accent-deep); }

@media (max-width: 640px) {
  .rk-switch { gap: var(--sp-2); }
  .rk-switch__stats a, .rk-switch__scope a { padding: 6px 10px; font-size: 12px; }
}

/* Media por jugador entre paréntesis (tabla de equipos) */
.muted-paren { color: var(--muted); font-weight: 500; font-size: .92em; }
.rk-eq-table th.stick-1, .rk-eq-table td.stick-1 { min-width: 150px; }

/* ---------- Cabecera de página ---------- */
.val-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap;
}
.val-head h1 {
  font-family: var(--score); font-size: 26px; font-weight: 700;
  letter-spacing: .01em; color: var(--ink);
}
.val-head .sub { font-size: 13px; color: var(--muted); }

/* ---------- Stat-cards: 3 columnas en esta página ---------- */
.stat-cards.val-stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 870px) {
  .stat-cards.val-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stat-cards.val-stats { grid-template-columns: 1fr; }
}
/* El líder/chollo es un nombre, no un número: tamaño contenido */
.val-stats .stat-card__big .player-cell {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 700; white-space: nowrap;
}
.val-stats .stat-card__big .player-cell a { color: var(--accent-deep); }
.val-stats .stat-card__big .player-cell a:hover { text-decoration: underline; }

/* ---------- Barra de filtros ---------- */
.val-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--sp-4); padding: var(--sp-4); margin-top: var(--sp-4);
}
.val-filters .fgroup { display: flex; flex-direction: column; gap: 6px; }
.val-filters .flabel {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.val-filters select {
  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 32px 6px 12px;
  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;
}
.val-filters select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.val-filters .btn { padding: 7px 16px; font-size: 13px; }
.val-filters__reset {
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  align-self: center; white-space: nowrap;
}
.val-filters__reset:hover { color: var(--down); }

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

/* ---------- Tabla ranking: thead sticky + 1.ª columna sticky ---------- */
.val-section { margin-top: var(--sp-4); }
.val-wrap {
  position: relative; overflow: auto; max-height: 78vh;
  border-radius: var(--r-card);
}
.val-table { min-width: 1066px; }
.val-table th { z-index: 3; }
.val-table th.stick-1, .val-table td.stick-1 {
  position: sticky; left: 0; min-width: 156px; max-width: 156px;
  box-shadow: 4px 0 8px -4px rgba(19, 28, 46, .14);
}
/* Nombre corto "N. Apellido" también en escritorio (columna sticky estrecha). */
.val-table td.stick-1 .pname-full { display: none; }
.val-table td.stick-1 .pname-abbr { display: inline; }
.val-table td.stick-1 .player-cell a { overflow: hidden; text-overflow: ellipsis; }
.val-table th.stick-1 { z-index: 4; top: 0; background: var(--ink); }
.val-table td.stick-1 { background: var(--surface); z-index: 2; }
.val-table tbody tr:nth-child(even) td.stick-1 { background: var(--zebra); }
.val-table tbody tr:hover td.stick-1 { background: var(--hover); }

/* Columna de equipo: enlace discreto al escudo/código */
.val-table td .team-tag { color: var(--ink); font-weight: 600; }
.val-table td .team-tag:hover { color: var(--accent-deep); }

/* Columnas con semántica de color (fórmulas del sitio actual) */
.val-table td.c-sm strong { color: var(--accent-deep); }
.val-table td.c-up { color: var(--up); font-weight: 700; }
.val-table td.c-down { color: var(--down); font-weight: 700; }

/* Regularidad coloreada por nivel */
.tag-reg.rc-top { color: var(--up); }
.tag-reg.rc-ok  { color: var(--accent-deep); }
.tag-reg.rc-mid { color: var(--muted); }
.tag-reg.rc-bad { color: var(--down); }

/* Columnas de jornada: separador tenue del bloque de medias */
.val-table th.jcol, .val-table td.jcol { color: var(--muted); }
.val-table .jcol { border-left: 1px dotted var(--line); }

.val-note { margin-top: var(--sp-3); font-size: 12.5px; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .val-head h1 { font-size: 22px; }
  .val-filters { gap: var(--sp-3); }

  .val-table { font-size: 12px; }
  .val-table th, .val-table td { padding: 6px 7px; }

  .val-table th.stick-1, .val-table td.stick-1 { min-width: 140px; }
  .val-table td.stick-1 .player-cell { gap: 5px; }
  .val-table td.stick-1 .player-cell a {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  }
  td.has-flag .player-cell { padding-right: 18px; }
  .flag-cupo { width: 20px; }
}
