/* ===== CLASIF_EQUIPOS — Clasificación por Equipos ===== */
@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: 20px;
  text-align: center;
}

/* ===== Botón descarga CSV (admin) ===== */
.download-row {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  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;
}

/* ===== Contenedor tabla ===== */
.table-wrapper {
  width: 100%;
  max-width: 1100px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
}

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

/* ===== Tabla ===== */
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

/* ===== Cabecera ===== */
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #16162b;
  padding: 12px 10px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  border-bottom: 2px solid rgba(255,255,255,.1);
  text-align: center;
  white-space: nowrap;
}

thead th:nth-child(2) { text-align: left; }

/* ===== Filas ===== */
tr { transition: background .15s ease; }
tr:hover { filter: brightness(1.12); }

/* ===== Celdas ===== */
td {
  padding: 10px 10px;
  font-size: clamp(13px, 2vw, 15px);
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.06);
  white-space: nowrap;
  text-align: center;
}

/* Posición */
td.pos {
  width: 48px;
  font-weight: 800;
  font-size: clamp(14px, 2.5vw, 18px);
}

/* Equipo */
td.equipo {
  text-align: left;
  font-weight: 800;
  font-size: clamp(14px, 2.5vw, 18px);
  padding-left: 14px;
}

/* Badge con el color del equipo en el número */
.equipo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-weight: 900;
  font-size: clamp(14px, 2.5vw, 18px);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

/* Puntos */
td.pts {
  font-weight: 700;
  font-size: clamp(13px, 2vw, 16px);
}

td.total {
  font-weight: 900;
  font-size: clamp(14px, 2.5vw, 18px);
  color: #e8942d;
}

/* Pilotos */
td.pilotos {
  text-align: left;
  font-size: clamp(11px, 1.6vw, 13px);
  font-weight: 500;
  color: #aaa;
  white-space: normal;
  max-width: 400px;
  line-height: 1.5;
  text-transform: uppercase;
}

/* ===== Podio: top 3 ===== */
tr.top1 { background: linear-gradient(90deg, #c87a1a 0%, #e8942d 50%, #d4851f 100%); }
tr.top1 td { color: #fff; }
tr.top1 td.total { color: #fff; }
tr.top1 td.pilotos { color: rgba(255,255,255,.8); }

tr.top2 { background: linear-gradient(90deg, #1a5276 0%, #2471a3 50%, #1a5276 100%); }
tr.top2 td { color: #fff; }
tr.top2 td.total { color: #fff; }
tr.top2 td.pilotos { color: rgba(255,255,255,.8); }

tr.top3 { background: linear-gradient(90deg, #2e6ea0 0%, #3b8ac4 50%, #2e6ea0 100%); }
tr.top3 td { color: #fff; }
tr.top3 td.total { color: #fff; }
tr.top3 td.pilotos { color: rgba(255,255,255,.8); }

/* ===== Resto filas ===== */
tr.normal:nth-child(odd)  { background: #2a2a3e; }
tr.normal:nth-child(even) { background: #232337; }

/* ===== Timestamp ===== */
.timestamp {
  margin-top: 14px;
  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; }
  td { padding: 8px 6px; }
}

/* ===== 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;
}

/* ===================== MODO CLARO (base) ===================== */
:root[data-theme="light"] body { background: #eef1f6; color: #1f2733; }
:root[data-theme="light"] .home-btn { background: rgba(0,0,0,.06); color: #24303f; border-color: rgba(0,0,0,.12); }
:root[data-theme="light"] .home-btn:hover { background: rgba(0,0,0,.12); color: #14202c; }
:root[data-theme="light"] .page-title { color: #24303f; }
:root[data-theme="light"] .page-sub,
:root[data-theme="light"] .subtitle,
:root[data-theme="light"] .section-head p,
:root[data-theme="light"] .muted,
:root[data-theme="light"] .hint,
:root[data-theme="light"] label,
:root[data-theme="light"] .field-lbl { color: #5a6472; }
:root[data-theme="light"] .card,
:root[data-theme="light"] .tool-card,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .admin-panel,
:root[data-theme="light"] .box,
:root[data-theme="light"] .chip { background: #ffffff; border-color: rgba(0,0,0,.10); color: #1f2733; }
:root[data-theme="light"] input[type=text],
:root[data-theme="light"] input[type=number],
:root[data-theme="light"] input[type=search],
:root[data-theme="light"] select,
:root[data-theme="light"] input[type=file],
:root[data-theme="light"] textarea { background: #ffffff; color: #1f2733; border-color: rgba(0,0,0,.18); }
:root[data-theme="light"] .table-wrapper { box-shadow: 0 8px 26px rgba(20,30,50,.10); }
:root[data-theme="light"] .table-wrapper::-webkit-scrollbar-track { background: #e2e6ee; }
:root[data-theme="light"] .table-wrapper::-webkit-scrollbar-thumb { background: rgba(0,0,0,.22); }
:root[data-theme="light"] thead th { background: #e7ebf3; color: #5a6472; border-bottom-color: rgba(0,0,0,.14); }
:root[data-theme="light"] tr.normal:nth-child(odd)  { background: #ffffff; }
:root[data-theme="light"] tr.normal:nth-child(even) { background: #f4f6fa; }
:root[data-theme="light"] tr.normal td { color: #24303f; border-bottom-color: rgba(0,0,0,.06); }
/* Superficies específicas */
: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; }
