/* ESS Frontend Styles */

.ess-recently-viewed-wrapper,
.ess-trending-products-wrapper,
.ess-smart-products-wrapper {
    margin: 40px auto;
    max-width: 100%;
    position: relative;
    padding: 0 40px; /* Espace pour les flèches */
}

.ess-section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    color: #333;
}

/* Swiper Adjustments */
.ess-product-slider {
    padding-bottom: 20px; /* Espace pour l'ombre éventuelle des cartes */
}

/* Force product cards inside slider to fit well */
.ess-product-slider .swiper-slide {
    height: auto; /* Permet aux cartes d'avoir la même hauteur */
    display: flex;
}

.ess-product-slider .swiper-slide > div,
.ess-product-slider .swiper-slide > li {
    width: 100% !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

/* Custom Navigation Arrows */
.ess-product-slider .swiper-button-next,
.ess-product-slider .swiper-button-prev {
    color: #333; /* Couleur des flèches */
    background: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    top: 40%; /* Légèrement plus haut pour s'aligner avec l'image et non la carte entière */
    transform: translateY(-50%);
}

.ess-product-slider .swiper-button-next:after,
.ess-product-slider .swiper-button-prev:after {
    font-size: 16px;
    font-weight: bold;
}

/* Image Size Control to prevent giant images */
.ess-product-slider .swiper-slide img {
    max-height: 200px;
    width: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* Make text a bit smaller inside the slider */
.ess-product-slider .swiper-slide .woocommerce-loop-product__title {
    font-size: 14px;
    margin-top: 10px;
    line-height: 1.3;
}

.ess-product-slider .swiper-slide .price {
    font-size: 14px;
}

/* Position arrows outside the slider */
.ess-product-slider .swiper-button-prev {
    left: -40px;
}
.ess-product-slider .swiper-button-next {
    right: -40px;
}

@media (max-width: 768px) {
    .ess-recently-viewed-wrapper,
    .ess-trending-products-wrapper,
    .ess-smart-products-wrapper {
        padding: 0 10px;
    }
    
    .ess-product-slider .swiper-button-prev,
    .ess-product-slider .swiper-button-next {
        display: none; /* Hide arrows on mobile, let user swipe */
    }
}

/* -------------------------------------
 * HERO SLIDER (Full Width Banner)
 * ------------------------------------- */

.ess-hero-slider-wrapper {
    /* Force Full Width by breaking out of theme containers */
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    margin-left: 0;
    margin-right: 0;
    
    /* Remove top gap from theme */
    margin-top: -60px; /* Augmenté pour contrer le padding du thème Electro/WooCommerce */
    
    margin-bottom: -100px; /* Réduit (au lieu de -150px) pour descendre un peu les blocs Bento */
    z-index: 1;
    overflow: hidden; /* Empêche tout dépassement horizontal */
    background: transparent !important;
    border: none !important;
}

/* Force override of typical theme content wrappers if they exist right above */
.site-content,
#content,
.page-content,
.site-main,
.elementor-section,
.site-content-inner {
    padding-top: 0 !important;
    background-color: transparent !important; 
    background: none !important;
    box-shadow: none !important; 
    border: none !important;
}

/* Kill any pseudo-elements causing inner shadows in Electro/Woo themes */
.site-content::before,
#content::before,
.page-content::before,
.site-main::before,
.site-content::after,
#content::after,
.page-content::after,
.site-main::after {
    display: none !important;
    content: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Fix global background color if body is black behind content */
body {
    background-color: #f3f4f6 !important; /* Assure que le fond global est gris clair/blanc et non noir */
}

/* Remove any potential gap at the bottom of the slider */
.ess-hero-slider-wrapper,
.ess-hero-swiper,
.ess-hero-swiper .swiper-slide {
    line-height: 0;
}

.ess-hero-swiper {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: none !important;
}

/* Pagination styles */
.ess-hero-swiper .swiper-pagination {
    bottom: 20px; /* Position dots higher up */
}

.ess-hero-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #ccc;
    opacity: 1;
    margin: 0 4px !important;
}

.ess-hero-swiper .swiper-pagination-bullet-active {
    background: #007bff; /* Blue dot for active slide */
}

.ess-hero-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: auto; /* S'adapte à la hauteur de l'image au lieu de forcer 450px */
    border: none !important;
    outline: none !important;
    background: transparent !important; /* Force la transparence pour écraser la couleur noire enregistrée */
}

.ess-hero-swiper .swiper-slide a {
    display: block;
    width: 100%;
    height: 100%;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.ess-hero-swiper .swiper-slide picture {
    display: block;
    width: 100%;
    height: 100%;
}

.ess-hero-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Dégradé doux pour faire la transition vers le fond du site (Effet Amazon) */
.ess-hero-gradient-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px; /* Assez haut pour couvrir le bas de l'image */
    /* Dégradé de totalement transparent vers la couleur de fond de ton site (gris très clair #f3f4f6) */
    /* AUCUN noir n'est utilisé ici, seulement la couleur de fond #f3f4f6 avec différentes opacités */
    background: linear-gradient(to bottom, rgba(243, 244, 246, 0) 0%, rgba(243, 244, 246, 0.8) 60%, rgba(243, 244, 246, 1) 100%);
    z-index: 2;
    pointer-events: none; /* Empêche le dégradé de bloquer les clics sur l'image */
    display: block !important; /* Force l'affichage */
}

/* Ajustement des flèches pour ce grand slider */
.ess-hero-swiper .ess-hero-nav {
    background: rgba(255, 255, 255, 0.9);
    width: 50px;
    height: 80px;
    border-radius: 4px;
    color: #333;
    top: 40%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
}
.ess-hero-swiper .swiper-button-prev { left: 0; border-radius: 0 4px 4px 0; }
.ess-hero-swiper .swiper-button-next { right: 0; border-radius: 4px 0 0 4px; }

@media (max-width: 768px) {
    /* Main wrapper: Full width with negative margin bottom for overlap */
    .ess-hero-slider-wrapper {
        width: 100vw !important;
        max-width: 100vw !important;
        position: relative;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: -60px !important; /* Offset theme padding */
        margin-bottom: -50px !important; /* Overlap effect for elements below */
        padding: 0 !important;
        overflow: hidden !important;
    }
    
    .ess-hero-swiper {
        border-radius: 0 !important;
        overflow: hidden !important;
        box-shadow: none !important;
    }

    .ess-hero-swiper .swiper-slide {
        height: auto !important; 
        min-height: 250px; /* Assure une hauteur minimum si pas d'image mobile spécifique */
        transition: none;
        opacity: 1;
        transform: scale(1);
        border-radius: 0 !important;
        box-shadow: none;
    }
    
    .ess-hero-img {
        height: auto !important; 
        width: 100% !important;
        object-fit: cover !important; 
        min-height: 250px !important;
        border-radius: 0 !important;
    }
    
    /* Si une image mobile spécifique est chargée, on laisse sa hauteur naturelle */
    .ess-hero-swiper .has-mobile-image .ess-hero-img {
        min-height: unset !important;
        object-fit: contain !important;
    }
    
    /* Re-enable gradient mask for fade effect at the bottom */
    .ess-hero-gradient-mask {
        display: block !important; 
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100px;
        background: linear-gradient(to top, #f3f4f6 0%, transparent 100%);
        z-index: 5;
        pointer-events: none;
    }
    
    /* Position dots over the fade/image */
    .ess-hero-swiper .swiper-pagination {
        display: block !important;
        position: absolute !important; 
        bottom: 60px !important; /* Position just above the overlapped bento block */
        z-index: 10;
    }
    .ess-hero-swiper .swiper-pagination-bullet {
        width: 8px;
        height: 8px;
        background: #d4d4d4;
        opacity: 1;
        margin: 0 4px !important;
    }
    .ess-hero-swiper .swiper-pagination-bullet-active {
        background: #0044ff; /* Blue dot for active slide */
    }
    
    /* Elegant rounded arrows inside the banner */
    .ess-hero-swiper .ess-hero-nav {
        display: flex !important; /* Show arrows on mobile */
        width: 28px;
        height: 28px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 6px;
        top: 50%;
        transform: translateY(-50%);
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        margin-top: -14px;
        z-index: 10;
    }
    
    .ess-hero-swiper .swiper-button-prev { left: 10px; }
    .ess-hero-swiper .swiper-button-next { right: 10px; }
    
    .ess-hero-swiper .ess-hero-nav:after {
        font-size: 12px;
        color: #333;
        font-weight: bold;
    }
}

/* -------------------------------------
 * BENTO DYNAMIC BLOCKS (Amazon Style)
 * ------------------------------------- */

.ess-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 0 auto 40px auto; 
    max-width: 1400px;
    padding: 0 20px;
    position: relative;
    z-index: 100; /* Doit être très élevé pour passer par-dessus le masque du slider */
}

.ess-bento-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.ess-bento-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #111;
    min-height: 44px; /* Align titles */
}

.ess-bento-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.ess-bento-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.ess-bento-item:hover .ess-bento-img {
    transform: scale(1.05);
}

.ess-bento-img {
    width: 100%;
    padding-bottom: 100%; /* 1:1 Aspect Ratio */
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #ffffff; /* Remplacé le gris par du blanc pur pour que ce soit invisible sans image */
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.ess-bento-item-title {
    font-size: 12px;
    color: #333;
    line-height: 1.3;
    text-align: left;
}

.ess-bento-link {
    color: #007185;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-top: auto;
}

.ess-bento-link:hover {
    color: #c45500;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .ess-bento-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------
 * NEWS / CAMPAIGNS SLIDER (Custom Ads)
 * ------------------------------------- */

.ess-news-slider-wrapper {
    margin: 40px auto;
    max-width: 1400px;
    position: relative;
    padding: 0 40px;
}

.ess-news-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eaeaea;
    transition: box-shadow 0.3s ease;
}

.ess-news-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.ess-news-card-bg {
    position: relative;
    padding: 20px;
    text-align: center;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ess-news-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff003c;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 2;
}

.ess-news-image {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.ess-news-multi-images {
    display: flex;
    gap: 10px;
    justify-content: center;
    position: relative;
    z-index: 1;
    width: 100%;
}

.ess-news-multi-images img {
    max-height: 140px;
    width: auto;
    object-fit: contain;
    flex: 1;
    min-width: 0;
}

.ess-news-custom-text {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    margin-top: 15px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.ess-news-product-info {
    padding: 15px;
    background: #fff;
}

.ess-news-product-title {
    font-size: 14px;
    color: #333;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.ess-news-product-price {
    font-size: 16px;
    font-weight: bold;
    color: #e53e3e;
}

.ess-news-product-price del {
    color: #999;
    font-size: 13px;
    font-weight: normal;
    margin-right: 5px;
}

/* -------------------------------------
 * PRODUCT OFFERS BANNERS
 * ------------------------------------- */
.ess-product-offers-container {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ess-product-offer-banner {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 8px;
    width: fit-content;
}

.ess-offer-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: none;
    line-height: 1;
}

.ess-offer-main-text {
    display: flex;
    align-items: center;
    font-weight: 500;
    gap: 4px;
}

.ess-offer-icon {
    margin-right: 2px;
}

.ess-offer-popup-trigger {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.ess-offer-popup-trigger:hover {
    color: #333;
}

.ess-offer-popup-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    border-radius: 6px;
    width: 250px;
    z-index: 100;
    font-size: 12px;
    font-weight: normal;
    margin-bottom: 8px;
    text-align: left;
}

.ess-offer-popup-trigger:hover .ess-offer-popup-content,
.ess-offer-popup-trigger:focus .ess-offer-popup-content {
    display: block;
}

.ess-offer-popup-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}
.ess-offer-popup-content::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -7px;
    border-width: 7px;
    border-style: solid;
    border-color: #ddd transparent transparent transparent;
}
