/**
 * Avatar System Styles
 * Système d'avatar avec photo utilisateur et indicateur de présence en ligne
 */

/* Container principal de l'avatar */
.mgs-avatar-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Avatar de base */
.mgs-avatar {
    position: relative;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Avatar par défaut (sans photo) */
.mgs-avatar-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* Effet hover sur l'avatar */
.mgs-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Indicateur de statut en ligne/hors ligne */
.mgs-avatar-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 2;
    transition: all 0.3s ease;
}

/* Statut en ligne (vert) */
.mgs-avatar-status.online {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 8px rgba(76, 175, 80, 0.6);
    animation: pulse-online 2s ease-in-out infinite;
}

/* Statut hors ligne (gris) */
.mgs-avatar-status.offline {
    background: #bdbdbd;
}

/* Animation de pulsation pour le statut en ligne */
@keyframes pulse-online {
    0%, 100% {
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 8px rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 12px rgba(76, 175, 80, 0.8);
    }
}

/* Tailles prédéfinies d'avatars */
.mgs-avatar-xs {
    width: 24px;
    height: 24px;
}

.mgs-avatar-xs .mgs-avatar-status {
    width: 8px;
    height: 8px;
    border-width: 2px;
}

.mgs-avatar-sm {
    width: 32px;
    height: 32px;
}

.mgs-avatar-sm .mgs-avatar-status {
    width: 10px;
    height: 10px;
    border-width: 2px;
}

.mgs-avatar-md {
    width: 40px;
    height: 40px;
}

.mgs-avatar-lg {
    width: 60px;
    height: 60px;
}

.mgs-avatar-lg .mgs-avatar-status {
    width: 16px;
    height: 16px;
    border-width: 3px;
}

.mgs-avatar-xl {
    width: 96px;
    height: 96px;
}

.mgs-avatar-xl .mgs-avatar-status {
    width: 20px;
    height: 20px;
    border-width: 3px;
}

/* Avatar dans la navbar */
.navbar .mgs-avatar-container {
    cursor: pointer;
}

.navbar .mgs-avatar {
    border-width: 2px;
}

/* Avatar dans le dropdown menu */
.dropdown-toggle .mgs-avatar-container {
    margin-right: 0;
}

/* Avatar dans le modal de login */
.modal-header .mgs-avatar-container .mgs-avatar {
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Avatar en mode liste/commentaires */
.comment-avatar,
.user-list-avatar {
    display: inline-flex;
    margin-right: 12px;
}

.comment-avatar .mgs-avatar {
    width: 44px;
    height: 44px;
}

/* Avatar dans le profil utilisateur */
.profile-avatar-container .mgs-avatar {
    width: 96px;
    height: 96px;
    border: 3px solid #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .mgs-avatar-container .mgs-avatar {
        width: 36px;
        height: 36px;
    }
    
    .mgs-avatar-status {
        width: 10px;
        height: 10px;
        border-width: 2px;
    }
}

/* Badge de notification sur avatar */
.mgs-avatar-container .notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Groupement d'avatars (pile) */
.mgs-avatar-group {
    display: inline-flex;
    flex-direction: row-reverse;
    padding-left: 12px;
}

.mgs-avatar-group .mgs-avatar-container {
    margin-left: -12px;
    transition: transform 0.2s ease;
}

.mgs-avatar-group .mgs-avatar-container:hover {
    transform: translateY(-4px);
    z-index: 10;
}

.mgs-avatar-group .mgs-avatar {
    border-width: 3px;
}

/* États de l'avatar */
.mgs-avatar.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.mgs-avatar.error {
    background: #ff5252;
    color: #fff;
}

/* Avatar avec bordure colorée selon le statut */
.mgs-avatar-container.status-vip .mgs-avatar {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.mgs-avatar-container.status-admin .mgs-avatar {
    border-color: #ff3b30;
    box-shadow: 0 0 12px rgba(255, 59, 48, 0.5);
}

.mgs-avatar-container.status-verified .mgs-avatar {
    border-color: #4CAF50;
}

/* Badge de vérification */
.mgs-avatar-container .verified-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 10px;
    color: #fff;
}
