/* ========================
   LAYOUT GENERAL
   ======================== */
.stats-container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
}

.stats-header {
    text-align: center;
    margin-bottom: 40px;
}
.stats-header h1 { color: #1a237e; margin-bottom: 5px; font-size: 2.5em; }
.stats-header p { color: #666; font-size: 1.1em; }

/* ========================
   TARJETAS KPI (TOP)
   ======================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #eee;
    transition: transform 0.2s;
}

.kpi-card:hover { transform: translateY(-3px); }

.kpi-icon {
    font-size: 2.5em;
    color: #c5cae9;
}

.kpi-card.featured .kpi-icon { color: #303f9f; } /* Destacado */

.kpi-data h3 { margin: 0; font-size: 2em; color: #1a237e; }
.kpi-data span { color: #777; font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px; }

/* ========================
   PODIO (GOLD, SILVER, BRONZE)
   ======================= */
.podium-section {
    text-align: center;
    margin-bottom: 60px;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Alinear al piso */
    gap: 15px;
    height: 350px; /* Altura máxima del podio */
}

.podium-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
}

.podium-bar {
    width: 100%;
    background: #eee;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10px;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.podium-info {
    margin-top: 10px;
    font-size: 0.9em;
    line-height: 1.2;
}
.podium-info a { color: #333; text-decoration: none; font-weight: 600; }

/* Alturas y Colores */
.gold .podium-bar { height: 200px; background: linear-gradient(to bottom, #FFD700, #FDB931); }
.silver .podium-bar { height: 150px; background: linear-gradient(to bottom, #E0E0E0, #BDBDBD); }
.bronze .podium-bar { height: 110px; background: linear-gradient(to bottom, #CD7F32, #A0522D); }

.gold .crown, .silver .medal, .bronze .medal { font-size: 2.5em; margin-bottom: 10px; }

/* ========================
   GRID DE DETALLES
   ======================= */
.details-grid {
    display: grid;
    grid-template-columns: 3fr 2fr; /* 60% Carreras, 40% Hoy */
    gap: 30px;
    margin-bottom: 50px;
}

.panel {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.panel h3 { border-bottom: 2px solid #f0f0f0; padding-bottom: 15px; margin-top: 0; color: #333; }

/* Ranking Carreras */
.carrera-list { list-style: none; padding: 0; margin: 0; }
.carrera-list li { margin-bottom: 15px; }

.carrera-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.95em;
}
.rank { font-weight: bold; color: #aaa; width: 30px; }
.name { flex-grow: 1; font-weight: 600; }
.score { font-weight: bold; color: #1a237e; }

.progress-bg { background: #f0f0f0; height: 8px; border-radius: 4px; overflow: hidden; }
.progress-fill { background: #303f9f; height: 100%; border-radius: 4px; }

/* Ranking Hoy */
.today-list { list-style: none; padding: 0; }
.today-list li {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #f9f9f9;
}
.today-rank {
    background: #e8eaf6;
    color: #303f9f;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.today-info { display: flex; flex-direction: column; }
.today-info a { color: #333; font-weight: 600; text-decoration: none; }
.today-info small { color: #2ecc71; font-weight: bold; } /* Verde para subida */

/* ========================
   TABLA RESPONSIVA
   ======================= */
.stats-table { width: 100%; border-collapse: collapse; margin-top: 10px; background: white; }
.stats-table th, .stats-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
.stats-table th { background: #f9f9f9; color: #666; }
.stats-table tr:hover { background: #fcfcfc; }
.stats-table a { color: #303f9f; text-decoration: none; }

/* ========================
   MOBILE
   ======================= */
@media (max-width: 768px) {
    .details-grid { grid-template-columns: 1fr; }
    .podium-container { align-items: center; flex-direction: column; height: auto; }
    .podium-step { width: 100%; flex-direction: row; margin-bottom: 10px; background: #f9f9f9; padding: 10px; border-radius: 8px; }
    .podium-bar { width: 60px; height: 40px !important; border-radius: 5px; margin-right: 15px; align-items: center; padding: 0; }
    .crown, .medal { font-size: 1.5em; margin: 0 10px 0 0; }
}