/**
 * Styles pour l'affichage utilisateur unifié
 * Composant réutilisable pour toutes les pages
 */

/* Section utilisateur dans la navigation */
.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    /* background: rgba(255, 255, 255, 0.1); */
    border-radius: 25px;
    /* border: 1px solid rgba(255, 255, 255, 0.2); */
    transition: all 0.3s ease;
    position: relative;
}

.user-section:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Avatar utilisateur */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Détails utilisateur */
.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 400;
}

/* Menu utilisateur */
.user-menu {
    position: relative;
}

.user-menu-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-menu-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Dropdown menu */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

/* Items du dropdown */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: #1e3a8a;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: #6b7280;
}

.dropdown-item:hover i {
    color: #1e3a8a;
}

/* Divider */
.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

/* Boutons de connexion/inscription */
.nav-item.cta {
    margin-left: 10px;
}

.nav-item.cta .nav-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item.cta .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.nav-item.cta.login .nav-link {
    color: white;
}

.nav-item.cta.signup .nav-link {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    border-color: #1e3a8a;
    color: white;
}

.nav-item.cta.signup .nav-link:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #3b82f6;
}

/* Responsive */
@media (max-width: 991.98px) {
    .user-section {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .user-name {
        font-size: 13px;
        max-width: 120px;
    }
    
    .user-role {
        font-size: 11px;
    }
    
    .user-dropdown {
        min-width: 200px;
    }
}

@media (max-width: 767.98px) {
    .user-section {
        padding: 4px 8px;
        gap: 6px;
        justify-content: space-between;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 11px;
    }
    
    .user-name {
        font-size: 12px;
        max-width: 100px;
    }
    
    .user-role {
        font-size: 10px;
    }
    
    .user-details {
        display: block; /* Masquer les détails sur mobile pour économiser l'espace */
    }
    
    .user-dropdown {
        right: -10px;
        min-width: 180px;
    }
}

/* Animation d'apparition */
.user-section {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Indicateur de connexion */
.user-section::after {
    /* content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite; */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Styles pour les pages sans navigation (comme cancel-subscription) */
.user-display-standalone {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 12px 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 250px;
}

.user-display-standalone .user-avatar {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    width: 35px;
    height: 35px;
    font-size: 12px;
}

.user-display-standalone .user-name {
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 600;
}

.user-display-standalone .user-role {
    color: #6b7280;
    font-size: 11px;
}

.user-display-standalone .user-section {
    background: none;
    border: none;
    padding: 0;
    gap: 10px;
}

.user-display-standalone .user-section:hover {
    background: none;
    transform: none;
}

.user-display-standalone .user-section::after {
    display: none;
}

@media (max-width: 767.98px) {
    .user-display-standalone {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        max-width: 200px;
    }
    
    .user-display-standalone .user-details {
        display: none;
    }
}
