/* ============================================================
   css/pages/directo.css — estilos de partidos_directo.php y tuequipo.php
   (cargado por head.php cuando la página define $page_css='directo')
   Reutiliza tokens.css + componentes de rincon.css (.card, .focus-surface,
   .table, .chip-delta, .myteams…). Aquí solo lo específico del "directo".
   ============================================================ */

/* ---------- Cabecera de página ---------- */
.directo-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap;
}
.directo-head h1 {
  font-family: var(--score); font-size: 30px; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.1;
}
.directo-head__actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.btn--sm { padding: 6px 13px; font-size: 13px; }

.dlive-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--down);
  display: inline-block; box-shadow: 0 0 0 0 rgba(192,58,46,.5);
  animation: dlive-pulse 1.6s infinite;
}
.dlive-txt { font-size: 12.5px; font-weight: 600; color: var(--down); }
@keyframes dlive-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(192,58,46,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(192,58,46,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,58,46,0); }
}
@media (prefers-reduced-motion: reduce) { .dlive-dot { animation: none; } }

.directo-note {
  margin-top: var(--sp-4); color: var(--muted); font-size: 13.5px;
  background: var(--accent-soft); border-radius: var(--r-input);
  padding: 10px var(--sp-4);
}

/* ---------- Estado vacío (sin directo / sin datos) ---------- */
.directo-empty { margin-top: var(--sp-5); padding: var(--sp-6); text-align: center; }
.directo-empty h2 { font-size: 22px; }
.directo-empty p { color: var(--muted); margin: var(--sp-2) auto 0; max-width: 52ch; }
.directo-empty__links {
  display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; margin-top: var(--sp-4);
}

/* Tarjeta "Tus equipos": puntuación esperada tras el SM en vivo */
.myteam-card__prev { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--up); margin-left: 6px; }

/* ---------- Rejilla de partidos ---------- */
.directo-section { margin-top: var(--sp-5); }
.directo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4); align-items: start;
}
@media (max-width: 1024px) { .directo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .directo-grid { grid-template-columns: 1fr; } }

.dmatch { overflow: hidden; display: flex; flex-direction: column; }

/* Marcador (superficie oscura de foco) */
.dmatch__board {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: var(--sp-3); padding: var(--sp-4) var(--sp-4);
  border-radius: 0; border: 0;
}
.dmatch__team {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; min-width: 0;
}
.dmatch__team:hover { text-decoration: none; }
.dmatch__team:hover .dmatch__cod { color: var(--accent); }
.dmatch__team .shield { background: #fff; border-radius: 8px; padding: 3px; }
.dmatch__cod { font-family: var(--score); font-weight: 700; font-size: 14px; letter-spacing: .03em; }
.dmatch__center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dmatch__score { font-size: 30px; color: #fff; line-height: 1; white-space: nowrap; }
.dmatch__dash { color: var(--muted-dark); margin: 0 2px; }

.dchip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap;
}
.dchip--live { background: var(--down); color: #fff; }
.dchip--fin  { background: rgba(255,255,255,.14); color: var(--up-dark); }
.dchip--soon { background: rgba(255,255,255,.12); color: var(--muted-dark); }

/* Box-score de DOS COLUMNAS: local (izq) | visitante (dcha), lado a lado. */
.dmatch__teams { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.dcol { min-width: 0; }
.dcol + .dcol { border-left: 1px solid var(--line); }
.dcol__head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px var(--sp-3); background: var(--zebra);
  font-weight: 600; font-size: 12px;
}
.dcol__cod { font-family: var(--score); font-weight: 700; letter-spacing: .03em; }

/* Tabla compacta de columna (hereda .dtable; ajusta densidad y ancho fijo). */
.dbox { table-layout: fixed; }
.dbox th, .dbox td { padding: 4px 5px; font-size: 11.5px; }
.dbox th { font-size: 10px; letter-spacing: .03em; }
.dbox th.r, .dbox td.r { width: 30px; }
.dbox .dtable__pl { width: auto; overflow: hidden; text-overflow: ellipsis; }

/* Nombre de jugador como botón (abre el modal); aspecto de enlace. */
.dplayer {
  color: var(--ink); font-weight: 600; font-family: inherit; font-size: inherit;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.dplayer:hover { color: var(--accent-deep); }
.dbox tr.is-playing .dplayer { color: var(--accent-deep); }

.dtable-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dtable th {
  position: static; background: var(--surface); color: var(--muted);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.dtable th.r, .dtable td.r { text-align: right; }
.dtable td {
  padding: 6px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover td { background: var(--hover); }
.dtable__pl { width: 100%; }
.dtable__pl a { color: var(--ink); font-weight: 600; }
.dtable__pl a:hover { color: var(--accent-deep); text-decoration: none; }
.dtable__sm { font-weight: 700; color: var(--accent-deep); }
.dtable__empty { color: var(--muted); text-align: center; font-style: italic; }

/* Jugador en pista: fila resaltada + punto ámbar */
.dtable tr.is-playing td { background: var(--accent-soft); }
.dtable tr.is-playing .dtable__pl a { color: var(--accent-deep); }
.dpista {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-left: 5px; vertical-align: middle;
}

/* Chip de faltas */
.dfoul {
  display: inline-block; font-size: 9px; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 5px; margin-left: 4px; vertical-align: middle;
}
.dfoul--warn { background: var(--accent); color: var(--court-a); }
.dfoul--out  { background: var(--down); color: #fff; }

/* ---------- Lista compacta de jugadores (SM + broker en vivo) ----------
   Sustituye a la tabla de stats: el detalle (min/pts/reb/as/T3/val) vive en el
   modal. Cada línea = estado · nombre · SM · cambio de broker. */
.dplayers { list-style: none; margin: 0; padding: 0; }
.dpl {
  position: relative; /* ancla la barra de broker (bottom) */
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center; gap: 6px;
  padding: 3px var(--sp-3);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.dpl:last-child { border-bottom: 0; }
.dpl--head {
  padding-top: 6px; padding-bottom: 6px;
  color: var(--muted); text-transform: uppercase;
  font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  background: var(--surface);
}
.dplayers__empty {
  padding: 12px var(--sp-3); color: var(--muted);
  font-style: italic; font-size: 12px; text-align: center;
}

/* Indicador de estado (punto): pista = ámbar pulsante, banquillo = gris,
   sin jugar = solo contorno atenuado. */
.dpl__status {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line); justify-self: center;
}
.dpl__status--live {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(240, 162, 60, .5);
  animation: dlive-pulse 1.6s infinite;
}
.dpl.is-dnp .dpl__status { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }

/* Nombre (botón que abre el modal) + marcador de "tuyo" + chip de faltas. */
.dpl__namewrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.dpl__name {
  flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dpl.is-dnp .dpl__name { color: var(--muted); font-weight: 500; }
.dpl__mine { flex: none; color: var(--accent-deep); font-size: 11px; line-height: 1; }

/* SM en vivo: la cifra principal, destacada y tabular. */
.dpl__sm {
  font-family: var(--score); font-weight: 700; font-size: 13px;
  color: var(--accent-deep); font-variant-numeric: tabular-nums;
  text-align: right; min-width: 24px;
}
.dpl.is-dnp .dpl__sm { color: var(--muted); font-weight: 600; }

/* Cambio de broker en vivo: LÍNEA sutil (no texto €). Barra fina anclada al
   borde inferior de la fila; dirección por color (verde sube / rojo baja),
   magnitud por anchura (la anchura % se fija inline por jugador). El detalle en
   € vive en el title de la fila y en el modal. Va abajo para no chocar con el
   acento lateral ámbar de "en mi equipo". */
.dpl__brokerbar {
  position: absolute; left: 0; bottom: -1px; height: 2.5px;
  max-width: 100%; border-radius: 0 2px 2px 0;
  background: var(--muted); opacity: .5; pointer-events: none;
}
.dpl__brokerbar--up { background: var(--up); }
.dpl__brokerbar--down { background: var(--down); }

/* Jugador en uno de tus equipos: acento lateral ámbar + fondo sutil (la
   dirección lateral lo distingue de la barra de broker, que es horizontal). */
.dpl.is-mine { background: var(--accent-soft); box-shadow: inset 3px 0 0 0 var(--accent); }
/* La barra de broker de una fila "tuya" se despega del acento lateral. */
.dpl.is-mine .dpl__brokerbar { left: 3px; }

/* ---------- tuequipo.php: fila-resumen + desglose por jugador ---------- */
.tq-switch { margin-top: var(--sp-4); }
.tq-select {
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 9px var(--sp-4); max-width: 100%;
}

.tq-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-3); margin: var(--sp-4) 0;
}
.tq-stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--sp-3) var(--sp-4); text-align: center;
}
.tq-stat__num {
  font-family: var(--score); font-weight: 700; font-size: 26px;
  font-variant-numeric: tabular-nums; display: block; line-height: 1.1;
}
.tq-stat__num.up { color: var(--up); }
.tq-stat__num.down { color: var(--down); }
.tq-stat__num--accent { color: var(--accent-deep); }
.tq-stat__pct { font-family: var(--sans); font-size: 13px; font-weight: 600; }
.tq-stat .label { display: block; margin-top: 4px; }

.tq-table-wrap { overflow-x: auto; }
.tq-table { width: 100%; }
.tq-table .dtable__sm { color: var(--accent-deep); }
.tq-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--zebra); }
.tq-team-cell { display: flex; align-items: center; gap: 6px; font-weight: 600; }

/* Landing sin sesión (reutiliza patrón de misequipos) */
.tq-landing {
  margin-top: var(--sp-5); padding: var(--sp-6);
  display: flex; gap: var(--sp-6); align-items: center; flex-wrap: wrap;
}
.tq-landing__txt { flex: 1; min-width: 260px; }
.tq-landing h1 { color: #fff; font-size: 30px; }
.tq-landing p { color: var(--muted-dark); margin-top: 6px; max-width: 54ch; }
.tq-landing__list { list-style: none; margin-top: var(--sp-4); display: grid; gap: 8px; }
.tq-landing__list li { color: #fff; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tq-tick { color: var(--accent); font-weight: 700; }
.tq-landing__cta { display: flex; flex-direction: column; gap: var(--sp-3); }
.tq-landing__alt { color: #fff; font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* El modal de detalle de jugador (.player-modal*) ahora vive en rincon.css
   porque es un componente GLOBAL: lo usan directo, tuequipo y records (y
   cualquier página con $show_player_modal). Antes estaba aquí y en records
   —que no carga directo.css— salía sin estilar como sección bajo el footer. */

/* ---------- Fila enfocada (equipo del usuario) en tablas tq ---------- */
.tq-table tr.is-focus td { background: var(--accent-soft); }
.tq-table tr.is-focus td:first-child { box-shadow: inset 3px 0 0 0 var(--accent); }
.tq-you {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: var(--court-a, #131C2E);
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; vertical-align: middle;
}

/* ---------- Mi nivel (comparación por tramos) ---------- */
.tq-comp-sub { color: var(--muted); font-size: 14px; margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); max-width: 72ch; }
.tq-comp-sub a { color: var(--accent-deep); font-weight: 600; }
.tq-nivel-callout {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-3) var(--sp-5); margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: var(--r-card);
}
.tq-nivel-callout__main p { margin-top: 4px; font-size: 15px; color: var(--ink); }
.tq-nivel-callout__main p .num { font-family: var(--score); font-size: 24px; font-weight: 700; color: var(--accent-deep); }
.tq-nivel-callout__cmp { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.tq-nivel-chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.tq-nivel-chip__val { font-family: var(--score); font-weight: 700; font-size: 15px; }
.tq-nivel-chip__val.up { color: var(--up); }
.tq-nivel-chip__val.down { color: var(--down); }
.tq-comp-chart { max-width: 620px; margin-bottom: var(--sp-4); }
.tq-comp-chart svg { height: 240px; }
.chart-legend .tq-swatch { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.tq-swatch--cur { background: #131C2E; }
.tq-swatch--exp { background: #C07C1D; }
.tq-swatch--med { background: #98A3B8; }
.tq-tier-table td small { color: var(--muted); }

/* ---------- Distribución de equipos ---------- */
.tq-dist-charts { grid-template-columns: 1fr 1fr; }
.tq-dist-charts .chart-card svg { height: 230px; }
@media (max-width: 720px) { .tq-dist-charts { grid-template-columns: 1fr; } }

/* ---------- Mejores equipos de la jornada ---------- */
.tq-mejores-scroll { overflow-x: auto; padding-bottom: var(--sp-2); }
.tq-mejores-grid { display: flex; gap: var(--sp-3); min-width: min-content; }
.tq-mcard {
  flex: 0 0 220px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--sp-3) var(--sp-4);
}
.tq-mcard--own { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.tq-mcard__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.tq-mcard__rank { font-family: var(--score); font-weight: 700; font-size: 15px; color: var(--muted); }
.tq-mcard__scores { display: flex; align-items: baseline; gap: 6px; }
.tq-mcard__score { font-family: var(--score); font-weight: 700; font-size: 24px; color: var(--accent-deep); }
.tq-mcard__prev { font-size: 13px; font-weight: 600; color: var(--muted); }
.tq-mcard__body { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.tq-mcard__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--zebra); }
.tq-mcard__avatar--ph {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--score); font-weight: 700; font-size: 15px; color: var(--muted);
  border: 1px solid var(--line);
}
.tq-mcard__info { min-width: 0; }
.tq-mcard__nick { font-weight: 700; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-mcard__team { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-mcard__pos { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tq-mcard__pos .num { color: var(--ink); font-weight: 600; }

/* ---------- Líderes de la jornada ---------- */
.tq-lideres-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.tq-lider-card { padding: 0; overflow: hidden; }
.tq-lider-card__title {
  font-family: var(--score); font-size: 14px; font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: .03em;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); background: var(--zebra);
}
.tq-lider-table { width: 100%; margin: 0; }
.tq-lider-table td { padding: 7px var(--sp-4); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tq-lider-table tr:last-child td { border-bottom: 0; }
.tq-lider-name { width: 100%; }
.tq-lider-name .dplayer { color: var(--ink); font-weight: 600; }
.tq-lider-name .dplayer:hover { color: var(--accent-deep); }
.tq-lider-val { font-family: var(--score); font-weight: 700; color: var(--accent-deep); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .directo-head h1 { font-size: 25px; }
  .dmatch__score { font-size: 26px; }
  /* Las dos columnas (local | visitante) siguen lado a lado en móvil; el
     contenido ya es mínimo (estado · N. Apellido · SM + barra de broker), así
     que basta con apretar el espaciado horizontal. */
  .dcol__head { padding: 6px var(--sp-2); }
  .dpl { padding-left: var(--sp-2); padding-right: var(--sp-2); gap: 4px; }
  .tq-nivel-callout { flex-direction: column; align-items: flex-start; }
}
