/* Layout principal - Mobile First */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Sección de descripción */
.description-section {
    flex: 1;
}

/* Sección de ranking - Sidebar en desktop */
.ranking-section {
    order: -1; /* Aparece primero en móvil */
}

.ranking-card {
    background: var(--color-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid rgba(100, 255, 218, 0.1);
    transition: all 0.3s ease;
}

.ranking-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-header h3 {
    color: var(--color-heading);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-hover), #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ranking-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.ranking-item:hover {
    background: rgba(100, 255, 218, 0.05);
    border-color: rgba(100, 255, 218, 0.2);
    transform: translateX(2px);
}

/* Estilos del podium minimalistas */
.podium-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.02));
    border-color: rgba(255, 215, 0, 0.2);
}

.podium-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.06), rgba(192, 192, 192, 0.02));
    border-color: rgba(192, 192, 192, 0.2);
}

.podium-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.06), rgba(205, 127, 50, 0.02));
    border-color: rgba(205, 127, 50, 0.2);
}

.rank-position {
    min-width: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.medal {
    font-size: 1.2rem;
    line-height: 1;
}

.rank-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-accent);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0; /* Para truncar texto si es necesario */
}

.mascot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(100, 255, 218, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.podium-1 .mascot-avatar {
    border-color: rgba(255, 215, 0, 0.5);
}

.podium-2 .mascot-avatar {
    border-color: rgba(192, 192, 192, 0.5);
}

.podium-3 .mascot-avatar {
    border-color: rgba(205, 127, 50, 0.5);
}

.student-details {
    flex: 1;
    min-width: 0;
}

.student-name {
    color: var(--color-heading);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-stats {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.75rem;
}

.score {
    color: var(--color-hover);
    font-weight: 600;
}

.time {
    color: var(--color-text);
    opacity: 0.7;
}

.ranking-footer {
    text-align: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-footer p {
    color: var(--color-hover);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
}

/* Tablet y Desktop */
@media (min-width: 768px) {
    .main-layout {
        flex-direction: row;
        gap: 2rem;
        align-items: flex-start;
    }

    .description-section {
        flex: 2;
    }

    .ranking-section {
        flex: 0 0 280px;
        order: 1; /* Va a la derecha en desktop */
        position: sticky;
        top: 1rem;
    }

    .ranking-card {
        padding: 1.5rem;
    }

    .ranking-header h3 {
        font-size: 1.2rem;
    }

    .student-name {
        font-size: 0.95rem;
    }

    .student-stats {
        font-size: 0.8rem;
    }
}

@media (min-width: 1024px) {
    .ranking-section {
        flex: 0 0 320px;
    }

    .ranking-item {
        padding: 1rem;
    }

    .mascot-avatar {
        width: 36px;
        height: 36px;
    }

    .medal {
        font-size: 1.3rem;
    }
}

/* Efectos hover mejorados */
.ranking-item:hover .mascot-avatar {
    transform: scale(1.1);
    border-width: 3px;
}

.ranking-item:hover .student-name {
    color: var(--color-hover);
}

/* Animación sutil para medallas */
@keyframes gentle-glow {
    0%, 100% {
        filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
    }
}

.podium-1 .medal {
    animation: gentle-glow 3s ease-in-out infinite;
}

/* Scroll suave para el ranking en móvil */
@media (max-width: 767px) {
    .ranking-container {
        max-height: 300px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(100, 255, 218, 0.3) transparent;
    }

    .ranking-container::-webkit-scrollbar {
        width: 4px;
    }

    .ranking-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .ranking-container::-webkit-scrollbar-thumb {
        background: rgba(100, 255, 218, 0.3);
        border-radius: 2px;
    }
}
