/* Styles pour le composant des utilisateurs en ligne */
.online-users-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 2rem 0; /* padding uniquement en dessous */
    background: transparent; /* suppression de l'effet carte */
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    border: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.online-text {
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.online-avatars {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 100%;
    overflow-x: auto; /* évite de dépasser, autorise un léger scroll horizontal si besoin */
    overflow-y: visible;
    padding-right: 8px; /* garde le +X dans la carte */
    -ms-overflow-style: none; /* IE/Edge */
    scrollbar-width: none; /* Firefox */
}
.online-avatars::-webkit-scrollbar { /* Chrome/Safari */
    display: none;
}

/* Espacement quand il n'y a PAS de chevauchement (<= 10 utilisateurs) */
.online-avatars .online-avatar:not(.avatar-overlap) {
    margin-left: 4px;
}
.online-avatars .online-avatar:not(.avatar-overlap):first-child {
    margin-left: 0;
}

.online-avatar {
    position: relative;
    transition: all 0.3s ease;
    border-radius: 50%;
    border: 0; /* supprime l'anneau qui réduisait l'image à 20x20 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background: #fff;
    width: 24px !important;
    height: 24px !important;
    line-height: 0; /* évite l'espace de baseline sous l'image */
}

/* Neutralise la marge de .user-avatar (retourné par displayUserAvatarWithGrade)
   et force le remplissage complet du conteneur 24x24 */
.online-avatar .user-avatar {
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
}
.online-avatar .user-avatar img {
    width: 100% !important;
    height: 100% !important;
    display: block; /* supprime le décalage vertical */
    object-fit: cover;
    object-position: center center;
}

/* Supporte aussi le cas où un <img> est directement enfant de .online-avatar (rendu côté JS) */
.online-avatar > img {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
    object-position: center center;
}

.online-avatar:hover {
    transform: scale(1.1);
    z-index: 100 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Chevauchement des avatars quand il y a plus de 10 utilisateurs */
.online-avatar.avatar-overlap {
    margin-left: -8px;
}

.online-avatar.avatar-overlap:first-child {
    margin-left: 0;
}

/* Avatar pour indiquer qu'il y a plus d'utilisateurs */
.online-avatar.avatar-more {
    /* Couleur personnalisée demandée */
    background: #3c6091;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px !important;
    height: 24px !important;
    border: 0; /* le fond couvre toute la div (24x24) */
    border-radius: 50%;
    padding: 0;
}

.avatar-more-text {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .online-users-container {
        padding: 0 0 8px 0; /* garder un espace sous la liste */
        gap: 8px;
    }
    
    .online-text {
        font-size: 13px;
    }
    
    .online-avatar {
        width: 24px !important;
        height: 24px !important;
    }
    
    .online-avatar.avatar-overlap {
        margin-left: -6px;
    }
    
    .online-avatar.avatar-more {
        min-width: 24px;
        height: 24px;
    }
    
    .avatar-more-text {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .online-users-container {
        padding: 0 0 8px 0; /* garder un espace sous la liste */
        gap: 4px 8px;
        flex-wrap: wrap; /* permettre un retour à la ligne sous le libellé */
    }
    
    .online-text {
        font-size: 12px;
    }
    .online-avatars {
        width: 100%;
    }
    
    .online-avatar {
        width: 24px !important;
        height: 24px !important;
    }
    
    .online-avatar.avatar-overlap {
        margin-left: -4px;
    }
    
    .online-avatar.avatar-more {
        min-width: 24px;
        height: 24px;
    }
    
    .avatar-more-text {
        font-size: 10px;
    }
}

/* Animation d'apparition */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.online-users-container {
    animation: fadeInUp 0.3s ease-out;
}

/* Indicateur de statut en ligne (désactivé) */
.online-avatar::after {
    content: none !important;
    display: none !important;
}

.online-avatar.avatar-more::after {
    display: none;
}

/* Tooltip personnalisé */
.online-avatar[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.online-avatar[title]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: 1px;
}
