@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400..700&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');

/* --- ANTI-ZOOM & OPTIMISATION MOBILE --- */
a, button, input, .burger-menu-icon, .icon img {
    touch-action: manipulation;
}

/* --- UTILITAIRES D'AFFICHAGE --- */
.mobile-visible { display: none; } /* Caché sur PC par défaut */
.desktop-only { display: block; }  /* Visible sur PC par défaut */

/* --- HEADER GLOBAL (DESKTOP) --- */
.header-accueil {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #B49282; /* Beige moyen */
    color: #333333;
    padding: 10px 20px;
    font-family: Arial, sans-serif;
    gap: 20px;
    border-bottom: none; 
}

.header-autres {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #B49282;
    color: #333333;
    padding: 10px 20px;
    font-family: Arial, sans-serif;
    position: relative;
    border-bottom: none;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* --- LOGO & ELEMENTS --- */
.logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.logo a { text-decoration: none; }

.logo-img {
    width: 170px;
    height: 70px;
    transition: transform 0.3s ease;
    border-radius: 45px;
    overflow: hidden;
    margin-top: 3px;
    object-fit: cover;
}
.logo-img:hover { transform: scale(1.05); }

/* --- ICONES & NAVIGATION --- */
.icon {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 5px;
    margin-right: 10px;
}

.favoris {
    margin-right: 5px; 
}

/* CORRECTION ICI : J'ai retiré .search-mobile-icon de cette liste pour qu'il reste caché sur PC */
.panier, .user-icon, .favoris {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 10px;
}

.search-icon-img {
    margin-right: 5px;
}

.panier-img, .favori-img, .user-img, .search-icon-img {
    width: 30px;
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.user-img { height: 30px; width: 30px; }

.panier-img:hover, .favori-img:hover, .user-img:hover, .search-icon-img:hover { transform: scale(1.1); }

/* Notification Panier */
.panier-notif {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #D9534F;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* --- SEARCH BAR (DESKTOP CLASSIQUE) --- */
.search-bar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    max-width: 600px;
    flex: 1;
    margin: 0 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 20px;
    padding: 5px 15px;
    width: 100%;
    border: 1px solid #CFC7BC;
}

.search-input {
    border: none;
    outline: none;
    padding: 5px;
    width: 100%;
    font-size: 14px;
}

.search-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #B49282;
}

#searchResultsDropdown {
    display: none; 
    position: absolute;
    background-color: #ffffff;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    border-radius: 5px;
    z-index: 1000;
    width: 100%;      
    top: 100%; left: 0;            
}

/* --- ITEMS SUGGESTIONS (Commun Desktop & Mobile) --- */
.suggestion-item {
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    color: #333;
    font-size: 14px;
    /* Ajout d'une bordure pour séparer les éléments proprement */
    border-bottom: 1px solid #f0f0f0;
}
.suggestion-item:last-child {
    border-bottom: none;
}
.suggestion-item:hover { background-color: #F9F7F5; cursor: pointer; }

/* --- STYLE DE L'OVERLAY RECHERCHE (MOBILE) --- */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 10000; /* Au dessus de tout */
    display: none; /* Caché par défaut */
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.search-overlay.open {
    display: flex;
}

.search-header-row {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #333; /* La ligne noire soulignée */
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.search-icon-input {
    font-size: 18px;
    color: #333;
    margin-right: 15px;
}

#searchOverlayInput {
    width: 100%;
    border: none;
    outline: none;
    font-size: 18px;
    color: #555;
    background: transparent;
}

.close-search {
    font-size: 28px;
    cursor: pointer;
    color: #333;
    margin-left: 10px;
}

/* NOUVEAU : Conteneur pour les résultats dynamiques dans l'overlay */
#overlaySearchResults {
    width: 100%;
    background-color: #fff;
    /* Permet le scroll si la liste est longue */
    overflow-y: auto;
    flex: 1; 
    display: none; /* Masqué par défaut (géré par JS) */
}

.search-suggestions h3 {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: #000;
}

.search-suggestions ul {
    list-style: none;
    padding: 0;
}

.search-suggestions li {
    margin-bottom: 15px;
}

.search-suggestions a {
    text-decoration: none;
    color: #000;
    font-size: 16px;
    text-transform: uppercase;
}

/* Navbar Link styles */
.navbar ul { list-style: none; margin: 0; padding: 0; display: flex; }
.navbar ul li { margin-left: 20px; }

/* Menu Admin/User Hover (Desktop) */
.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 180px;
    background: #FFFFFF;
    padding: 10px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: none;
    flex-direction: column;
    z-index: 1000;
}
.user-icon:hover .user-menu { display: flex; }
.user-menu a {
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    text-align: left;
}
.user-menu a:hover { background-color: #f5f5f5; color: #B49282; }

/* Elements masqués par défaut sur PC */
.burger-menu-icon, .mobile-menu-sidebar, .mobile-menu-overlay { display: none; }


/* --- SIDE CART (PANIER LATÉRAL) --- */
.side-cart-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5); z-index: 9998;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.side-cart-overlay.open { opacity: 1; visibility: visible; }

.side-cart {
    position: fixed; top: 0; right: -450px;
    width: 400px; max-width: 100%; height: 100vh;
    background-color: #fff; z-index: 9999;
    transition: right 0.4s;
    display: flex; flex-direction: column;
}
.side-cart.open { right: 0; }
.side-cart-header, .side-cart-footer { padding: 20px; border-bottom: 1px solid #eee; }
.side-cart-body { flex: 1; overflow-y: auto; padding: 20px; }


/* --- LISTE DES ARTICLES DANS LE PANIER --- */
.side-cart-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

.item-option {
    color: #888;
    font-size: 0.85rem;
}

.item-price-qty {
    margin-top: 2px;
    color: black;
    font-weight: bold;
    font-size: 0.95rem;
}

.btn-remove-item {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
    padding: 0 10px;
    transition: all 0.3s ease;
}

.btn-remove-item:hover {
    color: #D9534F;
    transform: scale(1.2);
}

/* --- FOOTER DU PANIER ET BOUTONS --- */
.btn-beige-full {
    display: block; width: 100%; padding: 15px;
    background-color: #F5DBC4; color: #000;
    text-align: center; font-weight: bold; border-radius: 50px; border: none; text-decoration: none;
}
.btn-beige-full:hover {
    background-color: #eacfb5;
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 30px; 
    cursor: pointer;
    color: #333;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.3s ease;
}

.close-cart-btn:hover {
    color: #B49282; 
    transform: scale(1.1);
}

.subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 1.1em;
}

.cart-empty-state {
    text-align: center;
    margin-top: 50px;
}
.empty-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #555;
}


/* ========================================================================== */
/* STYLE MOBILE (Adaptation pour Logo Gauche, Menu Droite, Recherche Full)    */
/* ========================================================================== */
@media (max-width: 768px) {

    /* 1. Visibilité */
    /* La classe mobile-visible prend le relais ici grâce au display: flex !important */
    .mobile-visible { display: flex !important; justify-content: center; align-items: center; }
    .desktop-only { display: none !important; }

    /* 2. Header Layout */
    .header-accueil, .header-autres {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 15px;
        flex-wrap: nowrap; /* Force une seule ligne */
    }

    /* 3. Logo à gauche */
    .header-left-group {
        display: none; /* On cache le vieux groupe si présent, ou on s'assure que logo est seul */
    }
    
    .logo {
        order: 1;
        flex-grow: 0;
        margin-right: auto; /* Pousse tout le reste à droite */
        margin-left: 0;
    }
    
    .logo-img {
        width: 130px;
        height: auto;
    }

    /* 4. Navbar (Icones + Burger) à droite */
    .navbar {
        order: 2;
        flex-grow: 0;
        margin-top: 0;
    }

    .navbar ul {
        display: flex;
        gap: 15px;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    .icon {
        display: flex;
        gap: 15px;
        margin: 0;
        align-items: center;
    }

    /* Icônes Mobile */
    .search-mobile-icon i, 
    .burger-menu-icon i {
        font-size: 22px;
        color: #333;
        cursor: pointer;
        display: block !important;
    }

    .search-mobile-icon{
        margin-right: 5px;
    }

    .panier-img, .user-img {
        width: 26px;
        height: 26px;
        margin-right: 5px;
    }
    
    /* Ajout de .search-icon-img pour la taille mobile */
    .panier-img, .user-img, .search-icon-img {
        width: 26px;
        height: 26px;
    }

    /* Padding ajusté pour les icônes */
    .panier, .user-icon, .search-mobile-icon {
        padding: 0;
    }

    /* On cache le conteneur de recherche desktop */
    .search-bar-container {
        display: none;
    }

    /* --- MENU LATÉRAL À DROITE --- */
    .mobile-menu-overlay { display: block; }
    
    .mobile-menu-sidebar {
        position: fixed; top: 0; 
        left: auto; /* On annule le left */
        right: -100%; /* Position initiale à droite (hors écran) */
        width: 85%; max-width: 320px; height: 100vh;
        background: #fff; z-index: 2001;
        transition: right 0.3s ease-out; /* On anime la propriété right */
        display: flex; flex-direction: column;
        box-shadow: -4px 0 10px rgba(0,0,0,0.1); /* Ombre portée vers la gauche */
    }
    
    .mobile-menu-sidebar.open { 
        right: 0; /* Ouvre le menu collé à droite */
    }
    
    .mobile-menu-header {
        padding: 15px 20px; border-bottom: 1px solid #eee;
        display: flex; justify-content: space-between; align-items: center;
    }
    .mobile-menu-title { font-weight: bold; font-size: 1.1rem; }
    .close-mobile-menu { background: none; border: none; font-size: 2rem; }
    .mobile-menu-content { overflow-y: auto; flex: 1; }
    .mobile-section { padding: 15px 0; border-bottom: 8px solid #f2f2f2; }
    .mobile-section-title { padding: 0 20px 10px; margin: 0; font-weight: bold; }
    .mobile-link {
        display: flex; align-items: center; padding: 12px 20px;
        color: #333; border-bottom: 1px solid #f9f9f9;
    }
    .mobile-link i { width: 25px; margin-right: 15px; text-align: center; }
}