/* ===== USER-AUTH.CSS - STYLES AUTHENTIFICATION CRYPTOTRADERS PRO ===== */

/* ===== VARIABLES SPÉCIFIQUES AUTH ===== */
:root {
    --auth-primary: #00ff88;
    --auth-secondary: #00ccff;
    --auth-danger: #ff4757;
    --auth-warning: #ffa502;
    --auth-success: #2ed573;
    
    --auth-bg: rgba(0, 255, 136, 0.1);
    --auth-border: rgba(0, 255, 136, 0.2);
    --auth-hover: rgba(0, 255, 136, 0.15);
    --auth-glow: 0 0 20px rgba(0, 255, 136, 0.3);
}

/* ===== BOUTONS D'AUTHENTIFICATION ===== */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.auth-buttons .btn {
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    min-width: 120px;
    height: 45px;
    border-radius: 25px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-buttons .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.auth-buttons .btn:hover::before {
    left: 100%;
}

.auth-buttons .btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--auth-glow);
}

/* ===== MENU UTILISATEUR PRINCIPAL ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    min-width: 200px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--auth-border);
    background: var(--auth-bg);
}

.user-menu:hover {
    background: var(--auth-hover);
    transform: translateY(-2px);
    box-shadow: var(--auth-glow);
    border-color: var(--auth-primary);
}

/* ===== AVATAR UTILISATEUR COSMIQUE ===== */
.user-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    /* Tailles gérées par firebase/roles.css - règles globales */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000011;
    position: relative;
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.5);
}

.avatar-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid var(--auth-primary);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.4s ease;
    animation: avatarPulse 3s ease-in-out infinite;
}

.user-menu:hover .avatar-ring {
    opacity: 1;
    transform: scale(1.2);
    animation-play-state: paused;
}

@keyframes avatarPulse {
    0%, 100% { 
        opacity: 0; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.6; 
        transform: scale(1.15);
    }
}

/* ===== INFORMATIONS UTILISATEUR ===== */
.user-info {
    flex: 1;
    position: relative;
    transition: all 0.3s ease;
}

.user-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 1rem;
    display: block;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

.user-status {
    font-size: 0.8rem;
    color: var(--auth-primary);
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-menu:hover .user-name {
    color: var(--auth-primary);
    text-shadow: 0 0 10px var(--auth-primary);
}

/* ===== DROPDOWN UTILISATEUR AVANCÉ ===== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: var(--auth-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--auth-border);
    border-radius: 20px;
    padding: 1.5rem;
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 25px;
    width: 16px;
    height: 16px;
    background: var(--auth-bg);
    border: 1px solid var(--auth-border);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    backdrop-filter: blur(25px);
}

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

/* ===== ITEMS DU DROPDOWN STYLISÉS ===== */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.dropdown-item:last-child {
    margin-bottom: 0;
}

.dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    opacity: 0.1;
    transition: all 0.4s ease;
    border-radius: 12px;
}

.dropdown-item:hover::before {
    left: 0;
    opacity: 0.2;
}

.dropdown-item:hover {
    color: #ffffff;
    background: var(--auth-hover);
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.2);
}

.dropdown-item:active {
    transform: translateX(8px) scale(0.98);
}

.item-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.dropdown-item:hover .item-icon {
    transform: scale(1.2) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0, 255, 136, 0.4));
}

.item-text {
    flex: 1;
    font-weight: 500;
}

/* Séparateur élégant dans le dropdown */
.dropdown-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--auth-border), transparent);
    margin: 1rem 0;
    opacity: 0.6;
}

/* ===== BADGES DE STATUT ANIMÉS ===== */
.user-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #000011;
    z-index: 3;
    transition: all 0.3s ease;
}

.user-badge.online {
    background: var(--auth-success);
    animation: onlinePulse 2s ease-in-out infinite;
    box-shadow: 0 0 10px var(--auth-success);
}

.user-badge.away {
    background: var(--auth-warning);
    animation: awayPulse 3s ease-in-out infinite;
}

.user-badge.offline {
    background: var(--auth-danger);
    opacity: 0.7;
}

@keyframes onlinePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(46, 213, 115, 0);
        transform: scale(1.1);
    }
}

@keyframes awayPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* ===== NOTIFICATIONS D'AUTH MODERNES ===== */
.auth-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--auth-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 380px;
    z-index: 10000;
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.auth-notification.show {
    transform: translateX(0);
}

.auth-notification .notification-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.auth-notification .notification-icon {
    font-size: 1.8rem;
    color: var(--auth-primary);
    filter: drop-shadow(0 2px 4px rgba(0, 255, 136, 0.3));
}

.auth-notification .notification-title {
    font-weight: 700;
    color: #ffffff;
    font-size: 1.1rem;
}

.auth-notification .notification-message {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ===== BOUTONS D'ACTION AUTH STYLISÉS ===== */
.auth-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    color: var(--auth-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-action-btn:hover {
    background: var(--auth-primary);
    color: #000011;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.4);
    border-color: var(--auth-primary);
}

/* ===== INDICATEURS DE NIVEAU FUTURISTES ===== */
.user-level {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.level-badge {
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    color: #000011;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

.level-progress {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.level-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

.level-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 5px var(--auth-primary);
    }
    50% {
        box-shadow: 0 0 20px var(--auth-primary), 0 0 30px var(--auth-primary);
    }
}

/* ===== RESPONSIVE AUTH DESIGN ===== */
@media (max-width: 768px) {
    .user-menu {
        min-width: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .user-info {
        display: none;
    }
    
    .user-dropdown {
        right: -10px;
        min-width: 220px;
        padding: 1rem;
    }
    
    .auth-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .auth-buttons .btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
        min-width: 100px;
        height: 40px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .user-dropdown {
        right: -20px;
        min-width: 200px;
        padding: 1rem;
    }
    
    .dropdown-item {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .item-icon {
        font-size: 1.1rem;
        width: 24px;
    }
    
    .auth-notification {
        padding: 1rem;
    }
}

/* ===== ÉTATS SPÉCIAUX ET ANIMATIONS ===== */
.user-menu.loading .user-avatar {
    animation: cosmicSpin 1.5s linear infinite;
}

.user-menu.error {
    border-color: var(--auth-danger);
    background: rgba(255, 71, 87, 0.1);
}

.user-menu.success {
    border-color: var(--auth-success);
    animation: successPulse 0.8s ease-out;
}

@keyframes cosmicSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(46, 213, 115, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0);
    }
}

/* ===== TOOLTIPS AUTH ÉLÉGANTS ===== */
.auth-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    border: 1px solid var(--auth-border);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.auth-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

.user-menu:hover .auth-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* ===== ANIMATIONS D'ENTRÉE POUR LE MENU ===== */
@keyframes userMenuEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.user-menu.animate-entrance {
    animation: userMenuEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== SUPPORT DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --auth-bg: rgba(0, 255, 136, 0.15);
        --auth-border: rgba(0, 255, 136, 0.25);
        --auth-hover: rgba(0, 255, 136, 0.2);
    }
    
    .user-dropdown {
        background: rgba(0, 17, 34, 0.95);
    }
    
    .auth-notification {
        background: rgba(0, 17, 34, 0.95);
    }
}

/* ===== PRÉFÉRENCES RÉDUITES DE MOUVEMENT ===== */
@media (prefers-reduced-motion: reduce) {
    .user-avatar,
    .avatar-ring,
    .user-badge,
    .level-progress-bar {
        animation: none !important;
    }
    
    .user-menu,
    .dropdown-item,
    .auth-buttons .btn {
        transition: none !important;
    }
}