/* 
 * Global CSS for Product Recommendations (Related/Upsell) 
 * Applies to all carousel systems (Amasty, Swiper, Hyva)
 */

/* Remove box-shadow from card forms in product recommendations */
.related-product-slider .card,
.related-product-slider .card-interactive,
.widget[data-count-items] .card,
.widget[data-count-items] .card-interactive,
.swiper-container .card,
.swiper-container .card-interactive,
.product-recommendation-item .card,
.product-recommendation-item .card-interactive {
    box-shadow: none !important;
    border: none !important;
}

/* Hide entire button section in product recommendations */
.related-product-slider .mt-auto.pt-3.flex.flex-wrap.justify-center.items-center,
.related-product-slider div[class*="mt-auto"][class*="pt-3"],
.widget[data-count-items] .mt-auto.pt-3.flex.flex-wrap.justify-center.items-center,
.widget[data-count-items] div[class*="mt-auto"][class*="pt-3"],
.swiper-container .mt-auto.pt-3.flex.flex-wrap.justify-center.items-center,
.swiper-container div[class*="mt-auto"][class*="pt-3"],
.product-recommendation-item .mt-auto.pt-3.flex.flex-wrap.justify-center.items-center,
.product-recommendation-item div[class*="mt-auto"][class*="pt-3"] {
    display: none !important;
}

/* Hide Add to Cart buttons in product carousels */
.related-product-slider .btn-primary,
.related-product-slider button[aria-label*="Aggiungi al Carrello"],
.related-product-slider button[aria-label*="Add to Cart"],
.widget[data-count-items] .btn-primary,
.widget[data-count-items] button[aria-label*="Aggiungi al Carrello"],
.swiper-container .btn-primary,
.swiper-container button[aria-label*="Aggiungi al Carrello"] {
    display: none !important;
}

/* Hide rewards/loyalty points text ONLY in product carousels/recommendations */
.related-product-slider .rewards__product-earn-points,
.related-product-slider span:contains("Vale"),
.related-product-slider span:contains("Punti Fedeltà"),
.related-product-slider span:contains("Punti"),
.widget[data-count-items] .rewards__product-earn-points,
.widget[data-count-items] span:contains("Vale"),
.widget[data-count-items] span:contains("Punti Fedeltà"),
.product-recommendation-item .rewards__product-earn-points,
.product-recommendation-item span:contains("Vale"),
.product-recommendation-item span:contains("Punti Fedeltà"),
.related-product-item .rewards__product-earn-points,
.related-product-item span:contains("Vale"),
.related-product-item span:contains("Punti Fedeltà") {
    display: none !important;
}

/* Hide specific Mirasvit rewards elements ONLY in product carousels/recommendations */
.related-product-slider span.flex.whitespace-nowrap.text-tosoni-black,
.related-product-slider svg[viewBox="0 0 16 14"] ~ span,
.widget[data-count-items] span.flex.whitespace-nowrap.text-tosoni-black,
.widget[data-count-items] svg[viewBox="0 0 16 14"] ~ span,
.product-recommendation-item span.flex.whitespace-nowrap.text-tosoni-black,
.product-recommendation-item svg[viewBox="0 0 16 14"] ~ span,
.related-product-item span.flex.whitespace-nowrap.text-tosoni-black,
.related-product-item svg[viewBox="0 0 16 14"] ~ span {
    display: none !important;
}

/* Ensure horizontal layout for all carousel types */
.related-product-slider .js_slides,
.related-product-slider .swiper-wrapper,
.widget[data-count-items] .swiper-wrapper,
.swiper-container .swiper-wrapper,
section[x-data*="initAmRelated"] .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-behavior: smooth !important;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
    cursor: grab !important;
    user-select: none !important;
}

/* Hide scrollbar for webkit browsers */
.related-product-slider .js_slides::-webkit-scrollbar,
.related-product-slider .swiper-wrapper::-webkit-scrollbar,
.widget[data-count-items] .swiper-wrapper::-webkit-scrollbar,
.swiper-container .swiper-wrapper::-webkit-scrollbar,
section[x-data*="initAmRelated"] .swiper-wrapper::-webkit-scrollbar {
    display: none !important;
}

/* Ensure carousel containers have proper scrolling */
.related-product-slider,
.widget[data-count-items],
.swiper-container,
section[x-data*="initAmRelated"] {
    overflow-x: auto !important;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

/* Hide scrollbar for webkit browsers on containers */
.related-product-slider::-webkit-scrollbar,
.widget[data-count-items]::-webkit-scrollbar,
.swiper-container::-webkit-scrollbar,
section[x-data*="initAmRelated"]::-webkit-scrollbar {
    display: none !important;
}

.related-product-slider .js_slide,
.related-product-slider .swiper-slide,
.widget[data-count-items] .swiper-slide,
.swiper-container .swiper-slide,
section[x-data*="initAmRelated"] .swiper-slide {
    flex-shrink: 0 !important;
    margin-right: 0.5rem !important;
}

/* Mobile responsive layout */
@media (max-width: 767px) {
    .related-product-slider .js_slide,
    .related-product-slider .swiper-slide,
    .widget[data-count-items] .swiper-slide,
    .swiper-container .swiper-slide,
    section[x-data*="initAmRelated"] .swiper-slide {
        width: 85% !important;
        min-width: 85% !important;
    }
}

/* Tablet layout */
@media (min-width: 768px) and (max-width: 1023px) {
    .related-product-slider .js_slide,
    .related-product-slider .swiper-slide,
    .widget[data-count-items] .swiper-slide,
    .swiper-container .swiper-slide,
    section[x-data*="initAmRelated"] .swiper-slide {
        width: 48% !important;
        min-width: 48% !important;
    }
}

/* Desktop layout */
@media (min-width: 1024px) and (max-width: 1279px) {
    .related-product-slider .js_slide,
    .related-product-slider .swiper-slide,
    .widget[data-count-items] .swiper-slide,
    .swiper-container .swiper-slide,
    section[x-data*="initAmRelated"] .swiper-slide {
        width: 32% !important;
        min-width: 32% !important;
    }
}

/* Large screens */
@media (min-width: 1280px) {
    .related-product-slider .js_slide,
    .related-product-slider .swiper-slide,
    .widget[data-count-items] .swiper-slide,
    .swiper-container .swiper-slide,
    section[x-data*="initAmRelated"] .swiper-slide {
        width: 19% !important;
        min-width: 19% !important;
    }
}

/* Force product recommendation titles to be bold and remove borders */
section[x-data*="initSliderComponent"] h3.title-font,
.related-product-slider h3.title-font,
.widget[data-count-items] h3.title-font,
.swiper-container h3.title-font,
.product-slider h3.title-font {
    font-weight: 700 !important; /* font-bold */
}

/* Remove any borders from title containers */
section[x-data*="initSliderComponent"] .container,
.related-product-slider .container,
.widget[data-count-items] .container,
.swiper-container .container,
.product-slider .container {
    border-bottom: none !important;
}

/* Force show product swatches/color options */
.related-product-slider .swatch-attribute,
.related-product-slider .swatch-attribute-options,
.widget[data-count-items] .swatch-attribute,
.widget[data-count-items] .swatch-attribute-options,
.swiper-container .swatch-attribute,
.swiper-container .swatch-attribute-options {
    display: block !important;
}

/* Style color swatches to be visible and accessible */
.related-product-slider .swatch-option,
.widget[data-count-items] .swatch-option,
.swiper-container .swatch-option {
    width: 20px !important;
    height: 20px !important;
    margin-right: 4px !important;
    margin-bottom: 4px !important;
    border: 1px solid #ccc !important;
    display: inline-block !important;
}

/* Hide specific loyalty points text patterns ONLY in carousels */
.related-product-slider .price:contains("40 Punti Fedeltà"),
.widget[data-count-items] .price:contains("40 Punti Fedeltà"),
.product-recommendation-item .price:contains("40 Punti Fedeltà"),
.related-product-item .price:contains("40 Punti Fedeltà") {
    display: none !important;
}

/* FORCE SHOW loyalty points in main product page - HIGHEST PRIORITY */
.product-detail-page span.flex.whitespace-nowrap.text-tosoni-black,
.product-info span.flex.whitespace-nowrap.text-tosoni-black,
[name="reward.product.earn.message"] span.flex.whitespace-nowrap.text-tosoni-black,
body:not(.product-recommendation-item):not(.related-product-item) .border-t.mt-4.pt-4 span.flex.whitespace-nowrap.text-tosoni-black {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.product-detail-page span.flex.whitespace-nowrap.text-tosoni-black span,
.product-info span.flex.whitespace-nowrap.text-tosoni-black span,
[name="reward.product.earn.message"] span.flex.whitespace-nowrap.text-tosoni-black span,
body:not(.product-recommendation-item):not(.related-product-item) .border-t.mt-4.pt-4 span.flex.whitespace-nowrap.text-tosoni-black span {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override any inline styles on main product page loyalty points */
body:not(.related-product-slider):not(.product-recommendation-item) span.flex.whitespace-nowrap.text-tosoni-black[style*="display: none"] {
    display: flex !important;
}

body:not(.related-product-slider):not(.product-recommendation-item) span.flex.whitespace-nowrap.text-tosoni-black span[style*="display: none"] {
    display: inline !important;
}

/* FORCE SHOW all price-wrapper elements in bundle products */
.page-product-bundle .price-box .price-wrapper[style*="display: none"],
.page-product-bundle .price-container .price-wrapper[style*="display: none"],
.catalog-product-view.bundle .price-box .price-wrapper[style*="display: none"],
.catalog-product-view[data-product-type="bundle"] .price-box .price-wrapper[style*="display: none"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Additional specificity for bundle product prices */
body.catalog-product-view .price-box.price-final_price .price-wrapper[style*="display: none"] {
    display: block !important;
}

/* Force show bundle prices with rewards_earn class */
.page-product-bundle .price-container.rewards_earn .price-wrapper,
.catalog-product-view.bundle .price-container.rewards_earn .price-wrapper,
.catalog-product-view[data-product-type="bundle"] .price-container.rewards_earn .price-wrapper {
    display: block !important;
    visibility: visible !important;
}

/* FORCE SHOW old prices and discount badges in bundle products */
.page-product-bundle .old-price[style*="display: none"],
.page-product-bundle .discount[style*="display: none"],
.catalog-product-view.bundle .old-price[style*="display: none"],
.catalog-product-view.bundle .discount[style*="display: none"],
.catalog-product-view[data-product-type="bundle"] .old-price[style*="display: none"],
.catalog-product-view[data-product-type="bundle"] .discount[style*="display: none"] {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Additional specificity for bundle old prices and discounts */
body.catalog-product-view .price-box .old-price[style*="display: none"],
body.catalog-product-view .price-box .discount[style*="display: none"] {
    display: inline !important;
    visibility: visible !important;
}

/* Ensure all product items in carousels are side by side */
.related-product-slider,
.widget[data-count-items],
section[x-data*="AmRelatedSwiper"] {
    /* Removed overflow-x: auto to allow swiper navigation to work properly */
}

.related-product-slider .product-item,
.widget[data-count-items] .product-item,
section[x-data*="AmRelatedSwiper"] .product-item {
    display: flex !important;
    flex-direction: column !important;
    flex-shrink: 0 !important;
}
