/* =========================================
   CLASSEMENT (Leaderboard)
   ========================================= */

/* Réglage de base de la page */
.leaderboard-page {
    width: 100%;
    max-width: 900px;
    margin: 90px auto 50px; /* Espace pour la navbar fixe */
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
    min-height: 60vh;
}

/* En-tête de la page */
.leaderboard-header h1 {
    font-size: 2.5rem;
    color: #272a49;
    margin-bottom: 10px;
    font-weight: 800;
}

.leaderboard-header p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Conteneur principal */
.leaderboard-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid #eee;
}

/* Tableau */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table th {
    background-color: #f8f9fa;
    color: #272a49;
    font-weight: bold;
    padding: 18px 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-bottom: 2px solid #eee;
}

.leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    color: #333;
    font-family: Arial, sans-serif;
}

.leaderboard-row:last-child td {
    border-bottom: none;
}

.leaderboard-row:hover {
    background-color: #fafafa;
}

/* --- Colonne RANG --- */
.rank-col {
    width: 15%;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.rank-1 { color: #FFD700; font-size: 1.4rem; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.rank-2 { color: #C0C0C0; font-size: 1.3rem; }
.rank-3 { color: #CD7F32; font-size: 1.3rem; }
.rank-other { color: #888; font-size: 1rem; }

/* --- Colonne UTILISATEUR --- */
.user-col {
    width: 45%;
}

.user-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 12px;
    transition: transform 0.2s ease;
}

.user-link:hover {
    transform: translateX(5px);
}

.user-link:hover .user-pseudo {
    color: #ff3c00;
    text-decoration: underline;
}

.leaderboard-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.user-pseudo {
    font-weight: bold;
    font-size: 1rem;
}

/* --- Colonne NIVEAU --- */
.level-col {
    width: 20%;
    text-align: center;
}

.level-badge-mini {
    background-color: #fff3e0;
    color: #e65100;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    border: 1px solid #ffe0b2;
}

/* --- Colonne XP --- */
.xp-col {
    width: 20%;
    text-align: right;
    padding-right: 25px !important;
    font-size: 1.1rem;
    color: #272a49;
}

/* Highlight du Top 3 */
.leaderboard-row.top-3 {
    background-color: #fffdf5; /* Fond très léger jaune pour les premiers */
}

/* Etats de chargement et vide */
.loading-spinner, .empty-state {
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
}

.error-msg {
    color: red;
    padding: 20px;
}

/* --- NOUVEAU : Wrapper pour le bouton de contrôle --- */
.leaderboard-controls-wrapper {
    display: flex;
    justify-content: center;
    margin: 15px 0 25px;
}

.leaderboard-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    background: white;
    padding: 10px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.leaderboard-controls:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    border-color: #ff3c00;
}

#lb-mode-text {
    font-weight: 700;
    color: #ff3c00;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lb-arrow-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #272a49;
}

/* Animation douce pour le changement */
.leaderboard-table tbody tr {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   RESPONSIVE MOBILE
   ========================================= */
@media screen and (max-width: 600px) {
    .leaderboard-page {
        margin-top: 80px; /* Plus d'espace navbar */
        padding: 10px;
    }

    .leaderboard-header h1 {
        font-size: 1.8rem;
    }

    .leaderboard-table th, 
    .leaderboard-table td {
        padding: 10px 5px;
    }

    /* On cache le texte "Niv." pour gagner de la place */
    .level-badge-mini {
        font-size: 0.8rem;
        padding: 2px 6px;
    }

    /* Réduction avatar */
    .leaderboard-avatar {
        width: 35px;
        height: 35px;
    }

    .rank-col { width: 15%; font-size: 1rem; }
    .user-col { width: 50%; }
    .level-col { width: 15%; }
    .xp-col { width: 20%; font-size: 0.9rem; padding-right: 10px !important;}
    
    .user-pseudo {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
}