/* ========================================
   ESTADÍSTICAS EN HOME (INDEX.HTML)
   ======================================== */

/* GRID PRINCIPAL */
.stats-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* TARJETAS DE ESTADÍSTICAS */
.stat-home-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
}

.stat-home-card:hover {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.1);
    transform: translateY(-5px);
}

.stat-home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
}

.stat-home-header h3 {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-home-header h3 i {
    color: #D4AF37;
}

.stat-badge {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #D4AF37;
    color: #D4AF37;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* LOADING MINI */
.loading-mini {
    text-align: center;
    padding: 40px 20px;
}

.loader-mini {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #D4AF37;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-mini p {
    color: #888;
    font-size: 0.9rem;
}

/* ========================================
   TABLA DE POSICIONES MINI
   ======================================== */
.tabla-mini-container {
    overflow-x: auto;
}

.tabla-mini {
    width: 100%;
    border-collapse: collapse;
}

.tabla-mini thead {
    background: linear-gradient(135deg, #D4AF37, #FFD700);
}

.tabla-mini thead th {
    padding: 12px 10px;
    text-align: center;
    font-weight: 700;
    color: #000;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.tabla-mini tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.tabla-mini tbody tr:hover {
    background: rgba(212, 175, 55, 0.1);
}

.tabla-mini tbody td {
    padding: 15px 10px;
    text-align: center;
    color: #fff;
    font-size: 0.95rem;
}

.tabla-mini tbody td:first-child {
    font-weight: 700;
    color: #D4AF37;
    font-size: 1.1rem;
}

.tabla-mini tbody td:nth-child(2) {
    text-align: left;
    font-weight: 600;
}

.tabla-mini tbody td:last-child {
    font-weight: 700;
    color: #FFD700;
    font-size: 1.1rem;
}

.tabla-mini tbody tr:nth-child(1) td:first-child::before {
    content: "🥇 ";
}

.tabla-mini tbody tr:nth-child(2) td:first-child::before {
    content: "🥈 ";
}

.tabla-mini tbody tr:nth-child(3) td:first-child::before {
    content: "🥉 ";
}

/* ========================================
   TOP MINI (GOLEADORES / ASISTIDORES)
   ======================================== */
.top-mini-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.top-mini-item:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateX(5px);
}

.top-mini-pos {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.top-mini-foto {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #D4AF37;
    background: rgba(212, 175, 55, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-mini-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-mini-foto-placeholder {
    font-size: 1.8rem;
}

.top-mini-info {
    flex: 1;
}

.top-mini-nombre {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 3px;
}

.top-mini-equipo {
    color: #888;
    font-size: 0.85rem;
}

.top-mini-stat {
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ========================================
   TOP PLAYERS (RANKING)
   ======================================== */
.top-players-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Scrollbar personalizado */
.top-players-container::-webkit-scrollbar {
    width: 6px;
}

.top-players-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.top-players-container::-webkit-scrollbar-thumb {
    background: #D4AF37;
    border-radius: 10px;
}

.top-player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.top-player-item:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateX(5px);
}

.top-player-pos {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.top-player-info {
    flex: 1;
}

.top-player-nombre {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.top-player-equipo {
    color: #888;
    font-size: 0.8rem;
}

.top-player-stats {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
}

.top-player-stats span {
    color: #D4AF37;
}

.top-player-puntos {
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Destacar Top 3 */
.top-player-item:nth-child(1) .top-player-pos {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.top-player-item:nth-child(2) .top-player-pos {
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.5);
}

.top-player-item:nth-child(3) .top-player-pos {
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.5);
}

/* ========================================
   RANKING DE EQUIPOS
   ======================================== */
.ranking-equipos-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 40px;
}

.ranking-equipos-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.ranking-equipo-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ranking-equipo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #D4AF37, #FFD700);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.ranking-equipo-card:hover {
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.2);
}

.ranking-equipo-card:hover::before {
    transform: scaleX(1);
}

.ranking-equipo-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.ranking-equipo-pos {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ranking-equipo-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #D4AF37;
    background: rgba(212, 175, 55, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ranking-equipo-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-equipo-logo-placeholder {
    font-size: 2rem;
}

.ranking-equipo-info {
    flex: 1;
}

.ranking-equipo-nombre {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.ranking-equipo-comuna {
    color: #888;
    font-size: 0.85rem;
}

.ranking-equipo-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.ranking-stat-item {
    text-align: center;
    padding: 10px;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 8px;
}

.ranking-stat-value {
    color: #D4AF37;
    font-weight: 700;
    font-size: 1.3rem;
    display: block;
}

.ranking-stat-label {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-top: 3px;
}

.ranking-equipo-score {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.ranking-score-label {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.ranking-score-value {
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    color: #000;
    font-weight: 700;
    font-size: 1.5rem;
    padding: 10px;
    border-radius: 8px;
    display: inline-block;
}

/* Medallas para Top 3 */
.ranking-equipo-card:nth-child(1) .ranking-equipo-pos {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.ranking-equipo-card:nth-child(2) .ranking-equipo-pos {
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.6);
}

.ranking-equipo-card:nth-child(3) .ranking-equipo-pos {
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.6);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .stats-home-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-home-header h3 {
        font-size: 1.1rem;
    }
    
    .ranking-equipos-container {
        grid-template-columns: 1fr;
    }
    
    .tabla-mini thead th,
    .tabla-mini tbody td {
        padding: 10px 5px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stat-home-card {
        padding: 20px 15px;
    }
    
    .top-mini-item {
        padding: 12px;
    }
    
    .ranking-equipo-card {
        padding: 15px;
    }
    
    .ranking-equipo-stats {
        grid-template-columns: 1fr;
    }
}
