/**
 * header.css - Styles pour l'en-tête et la navigation
 *
 * Ce fichier contient les styles pour :
 * - La navigation principale
 * - Le menu utilisateur
 * - Les notifications
 * - L'avatar utilisateur
 * - Le responsive mobile
 *
 * Date de création : 2025-11-03
 */

/* ===================================
   CONTENEUR HEADER GLOBAL
   =================================== */
.site-header {
    background: rgba(255, 255, 255, 0.9);
    /*border-radius: 15px;*/
    box-shadow: 0 8px 32px var(--shadow-color);
    backdrop-filter: blur(4px);
    margin-bottom: 2rem;
    /*border: 1px solid var(--accent-blue-light);*/
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Sur mobile, désactiver overflow:hidden */
@media (max-width: 768px) {
    .site-header {
        overflow: visible;
        /* Pas de z-index pour ne pas créer de stacking context */
    }
}

/* Barre décorative en haut du header */
.site-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-color), var(--accent-blue));
    z-index: 1;
}

/* ===================================
   NAVIGATION PRINCIPALE
   =================================== */
nav {
    /*padding: 1rem;*/
    padding-bottom: 0.5rem;
    position: relative;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
}

nav ul li {
    position: relative;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    background: var(--primary-color);
    transition: all 0.3s ease;
    display: inline-block;
    font-weight: 500;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid rgba(127, 204, 222, 0.3);
    position: relative;
    overflow: hidden;
}

nav ul li a:hover {
    background: linear-gradient(45deg, var(--accent-color), var(--accent-blue-light));
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-blue);
    color: #2a2a2a;
}

/* Lien actif */
nav ul li a.active {
    background: linear-gradient(45deg, var(--accent-color), var(--accent-blue-light));
    color: #2a2a2a;
    font-weight: 600;
}

/* ===================================
   NOTIFICATIONS
   =================================== */
.notification-link {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.has-notifications {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===================================
   MENU UTILISATEUR (AVATAR, PROFIL)
   =================================== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-blue-light);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--shadow-blue);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #2a2a2a;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-avatar-placeholder:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--shadow-blue);
}

/* Menu déroulant utilisateur */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    background: var(--primary-color);
    border: 1px solid var(--accent-blue-light);
    transition: all 0.3s ease;
}

.user-dropdown-toggle:hover {
    background: var(--accent-blue-light);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    overflow: hidden;
    display: none;
    z-index: 1000;
}

.user-dropdown.active .user-dropdown-menu {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-menu a {
    display: block;
    padding: 0.8rem 1.2rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s ease;
}

.user-dropdown-menu a:hover {
    background: var(--primary-color);
}

.user-dropdown-menu a.danger {
    color: #ff4444;
}

.user-dropdown-menu a.danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* ===================================
   HEADER AVEC LOGO ET NAVIGATION
   =================================== */
.site-header {
    /*max-width: 1200px;*/
    margin: 0 auto 2rem;
    padding: 0 1rem;
    padding-top: 0.5rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.header-logo h1 {
    font-size: 2rem;
    margin: 0;
    color: #3a3a3a;
}

/* ===================================
   MENU BURGER MOBILE
   =================================== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ===================================
   RESPONSIVE MOBILE
   =================================== */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 902;
        background: white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
    }

    /* Navigation utilisateur connecté */
    #mainNav {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        background: white !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1) !important;
        transition: right 0.3s ease !important;
        z-index: 901 !important;
        overflow-y: auto !important;
        padding: 1rem !important;
    }

    #mainNav.active {
        right: 0 !important;
    }

    #mainNav ul {
        flex-direction: column;
        gap: 0;
        padding: 1rem;
    }

    #mainNav ul li {
        width: 100%;
        border-bottom: 1px solid var(--accent-blue-light);
    }

    #mainNav ul li:last-child {
        border-bottom: none;
    }

    #mainNav ul li a {
        display: block;
        width: 100%;
        text-align: left;
        border-radius: 0;
        box-shadow: none;
        border: none;
        background: transparent;
    }

    #mainNav ul li a:hover {
        background: var(--primary-color);
        transform: none;
        box-shadow: none;
    }

    /* Navigation publique sur mobile */
    .public-nav {
        flex-direction: column;
        padding: 1rem;
    }

    .public-nav a {
        text-align: center;
    }

    /* Overlay pour fermer le menu */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        display: none;
        z-index: 900;
    }

    .menu-overlay.active {
        display: block;
    }

    .header-top {
        flex-wrap: wrap;
    }

    .user-menu {
        order: -1;
        width: 100%;
        justify-content: flex-end;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header-logo h1 {
        font-size: 1.5rem;
    }

    #mainNav {
        width: 90%;
    }
}

/* ===================================
   NAVIGATION PUBLIQUE (NON CONNECTÉ)
   =================================== */
.public-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.public-nav a {
    padding: 0.8rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.public-nav a.login-btn {
    background: white;
    color: var(--text-color);
    border: 2px solid var(--accent-blue-light);
}

.public-nav a.login-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.public-nav a.register-btn {
    background: linear-gradient(45deg, var(--accent-color), var(--accent-blue-light));
    color: #2a2a2a;
    border: none;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.public-nav a.register-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-blue);
}

@media (max-width: 768px) {
    .public-nav {
        flex-direction: column;
        padding: 1rem;
    }

    .public-nav a {
        text-align: center;
    }
}

/* ===================================
   MENU PROFIL (TOP RIGHT)
   =================================== */
.profile-menu-container {
    position: absolute;
    top: 1rem;
    right: 2rem;
    z-index: 1000;
}

.profile-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--accent-blue);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.profile-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-blue);
}

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

.profile-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.profile-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
    padding: 0.5rem;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

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

.profile-menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background: var(--primary-color);
}

.profile-menu-item svg {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    color: var(--accent-blue);
}

/* Responsive pour le menu profil */
@media (max-width: 768px) {
    /* Masquer le menu profil fixe sur mobile */
    .profile-menu-container {
        display: none;
    }
}

/* ===================================
   MENU PROFIL MOBILE (DANS HAMBURGER)
   =================================== */
.mobile-profile-section {
    display: none; /* Masqué sur desktop */
    padding: 1rem;
    background: var(--primary-color);
    border-bottom: 2px solid var(--accent-blue-light);
    margin-bottom: 1rem;
}

.mobile-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 1rem;
}

.mobile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-blue);
}

.mobile-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--accent-blue);
}

.mobile-avatar-placeholder .profile-icon {
    width: 32px;
    height: 32px;
    color: white;
}

.mobile-profile-info {
    flex: 1;
}

.mobile-profile-info strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-color);
}

.mobile-profile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-profile-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.mobile-profile-link:hover {
    background: var(--accent-blue-light);
    transform: translateX(5px);
}

.mobile-profile-link svg {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    color: var(--accent-blue);
}

/* Afficher le menu profil mobile uniquement sur mobile */
@media (max-width: 768px) {
    .mobile-profile-section {
        display: block;
    }

    .site-header {
        margin-left: 44px;
        border-radius: 5px;
    }
}
