/* ========================================
   header.css - Styles spécifiques à l'en-tête
   Version: 2.1 - Dropdowns corrigés (favoris, location, panier)
   ======================================== */

/* ----- TOP BAR ----- */
.top-bar {
    background: var(--primary);
    color: var(--white);
    font-size: 13px;
    padding: 8px 0;
    position: relative;
    z-index: 1001;
}
.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.top-bar-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.top-bar-info i {
    margin-right: 6px;
    font-size: 12px;
}
.top-bar-shipping {
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-bar-shipping i {
    font-size: 14px;
    color: var(--success);
}
.top-bar-links {
    display: flex;
    align-items: center;
    gap: 15px;
}
.top-bar-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-300);
}
.top-bar-links a:hover {
    color: var(--white);
}

/* ----- MAIN HEADER ----- */
.main-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-normal);
    will-change: transform;
    overflow: visible !important;  /* Évite de couper les dropdowns */
}
.main-header.scrolled {
    box-shadow: var(--shadow-md);
}
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 30px;
    overflow: visible !important;
}
.logo {
    flex-shrink: 0;
}
.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-icon {
    font-size: 32px;
    color: var(--primary);
}
.logo-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
    color: var(--primary);
}
.logo-text span {
    color: var(--secondary);
}

/* ----- BOUTON HAMBURGER ----- */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--border-radius-round);
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.mobile-menu-toggle:hover {
    background: var(--primary);
    color: var(--white);
}

/* ----- NAVIGATION DESKTOP ----- */
.main-nav {
    flex: 1;
}
.nav-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    list-style: none;
    flex-wrap: wrap;
}
.nav-item {
    position: relative;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-700);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
}
.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: rgba(26,77,140,0.08);
}
.nav-link i {
    font-size: 14px;
}

/* Dropdown desktop */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 240px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 100;
    padding: 8px 0;
}
.nav-item:hover .dropdown-menu,
.nav-item:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-item {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: var(--gray-700);
    transition: all var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary);
    padding-left: 24px;
}
.dropdown-item i {
    width: 20px;
    margin-right: 8px;
    font-size: 12px;
}

/* ----- HEADER ACTIONS ----- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    overflow: visible !important;
}
.header-action-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-round);
    background: var(--gray-100);
    color: var(--gray-700);
    transition: all var(--transition-fast);
}
.header-action-btn:hover {
    background: var(--primary);
    color: var(--white);
}
.header-action-btn i {
    font-size: 20px;
}

/* Badges individuels */
.cart-badge,
.wishlist-badge,
.rent-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ===== DROPDOWNS (Favoris, Location, Panier) CORRIGÉS ===== */
.cart-btn-wrapper,
.rent-btn-wrapper,
.wishlist-btn-wrapper {
    position: relative;
    display: inline-block;
}

.cart-dropdown,
.rent-dropdown,
.wishlist-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1050; /* supérieur au header (z-index:1000) */
    max-height: 80vh;
    overflow-y: auto;
}

/* Apparition au survol (desktop) */
.cart-btn-wrapper:hover .cart-dropdown,
.rent-btn-wrapper:hover .rent-dropdown,
.wishlist-btn-wrapper:hover .wishlist-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Pour le clic (mobile) avec la classe .show (optionnel) */
.cart-dropdown.show,
.rent-dropdown.show,
.wishlist-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Styles internes des dropdowns */
.cart-dropdown-header,
.rent-dropdown-header,
.wishlist-dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}
.rent-dropdown-header {
    background: #10b981;
    color: white;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}
.wishlist-dropdown-header {
    background: #ef4444;
    color: white;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}
.cart-dropdown-items,
.rent-dropdown-items,
.wishlist-dropdown-items {
    max-height: 300px;
    overflow-y: auto;
}
.cart-dropdown-item,
.rent-dropdown-item,
.wishlist-dropdown-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.cart-dropdown-item-img,
.rent-dropdown-item-img,
.wishlist-dropdown-item-img {
    width: 50px;
    height: 50px;
    background: var(--gray-100);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-dropdown-item-img img,
.rent-dropdown-item-img img,
.wishlist-dropdown-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cart-dropdown-item-info,
.rent-dropdown-item-info,
.wishlist-dropdown-item-info {
    flex: 1;
}
.cart-dropdown-item-title,
.rent-dropdown-item-title,
.wishlist-dropdown-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}
.cart-dropdown-item-price,
.rent-dropdown-item-price,
.wishlist-dropdown-item-price {
    font-size: 13px;
    font-weight: 600;
}
.empty-cart,
.empty-rent,
.empty-wishlist {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}
.cart-dropdown-footer,
.rent-dropdown-footer,
.wishlist-dropdown-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
}
.cart-total,
.rent-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 15px;
}
.cart-buttons,
.rent-buttons {
    display: flex;
    gap: 10px;
}
.btn-view-cart,
.btn-view-rent,
.btn-view-wishlist {
    background: var(--gray-200);
    color: var(--gray-800);
    text-decoration: none;
    text-align: center;
    padding: 10px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}
.btn-checkout,
.btn-rent-checkout {
    background: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 10px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

/* ----- MENU MOBILE (panel latéral) ----- */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 350px;
    height: 100%;
    background: var(--white);
    z-index: 2000;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.mobile-menu.active {
    left: 0;
}
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--primary);
    color: var(--white);
}
.mobile-menu-logo {
    font-weight: 700;
    font-size: 20px;
}
.mobile-menu-logo span {
    color: var(--secondary);
}
.close-mobile-menu {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-round);
    background: rgba(255,255,255,0.2);
    color: var(--white);
    cursor: pointer;
}
.mobile-nav-list {
    list-style: none;
    padding: 10px 0;
}
.mobile-nav-item {
    border-bottom: 1px solid var(--gray-100);
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    font-weight: 500;
    color: var(--gray-700);
}
.mobile-nav-link.has-dropdown {
    cursor: pointer;
}
.mobile-dropdown-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-round);
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
}
.mobile-dropdown {
    display: none;
    background: var(--gray-50);
    padding: 10px 0;
}
.mobile-dropdown.active {
    display: block;
}
.mobile-dropdown-item {
    display: block;
    padding: 12px 20px 12px 45px;
    font-size: 14px;
    color: var(--gray-600);
    transition: all var(--transition-fast);
}
.mobile-dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary);
    padding-left: 50px;
}
.mobile-dropdown-item i {
    width: 20px;
    margin-right: 8px;
}
.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    margin-top: 20px;
    background: var(--gray-50);
}
.mobile-contact-info {
    margin-bottom: 15px;
}
.mobile-contact-info p {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
}
.mobile-shipping-info .top-bar-shipping {
    background: var(--primary);
    color: var(--white);
    display: inline-flex;
    padding: 8px 16px;
}

/* Overlay du menu mobile */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}
body.lock-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ----- SEARCH MODAL ----- */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.search-modal.active {
    opacity: 1;
    visibility: visible;
}
.search-modal-content {
    width: 90%;
    max-width: 600px;
}
.search-form {
    display: flex;
    background: var(--white);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
}
.search-form input {
    flex: 1;
    padding: 18px 20px;
    border: none;
    font-size: 18px;
    outline: none;
}
.search-form button {
    padding: 0 25px;
    background: var(--primary);
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
}
.close-search {
    position: absolute;
    top: 30px;
    right: 30px;
    background: none;
    color: var(--white);
    font-size: 32px;
    cursor: pointer;
}

/* ===== RESPONSIVE : Réorganisation mobile ===== */
@media (max-width: 992px) {
    .main-nav {
        display: none;
    }
    .mobile-menu-toggle {
        display: flex;
    }
    .header-container {
        gap: 10px;
    }
    .mobile-menu-toggle {
        order: 1;
        margin-right: 0;
    }
    .logo {
        order: 2;
        flex: 1;
        text-align: center;
    }
    .logo a {
        justify-content: center;
    }
    .header-actions {
        order: 3;
        gap: 8px;
    }
    .header-action-btn {
        width: 42px;
        height: 42px;
    }
    .header-action-btn i {
        font-size: 18px;
    }
    .top-bar-content {
        justify-content: center;
        text-align: center;
    }
    .top-bar-info {
        justify-content: center;
    }
    .top-bar-links {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        height: var(--header-height-mobile);
    }
    .logo-icon {
        font-size: 24px;
    }
    .logo-text {
        font-size: 18px;
    }
    .mobile-menu-toggle,
    .header-action-btn {
        width: 40px;
        height: 40px;
    }
    .cart-dropdown,
    .rent-dropdown,
    .wishlist-dropdown {
        width: 320px;
        right: -10px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        gap: 5px;
    }
    .mobile-menu-toggle,
    .header-action-btn {
        width: 38px;
        height: 38px;
    }
    .cart-dropdown,
    .rent-dropdown,
    .wishlist-dropdown {
        width: 300px;
        right: -15px;
    }
    .top-bar {
        font-size: 11px;
        padding: 6px 0;
    }
    .top-bar-info {
        gap: 12px;
    }
    .top-bar-shipping span:first-child {
        display: none;
    }
}

/* Utilitaires dropdown */
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}