/* Fuente global */
body {
  margin: 0;
  padding: 20px;
  font-family: 'Nunito', sans-serif;
  background-color: #111;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.titulo {
  font-size: 26px;
  color: #00d2ff;
  text-align: center;
  margin-bottom: 30px;
}

/* Grid de equipos — 8 por fila en desktop */
.grid-equipos {
  display: grid;
  grid-template-columns: repeat(8, 1fr); /* antes 5 */
  gap: 16px;                              /* antes 20 */
  width: 100%;
  max-width: 1480px;                      /* ancho para 8 tarjetas cómodas */
}

/* Tarjeta de equipo (compatibilidad con .card-equipo y .equipo-card) */
.card-equipo,
.equipo-card {
  background-color: #1e1e1e;
  border-radius: 12px;
  padding: 14px;                          /* antes 15 */
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  border: 1px solid #333;
}

.card-equipo:hover,
.equipo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 15px #00d2ff66;
}

.card-equipo img,
.equipo-card img {
  width: 64px;                            /* antes 80 */
  height: 64px;                           /* antes 80 */
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.35));
}

.card-equipo h2,
.equipo-card h2 {
  font-size: 14px;                        /* antes 16 */
  margin: 4px 0 2px 0;
  color: #f1c40f;
  line-height: 1.2;
}

.card-equipo p,
.equipo-card p {
  font-size: 12px;                        /* antes 14 */
  color: #ccc;
  margin: 0;
}

/* Responsive: 6 columnas en >=1100–1400px, 4 en tablet, 2 en móvil */
@media (max-width: 1400px) {
  .grid-equipos { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 1100px) {
  .grid-equipos { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .grid-equipos { grid-template-columns: repeat(2, 1fr); }
  .card-equipo img,
  .equipo-card img { width: 56px; height: 56px; }
  .card-equipo h2,
  .equipo-card h2 { font-size: 13px; }
  .card-equipo p,
  .equipo-card p { font-size: 11px; }
}

/* ------------------------------
   Popup personalizado (compat)
   Soporta:
   - .popup / .popup-content / #btn-confirm / #btn-cancel
   - .popup-overlay / .popup-card / #confirm-btn / #cancel-btn
-------------------------------- */

/* Overlay */
.popup,
.popup-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;            /* se muestra via JS: style.display = 'flex' */
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* Card */
.popup-content,
.popup-card {
  background-color: #1e1e1e;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  max-width: 320px;
  width: calc(100% - 40px);
  box-shadow: 0 0 15px #00d2ff66;
  border: 1px solid #2a2a2a;
}

.popup-content h3,
.popup-card h3 {
  margin: 0 0 10px 0;
  color: #00d2ff;
  font-size: 18px;
}

#popup-team-name,
.popup-content p,
.popup-card p {
  font-size: 16px;
  margin-bottom: 20px;
  color: #f5f0e6;
}

/* Botonera */
.popup-buttons {
  display: flex;
  justify-content: space-around;
  gap: 10px;
}

/* Botones (compatibilidad por id) */
#btn-cancel,
#btn-confirm,
#cancel-btn,
#confirm-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
}

/* Colores por acción */
#btn-cancel,
#cancel-btn {
  background-color: #444;
  color: #f5f0e6;
}
#btn-cancel:hover,
#cancel-btn:hover {
  background: #555;
  box-shadow: 0 0 10px rgba(255,255,255,0.08);
}
#btn-confirm,
#confirm-btn {
  background-color: #00d2ff;
  color: #0b0b0b;
}
#btn-confirm:hover,
#confirm-btn:hover {
  background: #3ae0ff;
  box-shadow: 0 0 10px rgba(0,210,255,0.45);
}
#btn-cancel:active,
#cancel-btn:active,
#btn-confirm:active,
#confirm-btn:active {
  transform: scale(0.98);
}

/* Accesibilidad foco */
#btn-cancel:focus,
#cancel-btn:focus,
#btn-confirm:focus,
#confirm-btn:focus {
  outline: 2px solid #00d2ff;
  outline-offset: 2px;
}

/* Save toolbar */
.save-toolbar{
  display:flex; gap:8px; align-items:center; justify-content:center;
  margin:10px 0 16px;
}
.save-toolbar button{
  background:#2c2c2c; color:#f5f0e6; border:1px solid #333;
  border-radius:8px; padding:8px 12px; font-weight:800; cursor:pointer;
  transition:background .2s, color .2s, box-shadow .2s;
}
.save-toolbar button.active{
  background:#f39c12; color:#000; box-shadow:0 0 10px rgba(243,156,18,.35);
}
.save-toolbar button:disabled{ opacity:.5; cursor:not-allowed; }
.save-info{ font-size:12px; opacity:.85; }

/* Tamaño responsivo del logo */
:root {
  --logo-size: clamp(80px, 8vw, 140px); /* 80px en móvil → hasta 140px en desktop */
}

/* Si usas una tarjeta por equipo */
.team-card .team-logo {
  height: var(--logo-size);
  width: auto;                  /* respeta proporción */
  object-fit: contain;          /* evita recortes */
  image-rendering: auto;        /* nítido en hi-DPI */
}

/* Opcional: caja cuadrada para alinear y evitar saltos por proporciones distintas */
.team-logo-box {
  width: clamp(100px, 10vw, 160px);
  height: clamp(100px, 10vw, 160px);
  display: grid;
  place-items: center;
}
.team-logo-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Si notas la tarjeta muy comprimida, da algo de alto mínimo */
.team-card {
  min-height: calc(var(--logo-size) + 24px);
}

/* ==== Fix overflow: grid 100% responsive sin scroll horizontal ==== */
.grid-equipos {
  display: grid;
  /* de 1 a 4 columnas según espacio; cada tarjeta mínimo 200px */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  /* acolchado y contención para evitar “saltos” en los extremos */
  padding-inline: 12px;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Impide que el contenido interno fuerce la tarjeta a crecer */
.equipo-card { 
  min-width: 0; 
}

/* Por si algún título largo empuja el ancho */
.equipo-card h2,
.equipo-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* (opcional) última defensa: nunca permitir scroll horizontal en la página */
html, body { overflow-x: hidden; }

/* ===== Grid consistente: 1–4 columnas por breakpoint ===== */
.grid-equipos {
  display: grid;
  gap: 16px;
  padding-inline: 12px;
  margin: 0 auto;
  max-width: 1200px;
  box-sizing: border-box;

  /* móvil: 1 columna */
  grid-template-columns: 1fr;
}

/* ≥ 560px: 2 columnas */
@media (min-width: 560px) {
  .grid-equipos {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ≥ 840px: 3 columnas */
@media (min-width: 840px) {
  .grid-equipos {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ≥ 1100px: 4 columnas fijas (adiós fila con un solo ítem) */
@media (min-width: 1100px) {
  .grid-equipos {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* No permitir que el contenido empuje el ancho de su celda */
.equipo-card { min-width: 0; }

/* Títulos/descr. no rompen la rejilla si son largos */
.equipo-card h2,
.equipo-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* (opcional) defensa final contra desbordes subpíxel */
html, body { overflow-x: hidden; }




