/* ============================================================
   smgr · css/pages/precedentes.css — PRECEDENTES
   Constructor de consulta (panel de filtros "Foco") + gran tabla
   sticky de actuaciones históricas, ordenable por cabecera (rincon.js).
   Tokens en css/tokens.css; componentes base en css/rincon.css.
   ============================================================ */

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

/* ---------- Panel de filtros ---------- */
.prec-filters {
  margin-top: var(--sp-4); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.prec-filters__block { display: flex; flex-direction: column; gap: var(--sp-3); }
.prec-filters__legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink); margin: 0;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.prec-filters__hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 2px; }

/* Rejilla de campos jugador/equipo/rival/posición/temporada/fase/cancha */
.prec-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.prec-grid .fgroup--wide { grid-column: span 2; }
.fgroup { display: flex; flex-direction: column; gap: 6px; }
.flabel {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}

/* Inputs y selects (mismo look en todo el panel) */
.prec-filters input[type="text"],
.prec-filters input[type="number"],
.prec-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: 7px 12px; width: 100%;
}
.prec-filters select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 30px;
  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;
}
.prec-filters input:focus-visible,
.prec-filters select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

/* Rejilla de criterios estadísticos (operador + valor) */
.prec-stats {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.prec-stat {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--ground); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 9px 10px;
}
.prec-stat__label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.prec-stat__controls { display: flex; gap: 6px; align-items: center; }
.prec-op { flex: 0 0 52px; text-align: center; padding-right: 12px !important;
  background-image: none !important; }
.prec-val { flex: 1 1 auto; min-width: 0; }

/* Acciones */
.prec-filters__actions {
  display: flex; align-items: center; gap: var(--sp-3);
  padding-top: var(--sp-2); border-top: 1px solid var(--line);
}
.prec-filters__actions .btn { padding: 8px 20px; font-size: 13px; }
.prec-filters__reset {
  font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.prec-filters__reset:hover { color: var(--down); }

/* ---------- Resultados ---------- */
.prec-section { margin-top: var(--sp-5); }
.prec-results-head { flex-direction: column; align-items: flex-start; gap: 4px; }
.prec-summary { font-size: 13.5px; color: var(--muted); }
.prec-summary .num { color: var(--accent-deep); font-weight: 700; }

.prec-empty { padding: var(--sp-5); text-align: center; }
.prec-empty__title {
  font-family: var(--score); font-size: 18px; font-weight: 700;
  color: var(--ink); margin-bottom: 6px;
}
.prec-empty p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 auto; max-width: 620px; }

/* ---------- Tabla: thead sticky + 1.ª columna sticky ---------- */
.prec-wrap {
  position: relative; overflow: auto; max-height: 78vh;
  border-radius: var(--r-card); margin-top: var(--sp-3);
}
.prec-table { min-width: 1180px; }
.prec-table th { z-index: 3; white-space: nowrap; }
.prec-table th.stick-1, .prec-table td.stick-1 {
  position: sticky; left: 0; min-width: 172px; max-width: 172px;
  box-shadow: 4px 0 8px -4px rgba(19, 28, 46, .14);
}
.prec-table th.stick-1 { z-index: 4; top: 0; background: var(--ink); }
.prec-table td.stick-1 { background: var(--surface); z-index: 2; }
.prec-table tbody tr:nth-child(even) td.stick-1 { background: var(--zebra); }
.prec-table tbody tr:hover td.stick-1 { background: var(--hover); }
.prec-table td.stick-1 .player-cell a { overflow: hidden; text-overflow: ellipsis; }

.prec-nowrap { white-space: nowrap; }

/* Rival: vs/@ + escudo + código */
.prec-rival { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.prec-rival__vs { color: var(--muted); font-size: 11px; font-weight: 600; }
.prec-table .team-tag { color: var(--ink); font-weight: 600; }
.prec-table .team-tag:hover { color: var(--accent-deep); }

/* Resultado ganado/perdido */
.prec-win { color: var(--up); font-weight: 700; }
.prec-loss { color: var(--down); font-weight: 700; }

/* Valoración destacada */
.prec-table td.c-val strong { color: var(--accent-deep); }

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

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .prec-head h1 { font-size: 22px; }
  .prec-grid .fgroup--wide { grid-column: span 1; }

  .prec-table { font-size: 12px; }
  .prec-table th, .prec-table td { padding: 6px 7px; }
  .prec-table th.stick-1, .prec-table td.stick-1 { min-width: 148px; max-width: 148px; }
  .prec-table td.stick-1 .player-cell { gap: 5px; }
  .prec-table td.stick-1 .player-cell a {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  }
}
