/* ===== EQUIPOS — Composición de Equipos (cards) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #1a1a2e;
  color: #fff;
  font-family: 'Inter', Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

/* ===== Título ===== */
.page-title {
  font-size: clamp(18px, 3.5vw, 28px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #e0e0e0;
  margin-bottom: 24px;
  text-align: center;
}

/* ===== Grid de tarjetas ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1300px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding: 4px;
}

/* Scrollbar */
.cards-grid::-webkit-scrollbar { width: 6px; }
.cards-grid::-webkit-scrollbar-track { background: #1a1a2e; }
.cards-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.cards-grid::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }

/* ===== Tarjeta de equipo ===== */
.team-card {
  background: #232337;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  transition: transform .15s ease, box-shadow .15s ease;
}

.team-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}

/* Número de equipo */
.team-number {
  font-size: 36px;
  font-weight: 900;
  color: #e8942d;
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255,255,255,.08);
  position: relative;
}

.team-number span {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 2px;
}

/* Punto de color del equipo */
.team-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  position: absolute;
  top: 4px;
  right: 4px;
  border: 2px solid rgba(255,255,255,.2);
  box-shadow: 0 0 8px rgba(0,0,0,.3);
}

/* ===== Grupo label ===== */
.group-section {
  margin-top: 14px;
}

.group-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

.group-label.g1 {
  color: #fff;
  background: linear-gradient(90deg, #1a5276, #2471a3);
}

.group-label.g2 {
  color: #fff;
  background: linear-gradient(90deg, #2e6ea0, #3b8ac4);
}

/* ===== Nombre de piloto ===== */
.pilot-name {
  font-size: 14px;
  font-weight: 600;
  padding: 5px 0 5px 10px;
  color: #ddd;
  border-left: 3px solid transparent;
  transition: color .15s;
  text-transform: uppercase;
}

.pilot-name.g1   { border-left-color: #2471a3; }
.pilot-name.g2   { border-left-color: #3b8ac4; }

.pilot-name:hover { color: #fff; }

/* ===== Timestamp ===== */
.timestamp {
  margin-top: 18px;
  font-size: 12px;
  color: #666;
  text-align: center;
}

/* ===== Live dot ===== */
.live-dot {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e74c3c;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.8); }
}

/* ===== Estado vacío ===== */
.empty-msg {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #888;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body { padding: 12px 8px; }
  .cards-grid { grid-template-columns: 1fr; gap: 14px; }
  .team-card { padding: 16px; }
}

/* ===== Botón Inicio ===== */
.home-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  background: #16213e;
  color: #a0c4ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-decoration: none;
  z-index: 100;
  transition: all .2s ease;
}
.home-btn:hover {
  background: #1a3a5c;
  border-color: rgba(160,196,255,.4);
  color: #fff;
}

/* ===== Botón descarga CSV (admin) ===== */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  background: #16213e;
  color: #a0c4ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s ease;
}
.download-btn:hover {
  background: #1a3a5c;
  border-color: rgba(160,196,255,.4);
  color: #fff;
}

/* ===== Interruptor de visibilidad (solo admin) ===== */
.admin-visibility {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: 640px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
}
.admin-visibility .av-label {
  font-size: 13px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.admin-visibility .av-state {
  font-size: 13px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
}
.admin-visibility .av-state.on  { background: rgba(39,174,96,.18); color: #2ecc71; }
.admin-visibility .av-state.off { background: rgba(231,76,60,.18);  color: #e74c3c; }
.admin-visibility .av-toggle {
  background: #2980b9;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.admin-visibility .av-toggle:hover { background: #3a92cc; }

/* ===================== MODO CLARO ===================== */
:root[data-theme="light"] body { background: #eef1f6; color: #1f2733; }
:root[data-theme="light"] .page-title { color: #24303f; }
:root[data-theme="light"] .cards-grid::-webkit-scrollbar-track { background: #e2e6ee; }
:root[data-theme="light"] .cards-grid::-webkit-scrollbar-thumb { background: rgba(0,0,0,.22); }
:root[data-theme="light"] .team-card {
  background: #ffffff; box-shadow: 0 8px 24px rgba(20,30,50,.10);
}
:root[data-theme="light"] .team-number { border-bottom-color: rgba(0,0,0,.10); }
:root[data-theme="light"] .team-number span { color: #7a828f; }
:root[data-theme="light"] .team-color-dot { border-color: rgba(0,0,0,.15); }
:root[data-theme="light"] .pilot-name { color: #2b3442; }
:root[data-theme="light"] .pilot-name:hover { color: #0b0f16; }
:root[data-theme="light"] .timestamp { color: #8b93a1; }
:root[data-theme="light"] .home-btn { background: #ffffff; color: #5a6472; border-color: rgba(0,0,0,.12); }
:root[data-theme="light"] .home-btn:hover { background: #2e6ea0; color: #fff; }
:root[data-theme="light"] .download-btn { background: #ffffff; color: #2b3442; border-color: rgba(0,0,0,.12); }
:root[data-theme="light"] .download-btn:hover { background: #2e6ea0; color: #fff; }
