/* ============================================
   MOBILE GLOBAL - En-tête mobile pour toutes les pages
   Inspiré de ok-jardin.fr pour une meilleure UX mobile
   ============================================ */

/* Masquer le menu mobile drawer sur desktop */
@media (min-width: 768px) {
    .mobile-nav-drawer,
    .mobile-nav-overlay {
        display: none !important;
    }
}

/* Breakpoint mobile : uniquement pour écrans < 768px */
@media (max-width: 767px) {
    
    /* ============================================
       HEADER TOP - Version mobile avec bannière bleue
       DISPARAÎT au scroll - Pas sticky
       ============================================ */
    .header-top {
        padding: 0.75rem 0 !important;
        font-size: 0.75rem;
        background-color: #2563eb !important; /* Bleu vif style ok-jardin */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important; /* Pas sticky - disparaît au scroll */
        top: auto !important;
        z-index: 1001 !important;
        width: 100% !important;
        transition: transform 0.3s ease, opacity 0.3s ease !important;
    }
    
    /* Masquer header-top quand on scroll */
    .header-top.hidden-on-scroll {
        transform: translateY(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    .header-top-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        display: flex !important; /* S'assurer qu'il est visible */
    }
    
    .header-top-left {
        flex-direction: column;
        gap: 0.35rem;
        width: 100%;
        display: flex !important; /* S'assurer qu'il est visible */
    }
    
    .header-top-right {
        display: flex !important; /* Afficher sur mobile */
        gap: 0.5rem;
        align-items: center;
        margin-left: auto;
    }
    
    .header-top-contact-btn {
        color: white !important;
        text-decoration: none;
        font-size: 0.75rem;
        font-weight: 500;
        padding: 0.4rem 0.8rem;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 4px;
        transition: background 0.2s;
        white-space: nowrap;
        display: inline-block !important;
    }
    
    .header-top-contact-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* Masquer Newsletter */
    .header-top-right a[href="#newsletter"] {
        display: none !important;
    }
    
    .promo-text {
        font-size: 0.8rem;
        line-height: 1.4;
        color: white !important; /* Texte blanc sur fond bleu */
        font-weight: 500;
        display: flex !important; /* S'assurer qu'il est visible */
        align-items: center;
        gap: 0.5rem;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .promo-text::before {
        content: '💬';
        font-size: 1rem;
        display: inline-block;
    }
    
    .phone-text {
        font-size: 0.75rem;
        line-height: 1.4;
        color: rgba(255, 255, 255, 0.95) !important; /* Texte blanc légèrement transparent */
        font-weight: 400;
        display: flex !important; /* S'assurer qu'il est visible */
        align-items: center;
        gap: 0.5rem;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .phone-text::before {
        content: '';
        width: 0;
        height: 0;
    }
    
    /* ============================================
       HEADER MAIN - Version mobile style ok-jardin avec fond bleu
       STICKY - Reste fixe en haut quand on scroll
       ============================================ */
    .header {
        padding: 0.5rem 0;
        background: #0f172a !important; /* Fond bleu foncé comme desktop */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        position: sticky !important; /* STICKY - Reste fixe en haut */
        top: 0 !important; /* Fixe en haut de l'écran */
        z-index: 1000 !important;
        width: 100% !important;
    }
    
    .header-main {
        flex-wrap: nowrap;
        gap: 0 !important; /* AUCUN GAP - Pour rapprocher au maximum logo/search des favoris */
        padding: 0.5rem 0.25rem 0.5rem 0.5rem !important; /* Padding droit réduit pour tout décaler à droite */
        align-items: center;
        justify-content: space-between !important; /* Space-between pour contrôler l'espacement */
        position: relative;
    }
    
    /* Hamburger menu (catégorie) - à gauche */
    .mobile-menu-toggle {
        flex: 0 0 auto;
        order: 1;
        width: 28px !important; /* RESSERRÉ */
        height: 28px !important; /* RESSERRÉ */
        color: white !important;
        padding: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        cursor: pointer !important;
        pointer-events: auto !important;
        z-index: 10001 !important;
        position: relative;
        margin-right: auto !important; /* Pousse le logo boutique à gauche */
        transform: translateX(-10px) !important; /* Décalage supplémentaire à gauche */
    }
    
    /* Logo et texte - DÉCALÉ PLUS À DROITE */
    .logo {
        flex: 0 1 auto;
        gap: 0.3rem !important; /* RESSERRÉ */
        order: 2;
        min-width: 0;
        display: flex !important;
        align-items: center;
        text-decoration: none;
        margin-left: 0 !important;
        margin-right: auto !important; /* Pousse la recherche et les favoris vers la droite */
        background: transparent !important; /* Pas de fond encadré */
        border: none !important; /* Pas de bordure encadrée */
        padding: 0 !important; /* Pas de padding encadré */
        position: relative;
        transform: translateX(30px) !important; /* Décalage PLUS à droite */
    }
    
    .logo img,
    .logo img[src*="logo"] {
        width: 55px !important; /* ENCORE PLUS GROS */
        height: 55px !important; /* ENCORE PLUS GROS */
        min-width: 55px !important; /* Force la largeur minimale */
        min-height: 55px !important; /* Force la hauteur minimale */
        max-width: 55px !important; /* Force la largeur maximale */
        max-height: 55px !important; /* Force la hauteur maximale */
        aspect-ratio: 1 / 1 !important; /* Force le ratio 1:1 pour un cercle parfait */
        flex-shrink: 0 !important;
        filter: none !important; /* Pas de filtre qui pourrait le rendre gris */
        margin-left: -10px !important; /* Décalage supplémentaire à gauche pour le logo */
        padding: 0 !important; /* Pas de padding qui pourrait déformer */
        border-radius: 50% !important; /* ROND PARFAIT */
        object-fit: cover !important; /* Couvre bien le cercle */
        display: block !important; /* Block pour éviter les espaces inline */
        box-sizing: border-box !important; /* Box-sizing pour éviter les dépassements */
    }
    
    /* Surcharger les styles inline du HTML - règles très spécifiques pour forcer le logo ROND */
    header .header .logo img,
    header .header-main .logo img,
    .header .container .header-main .logo img,
    header .logo img,
    .header-main .logo img {
        height: 55px !important;
        width: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
        max-width: 55px !important;
        max-height: 55px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: block !important;
        /* Forcer les dimensions pour garantir un cercle parfait */
        overflow: hidden !important;
    }
    
    .logo-text {
        font-size: 0.75rem !important; /* RESSERRÉ */
        color: white !important; /* Blanc comme les autres éléments */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: none !important; /* Masquer le texte sur mobile pour gagner de l'espace */
    }
    
    /* Forcer la couleur blanche pour le logo et la recherche - override toutes les autres règles */
    .header .logo,
    .header .logo * {
        color: white !important;
    }
    
    .header .search-bar,
    .header .search-bar *,
    .header .search-btn,
    .header .search-btn * {
        color: white !important;
        fill: white !important;
    }
    
    /* Barre de recherche compacte - icône seulement - sans encadrement comme index6.html - PLUS À DROITE */
    .search-bar {
        order: 3;
        flex: 0 0 auto;
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: relative;
        background: transparent !important; /* Pas de fond encadré */
        border: none !important; /* Pas de bordure encadrée */
        padding: 0 !important; /* Pas de padding encadré */
        margin: 0 !important; /* Pas de marge encadrée */
        margin-left: 0 !important; /* Pas de marge gauche - colle au logo */
        margin-right: -20px !important; /* Marge négative pour rapprocher des favoris */
        border-radius: 0 !important; /* Pas de border-radius encadré */
        transform: translateX(25px) !important; /* Décalage PLUS vers la droite */
    }
    
    .search-bar .search-input {
        display: none !important; /* Masquer l'input sur mobile */
    }
    
    .search-bar .search-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 28px !important; /* RESSERRÉ */
        height: 28px !important; /* RESSERRÉ */
        padding: 0;
        background: transparent;
        border: none !important;
        cursor: pointer;
        padding: 0;
        margin: 0;
        color: white !important; /* Blanc comme les autres icônes */
    }
    
    .search-bar .search-btn svg {
        width: 18px !important; /* RESSERRÉ */
        height: 18px !important; /* RESSERRÉ */
        color: white !important; /* Blanc comme les autres icônes */
        fill: white !important; /* Blanc pour le remplissage aussi */
    }
    
    /* Barre de recherche étendue - apparaît juste en dessous du header en bleu */
    .search-bar-expanded {
        position: absolute;
        top: 100% !important; /* Juste en dessous du header */
        left: 0;
        right: 0;
        width: 100% !important;
        background: #0f172a !important; /* Fond bleu comme le header */
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        display: none !important; /* Masquée par défaut */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0 !important;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .search-bar-expanded.active {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .search-bar-expanded .container {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-direction: row !important; /* S'assurer que c'est en ligne */
    }
    
    .search-bar-expanded .search-input {
        display: block !important;
        flex: 1 1 auto !important;
        min-width: 0 !important; /* Permet au flex de fonctionner */
        max-width: 100% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        height: 44px !important;
        border-radius: 8px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        background: rgba(255, 255, 255, 0.1) !important;
        color: white !important;
        margin-right: 0.5rem;
        box-sizing: border-box;
    }
    
    .search-bar-expanded .search-input::placeholder {
        color: rgba(255, 255, 255, 0.7) !important;
        font-size: 0.9rem !important;
    }
    
    /* Masquer le bouton de recherche (loupe) dans la barre étendue */
    .search-bar-expanded .search-btn {
        display: none !important;
    }
    
    /* Croix pour fermer à droite de l'input */
    .search-bar-expanded .search-close-btn {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        color: white !important;
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .search-bar-expanded .search-close-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* Header avec position relative pour la barre de recherche */
    /* Header reste sticky - ne pas surcharger */
    /* .header position déjà définie plus haut comme sticky */
    
    /* Icônes header (favoris, compte, panier) - à droite - PROCHE du search */
    .header-icons {
        order: 4 !important;
        gap: 0.35rem !important; /* RESSERRÉ */
        flex: 0 0 auto;
        display: flex !important;
        align-items: center;
        margin-left: 0 !important; /* Pas de marge négative - position normale */
        margin-right: 0 !important; /* Collées au bord droit */
    }
    
    .header-icon {
        position: relative;
        color: white !important;
        width: 28px !important; /* RESSERRÉ */
        height: 28px !important; /* RESSERRÉ */
        display: flex !important; /* S'assurer que compte est visible */
        align-items: center;
        justify-content: center;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        border-radius: 4px;
        transition: background 0.2s;
    }
    
    .header-icon svg {
        width: 18px !important; /* RESSERRÉ */
        height: 18px !important; /* RESSERRÉ */
    }
    
    .header-icon:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .favorites-count,
    .cart-count {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #e91e63;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 600;
    }
    
    /* Masquer la navigation desktop sur mobile */
    .main-nav-vertical {
        display: none !important;
    }
    
    /* Afficher le menu hamburger uniquement sur mobile */
    .mobile-menu-toggle.hidden-desktop {
        display: flex !important;
    }
    
    /* Barre de séparation avant nav - masquer */
    .header > .container > div[style*="width: 100%"][style*="height: 1px"] {
        display: none !important;
    }
    
    /* ============================================
       MENU MOBILE LATERAL (Drawer)
       ============================================ */
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        display: none; /* Masqué par défaut */
        transition: opacity 0.3s, visibility 0.3s;
    }
    
    .mobile-nav-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important; /* Afficher quand actif */
    }
    
    .mobile-nav-drawer {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        background: white;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
        -webkit-overflow-scrolling: touch;
        display: none; /* Masqué par défaut */
        visibility: hidden;
    }
    
    .mobile-nav-drawer.active {
        transform: translateX(0) !important;
        display: block !important; /* Afficher quand actif */
        visibility: visible !important;
    }
    
    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        background: #0f172a;
        color: white;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-nav-title {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 600;
    }
    
    .mobile-nav-close {
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        transition: background 0.2s;
    }
    
    .mobile-nav-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-nav-content {
        padding: 1rem 0;
    }
    
    .mobile-nav-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
        color: #0f172a;
        text-decoration: none;
        border-bottom: 1px solid #f1f5f9;
        transition: background 0.2s;
        font-weight: 500;
    }
    
    .mobile-nav-item:hover {
        background: #f8fafc;
    }
    
    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .mobile-nav-item.has-submenu::after {
        content: '›';
        margin-left: auto;
        font-size: 1.2rem;
        color: #64748b;
    }
    
    .mobile-nav-submenu {
        display: none !important;
        background: #f8fafc;
        padding: 0.5rem 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }
    
    .mobile-nav-submenu.active {
        display: block !important;
        max-height: 60vh !important;
        padding: 0.5rem 0;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        transition: padding 0.3s ease;
        position: relative;
        z-index: 1;
    }
    
    .mobile-nav-subitem {
        display: block;
        padding: 0.75rem 1.25rem 0.75rem 3rem;
        color: #475569;
        text-decoration: none;
        font-size: 0.9rem;
        border-bottom: 1px solid #e2e8f0;
        transition: background 0.2s;
    }
    
    .mobile-nav-subitem:hover {
        background: #f1f5f9;
    }
    
    .mobile-nav-submenu .mobile-nav-item {
        padding-left: 3rem;
        font-size: 0.9rem;
        color: #475569;
    }
    
    /* ============================================
       MENU MOBILE - Dropdown (catégories avec sous-menus)
       ============================================ */
    .mobile-nav-dropdown {
        display: flex;
        flex-direction: column;
    }
    
    .mobile-nav-dropdown-btn {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
        width: 100%;
        background: transparent;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        color: #0f172a;
        text-decoration: none;
        font-weight: 500;
        font-size: 1rem;
        cursor: pointer;
        transition: background 0.2s;
        text-align: left;
    }
    
    .mobile-nav-dropdown-btn:hover {
        background: #f8fafc;
    }
    
    .mobile-nav-dropdown-btn svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .mobile-nav-dropdown-btn .dropdown-arrow {
        margin-left: auto;
        transition: transform 0.3s ease;
    }
    
    .mobile-nav-dropdown-btn.active .dropdown-arrow {
        transform: rotate(180deg);
    }
    
    .mobile-nav-dropdown-content {
        display: none;
        background: #f8fafc;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }
    
    .mobile-nav-dropdown-content.active {
        display: block;
        max-height: 2000px;
        padding: 0.5rem 0;
    }
    
    .mobile-nav-dropdown-content a {
        display: block;
        padding: 0.75rem 1.25rem 0.75rem 3rem;
        color: #475569;
        text-decoration: none;
        font-size: 0.9rem;
        border-bottom: 1px solid #e2e8f0;
        transition: background 0.2s;
    }
    
    .mobile-nav-dropdown-content a:hover {
        background: #f1f5f9;
        color: #0f172a;
    }
    
    .mobile-nav-dropdown-content a:last-child {
        border-bottom: none;
    }
    
    /* Footer bottom - Texte en blanc sur mobile aussi */
    .footer-bottom {
        color: white !important;
    }
    
    .footer-bottom p {
        color: white !important;
    }
}
