/* Configuración de sección */
.clasificaciones-section {
  padding: 5rem 2rem;
  max-width: 1400px;
  margin: auto;
  text-align: center;
}

.clasificaciones-title {
  text-align: center;
  font-family: 'Anton', sans-serif;
  color: var(--gold);
  font-size: 2.3rem;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  text-shadow: none;
}

.equipos-subtitle {
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 2.5rem;
}

/* Grid de tarjetas */
.standings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 20px 0;
  max-width: 1200px;
  margin: 0 auto;
}

/* 🏆 TARJETA NUEVO DISEÑO (Blanca con franja roja) */
.standings-card {
  background-color: var(--bg-dark);/* Fondo blanco */
  border-radius: 20px 8px 8px 8px; /* Esquina superior izq más goldondeada */
  padding: 1.5rem 2rem;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  
  min-height: 180px; /* Altura consistente */
  position: relative; /* Necesario para los pseudo-elementos */
  overflow: hidden; /* Recorta el número gigante */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Sombra suave */
  border: 1px solid #333; 
  cursor: pointer;
}

/* Franja roja izquierda */
.standings-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  background-color: var(--gold); /* Usamos el rojo de styles.css */
  border-top-left-radius: 20px;
  border-bottom-left-radius: 8px;
}

/* Número grande de fondo (01, 02...) */
.standings-card::after {
  content: attr(data-number); /* Toma el valor del JS */
  position: absolute;
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  font-family: 'Anton', sans-serif;
  font-size: 130px;
  line-height: 1;
  color: var(--dark-grey); /* Gris muy claro */
  z-index: 0; /* Detrás del texto */
  pointer-events: none;
}

/* Contenido (debe estar encima del número de fondo) */
.card-content {
  position: relative;
  z-index: 1;
  text-align: left;
}

.team-title {
  font-family: 'Anton', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--gold); /* Texto oscuro */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.league-subtitle {
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  color: #888; /* Gris medio */
  font-weight: 500;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

/* Resumen de estadísticas en la tarjeta */
.stats-summary {
    display: flex;
    gap: 15px;
    align-items: baseline;
}

.stat-highlight {
    font-weight: 800;
    font-size: 1.2rem;
    color: #ccc;
}

.stat-secondary {
    font-weight: 600;
    color: #888;
    font-size: 1rem;
}

/* Footer "VER MÁS" */
.card-footer {
  margin-top: 1.5rem;
  margin-bottom: -0.75rem;
  text-align: right;
  color: var(--gold);
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.card-footer .arrow {
  margin-left: 8px;
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

/* Hover Effects */
.standings-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.standings-card:hover .card-footer .arrow {
  transform: translateX(5px);
}

/* Tarjeta Offline */
.standings-card.offline::before {
    background-color: #999;
}
.standings-card.offline .team-title {
    color: #777;
}
.standings-card.offline .stat-highlight {
    color: #999;
}
.standings-card.offline .card-footer {
    color: #999;
}


/* --- MODAL (Estilo Oscuro mantenido para contraste) --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.modal-content-container {
  background: var(--glass-bg2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 30px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}


.close-modal {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  line-height: 0.5;
  transition: color 0.3s;
}

.close-modal:hover {
  color: var(--gold);
}

/* --- TABLA DE POSICIONES (FIX DEFINITIVO) --- */

.full-standings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  color: #eeeeeeb4;
  font-family: 'Poppins', sans-serif;
  /* ESTA ES LA CLAVE: Fija el layout para que no baile */
  table-layout: fixed; 
}

/* Reglas generales para celdas */
.full-standings-table th,
.full-standings-table td {
  padding: 12px 8px; /* Padding lateral reducido para evitar desbordes */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  vertical-align: middle;
  white-space: nowrap; /* Evita que el texto salte de línea y deforme la altura */
  overflow: hidden;    /* Si algo es muy largo, se corta en lugar de romper la tabla */
  text-overflow: ellipsis; /* Pone "..." si el texto es muy largo */
}

/* --- ENCABEZADOS (TH) --- */
.full-standings-table th {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 1px;
}

/* --- DEFINICIÓN DE ANCHOS (TOTAL = 100%) --- */

/* 1. POS (Pequeña) */
.full-standings-table th:nth-child(1),
.full-standings-table td:nth-child(1) {
  width: 8%;         /* Ancho fijo porcentual */
  text-align: center;
  color: #666;
  font-weight: bold;
}

/* 2. EQUIPO (La más ancha) */
.full-standings-table th:nth-child(2),
.full-standings-table td:nth-child(2) {
  width: 52%;        /* Se lleva la mitad de la tabla */
  text-align: left;  /* Alineado a la izquierda */
  padding-left: 15px; /* Un poco de aire a la izquierda */
}

/* 3. PJ, V, D (Estadísticas) */
.full-standings-table th:nth-child(3), .full-standings-table td:nth-child(3),
.full-standings-table th:nth-child(4), .full-standings-table td:nth-child(4),
.full-standings-table th:nth-child(5), .full-standings-table td:nth-child(5) {
  width: 10%;        /* Repartimos el resto */
  text-align: center;
  color: #aaa;
}

/* 4. PTS (Destacada) */
.full-standings-table th:last-child,
.full-standings-table td:last-child {
  width: 10%;
  text-align: center;
  color: var(--gold);
  font-weight: 800;
  font-size: 1.1rem;
}

/* --- ESTILOS DE RESALTADO --- */

.full-standings-table tr.highlight-cvc {
  background-color: rgba(191, 154, 51, 0.15);
}

.full-standings-table tr.highlight-cvc td {
  color: var(--gold);
  font-weight: 700;
  border-bottom: 1px solid var(--gold);
}

/* Badge ajustado para no romper la línea */
.category-badge {
  background: var(--gold);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  margin-left: 8px;
  text-transform: uppercase;
  font-weight: 800;
  display: inline-block; 
  vertical-align: middle;
  position: relative;
  top: -1px; /* Pequeño ajuste visual */
}

.team-logo {
  width: 24px;         /* Tamaño discreto */
  height: 24px;
  object-fit: contain; /* Mantiene la proporción */
  vertical-align: middle;
  margin-right: 8px;   /* Espacio entre escudo y nombre */
  display: inline-block;
}

/* Ajuste para que el texto siga alineado */
.celda-equipo .nombre-texto {
  vertical-align: middle;
  display: inline-block;
}

/* Loading Spinner */
.loading-spinner {
    color: var(--gold);
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
    margin-top: 4rem;
}

/* --- TABLA DE POSICIONES (FIX DEFINITIVO) --- */
.full-standings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  color: #eeeeeeb4;
  font-family: 'Poppins', sans-serif;
  table-layout: fixed; /* Mantiene la estructura sólida */
}

/* ... (Tus estilos de th, td, anchos, etc. que ya tenías) ... */

/* AGREGA ESTO AL FINAL DEL TODO */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .full-standings-table {
    min-width: 600px; /* Ancho forzado para activar scroll */
  }
  .full-standings-table th, .full-standings-table td {
    padding: 8px 2px;
    font-size: 0.8rem;
  }
  .team-logo {
    width: 18px;
    height: 18px;
  }
  .category-badge {
    display: none; /* En móvil ocultamos el badge para limpiar, el color de fondo ya destaca */
  }
}

/* =========================================
   📱 MEJORA CLASIFICACIONES MÓVIL
   ========================================= */

@media (max-width: 768px) {
  
  /* 1. Grid de 2 Columnas */
  .standings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dividir en 2 */
    gap: 0.8rem; /* Espacio reducido */
    padding: 2rem 0rem;
  }

  /* 2. Tarjeta Compacta */
  .standings-card {
    min-height: 150px; /* Reducimos altura (antes 180px+) */
    padding: 1rem 0.8rem; /* Menos relleno para aprovechar espacio */
    border-radius: 12px 6px 6px 6px; /* Bordes proporcionales */
  }

  /* Ajuste de la franja roja lateral */
  .standings-card::before {
    width: 5px; /* Franja más fina */
    border-top-left-radius: 12px;
  }

  /* 3. Número Gigante de Fondo (01, 04...) */
  .standings-card::after {
    font-size: 5rem; /* Reducimos drásticamente (antes 130px) */
    right: -5px;
    bottom: -5px;
    top: auto; /* Lo anclamos abajo en vez de al centro */
    transform: none; /* Quitamos centrado vertical */
    opacity: 0.4; /* Un poco más sutil para no tapar texto */
  }

  /* 4. Textos */
  .team-title {
    font-size: 1.15rem; /* Nombre equipo ajustado */
    line-height: 1.2;
    margin-bottom: 0.3rem;
    white-space: normal; /* Permitir 2 líneas si es largo */
  }

  .league-subtitle {
    font-size: 0.6rem; /* Subtítulo muy pequeño */
    margin-bottom: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Cortar con "..." si es muy largo */
    display: block;
    max-width: 100%;
  }

  /* 5. Datos (Posición y Puntos) */
  .stats-summary {
    flex-direction: column; /* Apilar datos uno sobre otro */
    gap: 2px;
    position: relative;
    z-index: 2;
  }

  .stat-highlight {
    font-size: 0.85rem; /* POS: 4º grande */
  }

  .stat-secondary {
    font-size: 0.75rem; /* Puntos pequeño */
  }

  /* 6. Footer (Enlace "Ver más") */
  .card-footer {
    font-size: 0.7rem;
    margin-top: 1rem;
  }
  
  /* Truco: Cambiar texto largo por uno corto usando CSS */
  /* Ocultamos el texto original "Ver clasificación completa..." */
  .card-footer {
    visibility: hidden; 
    position: relative;
  }
  
  /* Ponemos uno nuevo más corto */
  .card-footer::after {
    visibility: visible;
    content: "Ver tabla →"; /* Texto corto */
    position: absolute;
    right: 0;
    bottom: 0;
    color: var(--gold);
    font-weight: bold;
  }
  .card-footer .arrow { display: none; } /* Ocultamos la flecha original */
}