/**
 * Header Responsive - Optimisation Multi-Dispositifs
 * Navigation adaptative pour desktop, tablette et mobile
 */

/* ============================================
   HEADER BASE
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
}

.header-center {
    justify-self: center;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Menu hamburger caché par défaut */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: #111827;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ============================================
   TABLETTE (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) and (min-width: 768px) {
    .header-grid {
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 0.95rem;
    }
    
    .search-form input {
        width: 150px;
    }
    
    .account-name {
        display: none;
    }
    
    .cart-label {
        display: none;
    }
}

/* ============================================
   MOBILE (< 768px)
   ============================================ */
@media (max-width: 768px) {
    .header-grid {
        grid-template-columns: 1fr auto auto;
        gap: 1rem;
        padding: 0.75rem 0;
    }
    
    /* Logo plus petit */
    .logo img {
        height: 32px;
    }
    
    /* Navigation mobile cachée par défaut */
    .header-center {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        z-index: 1002;
        padding: 2rem 1.5rem;
        overflow-y: auto;
    }
    
    .header-center.active {
        left: 0;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid #e5e7eb;
        display: block;
        font-size: 1rem;
    }
    
    /* Header right simplifié */
    .header-right {
        gap: 0.5rem;
    }
    
    /* Recherche cachée ou en icône */
    .search-form {
        display: none;
    }
    
    /* Compte simplifié */
    .account-name {
        display: none;
    }
    
    .account-toggle {
        padding: 0.5rem;
    }
    
    /* Panier simplifié */
    .cart-label {
        display: none;
    }
    
    .cart-toggle {
        padding: 0.5rem;
    }
    
    /* Menu hamburger visible */
    .mobile-menu-toggle {
        display: flex;
        order: -1;
    }
    
    /* Animation hamburger actif */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    /* Overlay pour fermer le menu - ne couvre que la partie droite */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 80%;
        width: 20%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        pointer-events: auto;
        left: 300px;
        width: calc(100% - 300px);
    }
    
    /* Dropdowns panneau adapté */
    .cart-panel,
    .account-panel {
        position: fixed;
        right: 0;
        left: auto;
        width: 100%;
        max-width: 320px;
        top: 60px;
        max-height: calc(100vh - 60px);
    }
}

/* ============================================
   SMARTPHONE PETIT (< 480px)
   ============================================ */
@media (max-width: 480px) {
    .header-grid {
        padding: 0.5rem 0;
    }
    
    .logo img {
        height: 28px;
    }
    
    .header-center {
        width: 90%;
        max-width: none;
    }
    
    .mobile-menu-overlay.active {
        left: 90%;
        width: 10%;
    }
    
    .cart-panel,
    .account-panel {
        max-width: 100%;
        left: 0;
        right: 0;
    }
    
    .cart-badge {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
}

/* ============================================
   MODE PAYSAGE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .header-center {
        height: 100vh;
        padding: 1rem;
    }
    
    .nav-link {
        padding: 0.75rem 0;
    }
}

/* ============================================
   UTILITAIRES TACTILES
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Zones tactiles minimum 44px */
    .nav-link,
    .cart-toggle,
    .account-toggle,
    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Retrait des hovers sur tactile */
    .nav-link:hover,
    .cart-toggle:hover,
    .account-toggle:hover {
        background: transparent;
    }
}
