/* ========================================
   MENU UTILISATEUR - NAVIGATION
   ======================================== */

/* Conteneur menu navigation */
.user-menu-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Bouton Connexion dans la navigation */
.btn-login-nav {
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
}

.btn-login-nav:hover {
    background: white;
    color: #004E89;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Bouton Créer compte dans la navigation (desktop uniquement) */
.btn-register-nav {
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1.5px solid rgba(247, 184, 1, 0.8);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: rgba(247, 184, 1, 0.15);
    color: #F7B801;
    cursor: pointer;
}

.btn-register-nav:hover {
    background: #F7B801;
    color: #004E89;
    box-shadow: 0 4px 12px rgba(247, 184, 1, 0.35);
    border-color: #F7B801;
}

/* Cacher btn-register-nav sur mobile */
@media (max-width: 768px) {
    .btn-register-nav--desktop-only {
        display: none !important;
    }
}

/* Empêche le flash au chargement */
#userMenuNav,
#mobileNavAvatar {
    opacity: 0;
    transition: opacity 0.15s ease;
}
#userMenuNav.ready,
#mobileNavAvatar.ready {
    opacity: 1;
}
.btn-logout-nav {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid rgba(72, 199, 116, 0.75);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: rgba(34, 139, 74, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #d4f5e2;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(34, 139, 74, 0.15);
    letter-spacing: 0.3px;
}

.btn-logout-nav:hover {
    background: rgba(34, 139, 74, 0.55);
    border-color: rgba(72, 199, 116, 1);
    color: #ffffff;
    transform: none;
    box-shadow: 0 2px 8px rgba(34, 139, 74, 0.15);
}

/* Avatar cercle avec initiales (navigation) — Vert écologique transparent */
.user-avatar-nav {
    width: auto;
    height: auto;
    padding: .4rem .8rem;
    background: rgba(34, 139, 74, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 2px solid rgba(72, 199, 116, 0.75);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #d4f5e2;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(34, 139, 74, 0.15);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.user-avatar-nav:hover {
    transform: none;
    background: rgba(34, 139, 74, 0.55);
    border-color: rgba(72, 199, 116, 1);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(34, 139, 74, 0.15);
}

/* Mobile - styles adaptés */
@media (max-width: 768px) {
    /* Boutons desktop cachés sur mobile (gérés via hamburger) */
    .btn-login-nav--desktop-only,
    .btn-logout-nav--desktop-only,
    .user-avatar-nav--desktop-only {
        display: none !important;
    }
    
    .btn-login-nav {
        padding: 6px 14px;
        font-size: 12px;
    }
    
    .btn-logout-nav {
        padding: 6px 12px;
        font-size: 11px;
    }

    /* Initiales — conteneur ovale style panier sur mobile */
    .user-avatar-nav {
        width: auto;
        height: auto;
        border-radius: 20px;
        padding: .4rem .8rem;
        font-size: .9rem;
        background: rgba(34, 139, 74, 0.18);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: 2px solid #3ecf6e;
        color: #d4f5e2;
        box-shadow: 0 0 6px rgba(62, 207, 110, 0.45);
    }

    .user-avatar-nav:hover {
        background: rgba(34, 139, 74, 0.55);
        border-color: #7eeaa5;
        color: #ffffff;
        transform: none;
        box-shadow: 0 0 12px rgba(62, 207, 110, 0.7);
    }
}

/* Boutons de connexion/inscription */
.user-auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-auth-buttons .btn-login,
.user-auth-buttons .btn-register {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}

/* Style pour la navigation desktop */
@media (min-width: 769px) {
    .user-auth-buttons .btn-login {
        background: transparent;
        color: #004E89;
        border-color: #004E89;
    }
    
    .user-auth-buttons .btn-login:hover {
        background: #004E89;
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 78, 137, 0.3);
    }
    
    .user-auth-buttons .btn-register {
        background: linear-gradient(135deg, #F7B801 0%, #f5a623 100%);
        color: white;
        border-color: #F7B801;
    }
    
    .user-auth-buttons .btn-register:hover {
        background: linear-gradient(135deg, #f5a623 0%, #e89b0c 100%);
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(247, 184, 1, 0.4);
    }
}

/* Style pour le hero mobile */
@media (max-width: 768px) {
    .user-auth-buttons .btn-login {
        background: transparent;
        color: white;
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .user-auth-buttons .btn-login:hover {
        background: rgba(255, 255, 255, 0.15);
        border-color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .user-auth-buttons .btn-register {
        background: linear-gradient(135deg, #F7B801 0%, #f5a623 100%);
        color: #004E89;
        border-color: #F7B801;
    }
    
    .user-auth-buttons .btn-register:hover {
        background: linear-gradient(135deg, #f5a623 0%, #e89b0c 100%);
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(247, 184, 1, 0.4);
    }
}

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

.user-menu-trigger {
    background: rgba(0, 78, 137, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid #004E89;
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #004E89;
}

/* Style pour desktop - dans la navigation */
@media (min-width: 769px) {
    .user-menu-trigger {
        background: white;
        border-color: #e0e0e0;
        color: #004E89;
    }
    
    .user-menu-trigger:hover {
        background: #f8f9fa;
        border-color: #004E89;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 78, 137, 0.2);
    }
}

/* Style pour mobile - dans le hero */
@media (max-width: 768px) {
    .user-menu-trigger {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.3);
        color: white;
    }
    
    .user-menu-trigger:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.5);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #F7B801 0%, #f5a623 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #004E89;
    text-transform: uppercase;
}

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

.user-menu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.user-menu-connected.active .user-menu-arrow {
    transform: rotate(180deg);
}

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

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

.user-menu-header {
    background: linear-gradient(135deg, #004E89 0%, #0066b3 100%);
    color: white;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-menu-header-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
}

.user-menu-header-email {
    font-size: 12px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-items {
    padding: 8px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.user-menu-item:hover {
    background: #f8f9fa;
    color: #004E89;
    padding-left: 20px;
}

.user-menu-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.user-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

.user-menu-item.logout {
    color: #dc3545;
}

.user-menu-item.logout:hover {
    background: #fff5f5;
    color: #c82333;
}

/* Badge admin */
.admin-badge {
    display: inline-block;
    background: #F7B801;
    color: #004E89;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .user-menu {
        position: static;
        margin-left: auto;
        margin-right: 60px; /* Espace pour le panier */
    }
    
    .user-auth-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .user-auth-buttons .btn-login,
    .user-auth-buttons .btn-register {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .user-name {
        display: none;
    }
    
    .user-menu-dropdown {
        right: -10px;
    }
}

/* Animation d'entrée */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-dropdown.show {
    animation: fadeInDown 0.3s ease;
}

/* ========================================
   LIENS AUTH DANS LE MENU HAMBURGER (MOBILE)
   ======================================== */

/* Lien auth dans la liste nav-links (hamburger) - même style que les liens nav */
.hamburger-auth-link {
    display: flex;
    align-items: center;
    justify-content: center;  /* ✅ CENTRAGE AJOUTÉ */
    gap: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.25s ease;
    margin: 4px auto;         /* ✅ auto gauche/droite pour centrer */
    width: calc(100% - 2rem); /* ✅ largeur controlée avec marges égales */
    box-sizing: border-box;
    text-align: center;       /* ✅ texte centré */
}

/* Connexion - style bleu */
.hamburger-auth-link--login {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hamburger-auth-link--login:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Créer compte - même style que Connexion */
.hamburger-auth-link--register {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    margin-top: 10px;
}

.hamburger-auth-link--register:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Déconnexion - style rouge doux */
.hamburger-auth-link--logout {
    color: #ffb3b3;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.hamburger-auth-link--logout:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.6);
    color: #fff;
}

/* Séparateur visuel avant le lien auth dans le hamburger */
#hamburger-auth-item {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 8px;
    margin-top: 4px;
    width: 100%;          /* ✅ pleine largeur */
    text-align: center;   /* ✅ centrage du contenu */
    display: flex;
    flex-direction: column;
    align-items: center;  /* ✅ centrage des enfants */
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

/* Sur desktop : cacher le lien auth du hamburger */
@media (min-width: 769px) {
    #hamburger-auth-item {
        display: none !important;
    }
}

/* ========================================
   AVATAR INVITÉ (icône personne)
   ======================================== */
.user-avatar-nav--guest {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    color: white !important;
}

.user-avatar-nav--guest:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    border-color: white !important;
    color: #004E89 !important;
    transform: scale(1.1) !important;
}

.user-avatar-nav--guest svg {
    stroke: currentColor;
}
