/* ===== RANKING STYLES ===== */

/* Rank 1 - Gold */
.rank-item.gold {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border: 3px solid #ffd700;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}
.rank-item.gold::before {
    content: "👑";
    position: absolute;
    right: 15px;
    top: -10px;
    font-size: 40px;
    opacity: 0.3;
    transform: rotate(15deg);
}
.rank-item.gold .rank-number {
    color: #b8860b;
    font-size: 32px;
}
.rank-item.gold .student-name {
    color: #8b7500;
}
.rank-item.gold .score {
    color: #b8860b;
}

/* Rank 2 - Silver */
.rank-item.silver {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border: 3px solid #c0c0c0;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.3);
}
.rank-item.silver .rank-number {
    color: #8a8a8a;
    font-size: 30px;
}
.rank-item.silver .student-name {
    color: #666;
}
.rank-item.silver .score {
    color: #8a8a8a;
}

/* Rank 3 - Bronze */
.rank-item.bronze {
    background: linear-gradient(135deg, #fff3e0, #ffccbc);
    border: 3px solid #cd7f32;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.3);
}
.rank-item.bronze .rank-number {
    color: #a0522d;
    font-size: 28px;
}
.rank-item.bronze .student-name {
    color: #7b3f00;
}
.rank-item.bronze .score {
    color: #a0522d;
}

/* ===== HOVER EFFECT ===== */
.rank-item {
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}
.rank-item:hover {
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.rank-item.gold:hover {
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
    border-color: #ffd700;
}
.rank-item.silver:hover {
    box-shadow: 0 8px 30px rgba(192, 192, 192, 0.5);
    border-color: #c0c0c0;
}
.rank-item.bronze:hover {
    box-shadow: 0 8px 30px rgba(205, 127, 50, 0.5);
    border-color: #cd7f32;
}

/* ===== STUDENT AVATAR ===== */
.rank-avatar {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.rank-avatar:hover {
    transform: scale(1.1);
}
.student-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e2e8f0;
    transition: all 0.3s ease;
}
.rank-item.gold .student-avatar {
    border-color: #ffd700;
}
.rank-item.silver .student-avatar {
    border-color: #c0c0c0;
}
.rank-item.bronze .student-avatar {
    border-color: #cd7f32;
}
.student-avatar-placeholder {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #4a5568;
    border: 3px solid #e2e8f0;
    transition: all 0.3s ease;
}
.rank-item.gold .student-avatar-placeholder {
    background: #ffd700;
    color: #8b7500;
    border-color: #ffd700;
}
.rank-item.silver .student-avatar-placeholder {
    background: #c0c0c0;
    color: #666;
    border-color: #c0c0c0;
}
.rank-item.bronze .student-avatar-placeholder {
    background: #cd7f32;
    color: #5c3a1a;
    border-color: #cd7f32;
}

/* ===== RANK NUMBER STYLES ===== */
.rank-number {
    font-size: 28px;
    font-weight: 800;
    color: #4a5568;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}
.rank-item:hover .rank-number {
    transform: scale(1.2);
}

/* ===== SCORE STYLES ===== */
.rank-score .score {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: #2d3748;
    transition: all 0.3s ease;
}
.rank-item:hover .score {
    transform: scale(1.1);
}

/* ===== IMAGE POPUP (Lightbox) ===== */
.image-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}
.image-popup.active {
    display: flex;
}
.image-popup img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}
.image-popup .close-popup {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 50px;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.image-popup .close-popup:hover {
    transform: rotate(90deg);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== RANK BADGE ===== */
.rank-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rank-badge.gold {
    background: #ffd700;
    color: #8b7500;
}
.rank-badge.silver {
    background: #c0c0c0;
    color: #666;
}
.rank-badge.bronze {
    background: #cd7f32;
    color: #5c3a1a;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
    .rank-item.gold::before {
        font-size: 30px;
        right: 10px;
        top: -5px;
    }
    .rank-number {
        font-size: 22px;
        min-width: 40px;
    }
    .student-avatar {
        width: 45px;
        height: 45px;
    }
    .student-avatar-placeholder {
        width: 45px;
        height: 45px;
        font-size: 22px;
    }
    .rank-score .score {
        font-size: 22px;
    }
    .rank-item:hover {
        transform: translateX(4px) scale(1.01);
    }
}