/**
 * ============================================
 * HEADER UNIFIED PRO - 100% RESPONSIVE GARANTI
 * ============================================
 * AUCUN SCROLL VERTICAL - TOUT RENTRE DANS L'ÉCRAN
 * Version: 4.0 - PERFECTION ABSOLUE
 * ============================================
 */

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --z-header: 1000;
    --z-overlay: 1001;
    --z-mobile-menu: 1002;
    --z-cart-modal: 9999;
    
    --header-bg: #A51A1E;
    --header-shadow: 0 2px 12px rgba(165, 26, 30, 0.3);
    --primary-color: #ffffff;
    --primary-hover: #ffcccc;
    --overlay-bg: rgba(0, 0, 0, 0.6);
    
    --header-height-desktop: 75px;
    --header-height-mobile: 60px;
    
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    --min-touch-target: 44px;
}

/* ============================================
   HEADER BASE - FIXÉ EN HAUT
   ============================================ */
.ecommerce-header {
    background: var(--header-bg);
    box-shadow: var(--header-shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    width: 100%;
    height: var(--header-height-desktop);
}

.header-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    background: #204a71;
    border-bottom: 1px solid #e5e5e5;
    gap: 20px;
}

/* ============================================
   LOGO
   ============================================ */
.header-navbar-logo {
    flex-shrink: 0;
    z-index: 2;
}

.header-navbar-logo a {
    display: block;
    line-height: 0;
}

.header-navbar-logo img {
    height: 45px;
    width: auto;
    transition: transform var(--transition-fast);
}

.header-navbar-logo img:hover {
    transform: scale(1.05);
}

/* ============================================
   MENU NAVIGATION DESKTOP
   ============================================ */
.header-navbar-list {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-navbar-list li {
    list-style: none;
}

.header-navbar-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.header-navbar-list a:hover {
    background: rgba(32, 74, 113, 0.08);
    color: var(--primary-hover);
}

.header-navbar-list a i {
    font-size: 15px;
}

/* ============================================
   BOUTON PANIER
   ============================================ */
.cart-container {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 2;
}

.cart-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #204a71 0%, #2a5298 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(32, 74, 113, 0.2);
    position: relative;
    min-height: var(--min-touch-target);
}

.cart-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(32, 74, 113, 0.3);
}

.cart-toggle-btn i {
    font-size: 16px;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid white;
}

/* ============================================
   MENU BURGER - CACHÉ PAR DÉFAUT
   ============================================ */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 26px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: calc(var(--z-mobile-menu) + 1);
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: all var(--transition-smooth);
    transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* ============================================
   MENU MOBILE - SLIDE DEPUIS GAUCHE
   ============================================ */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: var(--z-mobile-menu);
    overflow-y: auto;
    transition: left var(--transition-smooth);
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu,
.mobile-menu * {
    pointer-events: auto;
}

/* Header Menu Mobile */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #204a71 0%, #2a5298 100%);
    min-height: 70px;
}

.mobile-menu-header img {
    height: 38px;
    width: auto;
}

.mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Liste Liens Menu Mobile */
.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-list li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    min-height: var(--min-touch-target);
    pointer-events: auto;
}

.mobile-menu-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.mobile-menu-list a:active,
.mobile-menu-list a:hover {
    background: rgba(32, 74, 113, 0.06);
    color: var(--primary-color);
    padding-left: 28px;
}

.mobile-menu-list a:active::before,
.mobile-menu-list a:hover::before {
    transform: scaleY(1);
}

.mobile-menu-list a i {
    font-size: 18px;
    color: var(--primary-color);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* ============================================
   OVERLAY
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    pointer-events: none;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   RESPONSIVE MOBILE/TABLETTE
   ============================================ */
@media (max-width: 991px) {
    /* AJUSTER HAUTEUR HEADER */
    .ecommerce-header {
        height: var(--header-height-mobile);
    }
    
    .header-navbar {
        padding: 0 16px;
        gap: 10px;
    }
    
    /* CACHER MENU DESKTOP */
    .header-navbar-list {
        display: none !important;
    }
    
    /* AFFICHER BURGER À GAUCHE */
    .mobile-menu-toggle {
        display: flex !important;
        order: 1;
    }
    
    /* LOGO AU CENTRE */
    .header-navbar-logo {
        order: 2;
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    .header-navbar-logo img {
        height: 38px;
    }
    
    /* PANIER À DROITE */
    .cart-container {
        order: 3;
    }
    
    .cart-toggle-btn span:not(.cart-badge) {
        display: none;
    }
    
    .cart-toggle-btn {
        padding: 11px;
        min-width: var(--min-touch-target);
    }
}

/* TRÈS PETIT MOBILE */
@media (max-width: 576px) {
    .header-navbar {
        padding: 0 12px;
        gap: 8px;
    }
    
    .header-navbar-logo img {
        height: 34px;
    }
    
    .mobile-menu {
        width: 260px;
    }
    
    .cart-toggle-btn {
        padding: 10px;
    }
}

/* ============================================
   ÉTATS & ANIMATIONS
   ============================================ */

/* Bloquer scroll body quand menu ouvert */
body.menu-open {
    overflow: hidden !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus Accessibility */
.cart-toggle-btn:focus-visible,
.mobile-menu-toggle:focus-visible,
.mobile-menu-close:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.header-navbar-list a:focus-visible,
.mobile-menu-list a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .mobile-menu-toggle,
    .cart-container,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }
    
    .ecommerce-header {
        position: relative;
        box-shadow: none;
    }
    
    .header-navbar-list {
        display: flex !important;
    }
}
