/* ==========================================================================
   Hero Banner Premium Custom
   ========================================================================== */
.wstm-hero-banner {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 250px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex !important;
    align-items: flex-end !important; /* Place le texte tout en bas */
    justify-content: center !important;
    text-align: center;
    margin-bottom: 15px !important; /* Réduit l'espace sous l'image */
    border-radius: 12px;
    overflow: hidden;
}

/* Masquer le banner par défaut de Shoptimizer si le nôtre est affiché */
.wstm-has-hero-banner .shoptimizer-category-banner {
    display: none !important;
}

.wstm-hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

.wstm-hero-content {
    position: relative;
    z-index: 2;
    color: #fff;
    padding: 10px 20px !important;
    max-width: 800px;
    margin-bottom: 5px !important; /* Collé au bord bas */
}

/* Force le style non-bold (500), petit (1.1rem) et en bas de l'image */
.wstm-hero-banner .wstm-hero-content h1.woocommerce-products-header__title.page-title,
.wstm-hero-banner .wstm-hero-content h1.page-title {
    position: static !important;
    transform: none !important;
    color: #fff !important;
    font-size: 1.1rem !important; /* Plus petit */
    font-weight: 500 !important; /* Pas en gras (Regular/Medium) */
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.wstm-hero-desc {
    font-size: 0.9rem;
    line-height: 1.3;
    color: #f1f1f1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    margin-top: 2px;
}

/* Version responsive pour Mobile / Smartphones */
@media (max-width: 768px) {
    .wstm-hero-banner {
        min-height: 120px !important; /* Hauteur très compacte */
        margin-bottom: 8px !important; /* Espacement minime sous l'image */
        border-radius: 8px !important;
    }
    .wstm-hero-content {
        padding: 5px 10px !important;
        margin-bottom: 3px !important;
    }
    .wstm-hero-content h1.page-title {
        font-size: 1.05rem !important; /* Plus petit */
        margin-bottom: 2px !important;
        letter-spacing: 0.2px !important;
    }
    .wstm-hero-desc {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
        display: none !important; /* Cache la description sur mobile pour gagner de la place */
    }

    /* Réduction globale des marges pour afficher la première ligne de produits sans scroll */
    .wstm-pills-container {
        margin: 5px 0 !important;
        padding: 0 !important;
        float: none !important;
        max-width: 100% !important;
        display: block !important;
    }
    .woocommerce-products-header {
        margin-bottom: 5px !important;
    }
    .woocommerce-archive-description {
        margin: 0 !important;
    }
    
    /* Cibler les autres espaces WooCommerce du thème */
    .woocommerce-breadcrumb, 
    .woocommerce-breadcrumbs {
        margin-bottom: 5px !important;
        font-size: 11px !important;
        padding: 2px 0 !important;
    }
    
    /* Espacements de filtre Shoptimizer */
    .shoptimizer-sorting,
    .woocommerce-sorting,
    .storefront-sorting,
    .before-shop-loop {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 8px !important;
        margin-top: 5px !important;
        float: none !important;
        text-align: left !important;
        gap: 5px !important;
    }

    .shoptimizer-sorting .wstm-pills-container,
    .woocommerce-sorting .wstm-pills-container,
    .storefront-sorting .wstm-pills-container,
    .before-shop-loop .wstm-pills-container {
        float: none !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        display: block !important;
        order: 1 !important; /* Force les Pills en premier */
        margin: 5px 0 !important;
        padding: 0 !important;
    }

    .shoptimizer-sorting .woocommerce-ordering,
    .woocommerce-sorting .woocommerce-ordering,
    .storefront-sorting .woocommerce-ordering,
    .before-shop-loop .woocommerce-ordering {
        float: none !important;
        display: block !important;
        order: 2 !important; /* Force le tri en deuxième */
        width: 100% !important;
        max-width: 100% !important;
        margin: 5px 0 !important;
        text-align: left !important;
    }
    
    body.rtl .woocommerce-ordering {
        float: none !important;
        text-align: right !important;
    }
}

/* ==========================================================================
   Pills Filters (Footkorner Style)
   ========================================================================== */
/* Supprimer l'espace beige ou blanc inutile entre l'image et les pills */
.wstm-has-hero-banner .woocommerce-breadcrumb,
.wstm-has-hero-banner .woocommerce-breadcrumbs,
.wstm-has-hero-banner .shoptimizer-sorting,
.wstm-has-hero-banner .woocommerce-products-header,
.wstm-has-hero-banner .woocommerce-archive-description,
.wstm-has-hero-banner .term-description {
    background-color: transparent !important;
    background: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
}

/* Layout parent sur Desktop (Stacking vertical ordonné) */
.shoptimizer-sorting,
.woocommerce-sorting,
.storefront-sorting,
.before-shop-loop {
    display: flex !important;
    flex-direction: column !important; /* Empilement vertical sur PC */
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
}

.wstm-pills-container {
    background-color: transparent !important;
    padding: 0 !important;
    margin: 8px 0 !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    display: block !important;
    float: none !important;
    clear: both !important;
    order: 1 !important; /* Les Pills restent en haut sur PC */
    overflow: hidden !important;
}

/* Le menu de tri de WooCommerce - Placé proprement en dessous des pills */
.woocommerce-ordering {
    display: block !important;
    float: right !important; /* Aligné à droite sur desktop */
    clear: both !important; /* Force le passage à la ligne en dessous des pills */
    margin: 5px 0 10px 0 !important;
    padding: 0 !important;
    order: 2 !important; /* Le Tri en dessous sur PC */
    z-index: 10;
}

body.rtl .woocommerce-ordering {
    float: left !important;
}

/* Empêcher les produits de monter dans le float */
ul.products {
    clear: both !important;
}

.wstm-pills-list {
    display: flex !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 5px !important;
    list-style: none !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
}

.wstm-pills-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.wstm-pill {
    margin: 0 !important;
    flex-shrink: 0 !important; /* Force les boutons à ne pas se contracter */
}

.wstm-pill a {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f5f5f5;
    color: #333;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.wstm-pill:hover a {
    background-color: #eaeaea;
}

.wstm-pill.active a {
    background-color: #000;
    color: #fff;
    border-color: #000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Transitions pour AJAX */
ul.products {
    transition: opacity 0.3s ease;
}
ul.products.wstm-loading {
    pointer-events: none;
}

/* RTL Support */
body.rtl .wstm-hero-content {
    text-align: right;
}

body.rtl .wstm-pills-list {
    flex-direction: row-reverse;
}

body.rtl .wstm-social-proof .wstm-sp-content {
    flex-direction: row-reverse;
}

body.rtl .wstm-sp-text-wrapper {
    text-align: right;
}

/* ==========================================================================
   Product Category Loop Badges Styling (Small, Inline, Scrollable Slider)
   ========================================================================== */
.product .product-categories,
.product .shoptimizer-loop-category,
.product .woocommerce-loop-product-categories,
.product .product-category-list,
.product .category-list,
.product .wstm-badges-wrapper.wstm-relative {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    gap: 4px !important;
    scrollbar-width: none !important; /* Firefox */
    -webkit-overflow-scrolling: touch !important; /* Touch smooth scroll */
    padding: 3px 0 !important;
    margin: 5px 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    justify-content: flex-start !important;
}

/* Cache les barres de défilement */
.product .product-categories::-webkit-scrollbar,
.product .shoptimizer-loop-category::-webkit-scrollbar,
.product .woocommerce-loop-product-categories::-webkit-scrollbar,
.product .wstm-badges-wrapper::-webkit-scrollbar {
    display: none !important;
}

/* Style des liens badges de catégories */
.product .product-categories a,
.product .shoptimizer-loop-category a,
.product .woocommerce-loop-product-categories a,
.product .product-category-list a,
.product .category-list a,
.product .wstm-badges-wrapper .wstm-badge {
    font-size: 10px !important;
    padding: 3px 7px !important;
    border-radius: 12px !important;
    display: inline-block !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-weight: 600 !important;
}

body.rtl .product .product-categories,
body.rtl .product .shoptimizer-loop-category,
body.rtl .product .woocommerce-loop-product-categories,
body.rtl .product .product-category-list,
body.rtl .product .category-list,
body.rtl .product .wstm-badges-wrapper.wstm-relative {
    flex-direction: row !important; /* Conserve le défilement horizontal correct */
}
