/* ============================================
   HEADER STYLES
   Fichier séparé pour une meilleure organisation
   ============================================ */

/* ============================================
   HEADER - Version flexible
   ============================================ */
header.site-header#masthead {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 999999;
    background: var(--color-bg-cream) !important;
    box-shadow: none;
}

/* Header container flexible */
.site-header .header-container,
.site-header > .container,
.site-header > div {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
}

/* ============================================
   LOGO - Toujours à gauche
   ============================================ */
.site-branding,
.header-logo {
    flex-shrink: 0;
}

.site-branding a,
.header-logo a {
    display: flex;
    align-items: center;
}

.site-branding img,
.header-logo img,
.custom-logo {
    max-height: 60px;
    width: auto;
    height: auto;
    display: block;
}

/* ============================================
   NAVIGATION - S'adapte automatiquement
   ============================================ */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-navigation ul {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-navigation .menu-item {
    position: relative;
}

.main-navigation .menu-item > a {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    color: var(--color-text-dark);
    text-decoration: none;
    white-space: nowrap;
}

.main-navigation .menu-title {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-gold);
    padding: 1rem 1.5rem 0.5rem;
    border-bottom: 2px solid var(--color-gold);
    margin-bottom: 0.5rem;
    pointer-events: none; /* Non cliquable */
}

.main-navigation .menu-title span {
    display: block;
}

/* En mobile */
@media (max-width: 900px) {
    .main-navigation .menu-title {
        padding: 1rem 0 0.5rem;
        font-size: 0.85rem;
    }
}

/* Sous-menus */
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-bg-alt);
    box-shadow: var(--shadow-md);
    min-width: 220px;
    z-index: 999;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0 0;
    list-style: none;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.main-navigation .menu-item:hover > .sub-menu {
    display: block;
}

.main-navigation .sub-menu li {
    width: 100%;
    position: relative;
}

.main-navigation .sub-menu a {
    display: block;
    padding: 0.8rem 1.5rem 0.8rem 2.5rem;
    color: var(--color-text-dark);
    text-align: left;
    font-size: 0.9rem;
    font-weight: 400;
    font-family: 'Caviar Dreams', sans-serif;
    transition: var(--transition-base);
    position: relative;
}

.main-navigation .sub-menu li:first-child a {
    padding-top: 1rem;
}

.main-navigation .sub-menu li:last-child a {
    padding-bottom: 1rem;
}

/* Logo animé dans sous-menu */
.main-navigation .sub-menu a::before {
    content: "";
    position: absolute;
    left: 0.8rem;
    top: 50%;
    width: 15px;
    height: 15px;
    background-image: url('../images/LOGO_SECONDAIRE.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: translateY(-50%) rotate(270deg);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.main-navigation .sub-menu a:hover::before {
    transform: translateY(-50%) rotate(180deg);
}

.main-navigation .sub-menu a:hover {
    background: var(--color-bg-alt);
    color: var(--color-gold);
    padding-left: 2.8rem;
}

/* ============================================
   BADGE MEMBRE DU RÉSEAU - À DROITE DU HEADER
   ============================================ */

/* ============================================
   STRUCTURE DU HEADER : YMAJE | Navigation | Origaly
   ============================================ */

/* Modifier le header container pour l'alignement */
.site-header .header-container,
.site-header > .container,
.site-header > div {
    display: grid;
    grid-template-columns: 180px 1fr auto;  /* Logo | Navigation | Badge */
    align-items: center;
    gap: 2rem;
}

/* Logo YMAJE à gauche */
.header-logo {
    justify-self: start;
}

/* Navigation au centre */
.main-navigation {
    justify-self: center;
}

/* Badge Origaly à droite */
.header-network-badge {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(167, 134, 77, 0.2);  /* Bordure à gauche */
}

/* Texte "Membre du réseau" */
.header-network-badge .network-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-gray);
    font-weight: 600;
    white-space: nowrap;
}

/* Logo Origaly */
.header-network-badge a {
    display: block;
    transition: var(--transition-base);
}

.header-network-badge img {
    height: 35px;
    width: auto;
    display: block;
    transition: var(--transition-base);
}

.header-network-badge a:hover img {
    transform: scale(1.05);
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE - TABLETTE (1200px)
   ============================================ */
@media (max-width: 1200px) {
    .site-header .header-container,
    .site-header > .container,
    .site-header > div {
        padding: 0 1.5rem;
    }
    
    .main-navigation ul {
        gap: 1.2rem;
    }

    .main-navigation .menu-item > a {
        font-size: 0.9rem;
    }
    
    .site-header .header-container {
        gap: 1.5rem;
        grid-template-columns: 160px 1fr auto;
    }
    
    .header-network-badge {
        padding-left: 1rem;
    }
    
    .header-network-badge .network-label {
        font-size: 0.6rem;
    }
    
    .header-network-badge img {
        height: 30px;
    }
}

@media (max-width: 1024px) {
    .site-header .header-container,
    .site-header > .container,
    .site-header > div {
        grid-template-columns: 160px 1fr 160px;
        padding: 0 20px;
    }
    
    .main-navigation ul {
        gap: 1rem;
    }
    
    .main-navigation > div > ul > li > a {
        font-size: 0.9rem;
    }
    
    .site-header .header-container {
        gap: 1rem;
        grid-template-columns: 140px 1fr auto;
    }
    
    .header-network-badge {
        padding-left: 0.8rem;
    }
    
    .header-network-badge .network-label {
        font-size: 0.55rem;
    }
    
    .header-network-badge img {
        height: 28px;
    }
}

/* ============================================
   RESPONSIVE - MENU MOBILE (À partir de 900px)
   ============================================ */
@media (max-width: 900px) {
    body {
        padding-top: 70px;
    }
    
    .site-header .header-container,
    .site-header > .container,
    .site-header > div {
        height: 70px;
        padding: 0 1.5rem;
    }
    
    .site-branding img,
    .header-logo img,
    .custom-logo {
        max-height: 55px;
    }
    
    .main-navigation {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--color-bg-light);
        transition: left 0.3s ease;
        padding: 2rem;
        overflow-y: auto;
        z-index: 999;
        justify-content: flex-start;
    }
    
    .main-navigation.is-open {
        left: 0;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        width: 100%;
    }
    
    .main-navigation .menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .main-navigation .menu-item > a {
        padding: 1.2rem 0;
        font-size: 1.1rem;
    }
    
    /* Sous-menus en mobile */
    .main-navigation .sub-menu {
        position: static;
        display: none;
        background: var(--color-bg-light);
        border-radius: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    
    .main-navigation .menu-item.is-open > .sub-menu {
        display: block;
    }
    
    .main-navigation .sub-menu a {
        padding: 1rem 1.5rem 1rem 2.5rem;
        font-size: 1rem;
    }
    
    /* Bouton hamburger */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 1000;
        width: 40px;
        height: 40px;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 25px;
        height: 3px;
        background: var(--color-text-dark);
        margin: 3px 0;
        transition: 0.3s;
        border-radius: 2px;
    }
    
    .mobile-menu-toggle.is-active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .mobile-menu-toggle.is-active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.is-active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    
    /* Empêcher le scroll quand menu ouvert */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Passer en flex pour mobile */
    .site-header .header-container {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
    }
    
    /* Logo YMAJE à gauche */
    .header-logo {
        order: 1;
        flex-shrink: 0;
    }
    
    /* Badge Origaly au centre (avant le hamburger) */
    .header-network-badge {
        order: 2;
        flex: 1;
        display: flex;
        justify-content: center;
        padding-left: 0;
        border-left: none;
        gap: 3px;
    }
    
    .header-network-badge .network-label {
        font-size: 0.5rem;
    }
    
    .header-network-badge img {
        height: 25px;
    }
    
    /* Bouton hamburger à droite */
    .mobile-menu-toggle {
        order: 3;
        flex-shrink: 0;
    }
    
    /* Navigation en overlay */
    .main-navigation {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--color-bg-light);
        transition: left 0.3s ease;
        padding: 2rem;
        overflow-y: auto;
        z-index: 999;
        justify-content: flex-start;
    }
    
    .main-navigation.is-open {
        left: 0;
    }
}

/* Desktop uniquement - Cache le bouton hamburger */
@media (min-width: 901px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 65px;
    }
    
    .site-header .header-container,
    .site-header > .container,
    .site-header > div {
        height: 65px;
        padding: 0 1rem;
    }
    
    .site-branding img,
    .header-logo img,
    .custom-logo {
        max-height: 45px;
    }
    
    .main-navigation {
        top: 65px;
        height: calc(100vh - 65px);
        padding: 1.5rem;
    }
    
    .header-network-badge {
        gap: 2px;
    }
    
    .header-network-badge .network-label {
        font-size: 0.45rem;
        letter-spacing: 0.3px;
    }
    
    .header-network-badge img {
        height: 22px;
    }
}

/* ============================================
   BOUTON SOUS-MENU MOBILE
   ============================================ */

/* Bouton pour ouvrir/fermer les sous-menus en mobile */
.submenu-toggle {
    display: none; /* Caché par défaut (desktop) */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--color-text-dark);
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.submenu-toggle span {
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Afficher uniquement en mobile */
@media (max-width: 900px) {
    .main-navigation .menu-item-has-children {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .submenu-toggle {
        display: block;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .main-navigation .menu-item-has-children > a {
        flex: 1;
    }
    
    /* Style actif */
    .menu-item-has-children.is-open .submenu-toggle span {
        transform: rotate(180deg);
    }
}

@media (max-width: 900px) {
    /* Liens dans le contenu (pas dans le menu) */
    .site-main a,
    .hero-button,
    .btn,
    .btn-primary,
    .btn-secondary,
    .publication-card-link,
    .article-card-link {
        pointer-events: auto !important;
        cursor: pointer !important;
        /* Ne PAS forcer position: relative */
    }
}