/* =====================================================================
   estilos.css — Aspecto de la página
   ===================================================================== */

/* Colores en un solo lugar: cambiando estas variables cambia todo el sitio */
:root {
  --fondo: #f2f4f3;
  --tarjeta: #ffffff;
  --verde: #1b7a3d;
  --verde-oscuro: #145c2e;
  --texto: #1d2321;
  --gris: #6b7671;
  --borde: #e2e6e4;
  --rojo: #d62828;
  --amarillo-gol: #fff4c2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

/* ---------- Encabezado ---------- */
.encabezado {
  background: var(--verde);
  color: white;
  padding: 12px 16px;
  position: sticky;          /* queda fijo arriba al hacer scroll */
  top: 0;
  z-index: 10;
}
.encabezado h1 {
  font-size: 1.15rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.en-vivo-tag {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.5;              /* apagado hasta que conecta el tiempo real */
}
.en-vivo-tag.conectado { opacity: 1; }

.fechas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--verde-oscuro);
  border-radius: 8px;
}
.fechas button {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  padding: 4px 18px;
  cursor: pointer;
}
.dia-actual { font-weight: 600; text-transform: capitalize; }

/* ---------- Lista de partidos ---------- */
main {
  max-width: 720px;           /* en pantallas grandes no se estira de más */
  margin: 0 auto;
  padding: 12px;
}

.competicion {
  background: var(--tarjeta);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.competicion h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  padding: 10px 14px;
  background: #e9efec;
  color: var(--verde-oscuro);
}

/* Cada partido es una grilla de 4 columnas: estado | local | resultado | visitante */
.partido {
  display: grid;
  grid-template-columns: 56px 1fr 72px 1fr;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--borde);
  cursor: pointer;
  transition: background 0.3s;
}
.partido:hover { background: #f7faf8; }

.estado { font-size: 0.8rem; color: var(--gris); text-align: center; }
.jugando .estado { color: var(--rojo); font-weight: 700; animation: titilar 1.5s infinite; }

.equipo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  min-width: 0;
}
.equipo.local { justify-content: flex-end; text-align: right; }
.equipo img { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }

.resultado {
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.resultado small { font-size: 0.65rem; font-weight: 400; color: var(--gris); }
.jugando .resultado { color: var(--rojo); }
.vs { color: var(--gris); font-weight: 400; }

/* Resaltado cuando entra un gol */
.partido.gol { animation: gol 3s ease-out; }

/* ---------- Eventos (detalle del partido) ---------- */
.eventos {
  background: #fafbfa;
  border-top: 1px dashed var(--borde);
  padding: 6px 12px 10px;
  font-size: 0.85rem;
}
.evento { display: flex; gap: 8px; padding: 3px 0; }
.evento.de-visitante { flex-direction: row-reverse; text-align: right; }
.evento .min { color: var(--gris); min-width: 38px; }
.sin-eventos { color: var(--gris); margin: 4px 0; }

/* ---------- Mensajes y pie ---------- */
.mensaje { text-align: center; color: var(--gris); padding: 40px 10px; }
.pie { text-align: center; color: var(--gris); font-size: 0.75rem; padding: 20px; }

/* ---------- Animaciones ---------- */
@keyframes titilar { 50% { opacity: 0.45; } }
@keyframes gol { 0% { background: var(--amarillo-gol); } 100% { background: transparent; } }

/* ---------- Celulares ---------- */
@media (max-width: 480px) {
  .partido { grid-template-columns: 44px 1fr 56px 1fr; padding: 10px 8px; }
  .equipo { font-size: 0.82rem; }
}

/* =====================================================================
   Páginas nuevas: menú, equipo y tablas
   ===================================================================== */

/* ---------- Menú ---------- */
.menu { display: flex; gap: 6px; margin-bottom: 10px; }
.menu a {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 5px 12px;
  border-radius: 999px;
  opacity: 0.8;
}
.menu a.activo, .menu a:hover { background: var(--verde-oscuro); opacity: 1; }

/* Nombres de equipos como links (sin el subrayado azul de siempre) */
.link-equipo { color: inherit; text-decoration: none; }
.link-equipo:hover { text-decoration: underline; }

/* ---------- Tarjetas genéricas ---------- */
.tarjeta {
  background: var(--tarjeta);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.tarjeta > h2 { font-size: 1rem; margin: 0 0 10px; color: var(--verde-oscuro); }
.subtitulo { font-size: 0.8rem; text-transform: uppercase; color: var(--gris); margin: 14px 0 4px; }
.resumen { color: var(--gris); font-size: 0.85rem; margin: 6px 0; }

/* ---------- Ficha del club ---------- */
.ficha-titulo { display: flex; align-items: center; gap: 12px; }
.ficha-titulo h2 { font-size: 1.4rem; margin: 0; }
.escudo-grande { width: 64px; height: 64px; object-fit: contain; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 14px 0; }
.dato { background: var(--fondo); border-radius: 8px; padding: 8px 10px; }
.dato span { display: block; font-size: 0.72rem; color: var(--gris); text-transform: uppercase; }
.dato strong { font-size: 0.95rem; }
.foto-estadio { width: 100%; border-radius: 8px; max-height: 260px; object-fit: cover; }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow-x: auto; }   /* en celulares la tabla se desliza de costado */
.tabla { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tabla th { color: var(--gris); font-weight: 600; font-size: 0.75rem; padding: 6px 4px; border-bottom: 1px solid var(--borde); }
.tabla td { padding: 7px 4px; text-align: center; border-bottom: 1px solid var(--borde); }
.tabla .izq { text-align: left; }
.equipo-tabla { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.equipo-tabla img { width: 20px; height: 20px; object-fit: contain; }

/* Zonas de clasificación: borde de color a la izquierda */
.posiciones tr td:first-child { border-left: 4px solid transparent; }
.posiciones tr.libertadores td:first-child { border-left-color: #1b7a3d; }
.posiciones tr.sudamericana td:first-child { border-left-color: #2a6fdb; }
.posiciones tr.descenso td:first-child { border-left-color: var(--rojo); }
.referencias { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.75rem; color: var(--gris); margin-top: 10px; }
.ref::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.ref.libertadores::before { background: #1b7a3d; }
.ref.sudamericana::before { background: #2a6fdb; }
.ref.descenso::before { background: var(--rojo); }

/* ---------- Selector y chips de temporada ---------- */
.selector select {
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  font-size: 0.95rem;
  margin-bottom: 10px;
  background: white;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chips button {
  border: 1px solid var(--borde);
  background: white;
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.85rem;
}
.chips button.activo { background: var(--verde); color: white; border-color: var(--verde); }

/* ---------- Lista de resultados de un equipo ---------- */
.fila-resultado {
  display: grid;
  grid-template-columns: 62px 18px 1fr auto 26px;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--borde);
  font-size: 0.88rem;
}
.fila-resultado .fecha { color: var(--gris); font-size: 0.78rem; }
.fila-resultado .condicion { color: var(--gris); font-size: 0.75rem; text-align: center; }
.fila-resultado .rival { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fila-resultado .rival img { width: 18px; height: 18px; object-fit: contain; }
.fila-resultado .marcador { font-weight: 700; text-align: right; }
.fila-resultado .marcador small { font-weight: 400; color: var(--gris); font-size: 0.7rem; }
.badge { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: white; }
.badge.G { background: #2e9e57; }
.badge.E { background: #9aa39f; }
.badge.P { background: var(--rojo); }

/* ---------- Cara a cara ---------- */
.h2h { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin: 6px 0 8px; }
.h2h strong { display: block; font-size: 1.6rem; }
.h2h span { font-size: 0.75rem; color: var(--gris); }
.barra-h2h { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--borde); }
.barra-h2h .G { background: #2e9e57; }
.barra-h2h .E { background: #9aa39f; }
.barra-h2h .P { background: var(--rojo); }

/* ---------- Plantel ---------- */
.jugadores { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.jugador { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; background: var(--fondo); }
.jugador img, .jugador .sin-foto { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--borde); flex-shrink: 0; }
.jugador strong { display: block; font-size: 0.88rem; }
.jugador span { font-size: 0.75rem; color: var(--gris); }
.jugador .numero { color: var(--verde); font-weight: 700; margin-right: 6px; font-size: 0.88rem; }
