/**
 * Featured Products Carousel CSS
 * Retains WooCommerce product styling while adding carousel functionality
 */

/* Main carousel wrapper */
.featured-products-carousel-wrapper {
    position: relative;
    margin: 0 0 2em;
    overflow: hidden;
}

.featured-products-carousel-wrapper .swiper {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.featured-products-carousel-wrapper .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

/* Product slides */
.featured-products-carousel-wrapper .swiper-slide {
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Ensure product items fill the slide height */
.featured-products-carousel-wrapper .swiper-slide .product {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #FFFFFF;
    padding: 1rem 1rem 1rem 1rem ;
}

.featured-products-carousel-wrapper .swiper-slide .product .woocommerce-loop-product__title {
    font-size: 1rem;
    margin: 1rem 0;
}

/* Add to cart button visibility control */
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .ct-woo-card-actions .button,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .add_to_cart_button,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .product_type_simple,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .product_type_variable,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .product_type_grouped,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .product_type_external,
.featured-products-carousel-wrapper.fpc-hide-add-to-cart .wc-block-grid__product-add-to-cart {
    display: none !important;
}

.featured-products-carousel-wrapper.fpc-show-add-to-cart .ct-woo-card-actions .button,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .add_to_cart_button,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .product_type_simple,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .product_type_variable,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .product_type_grouped,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .product_type_external,
.featured-products-carousel-wrapper.fpc-show-add-to-cart .wc-block-grid__product-add-to-cart {
    display: inline-block !important;
}

.featured-products-carousel-wrapper  .ct-woo-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.featured-products-carousel-wrapper  .ct-woo-card-actions .price {
    font-weight: 700;
}

/* Default behavior - hide add to cart if no specific class */
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .ct-woo-card-actions .button,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .add_to_cart_button,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .product_type_simple,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .product_type_variable,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .product_type_grouped,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .product_type_external,
.featured-products-carousel-wrapper:not(.fpc-show-add-to-cart) .wc-block-grid__product-add-to-cart {
    display: none !important;
}

/* Navigation arrows */
.featured-products-carousel-wrapper .swiper-button-next,
.featured-products-carousel-wrapper .swiper-button-prev {
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    top: 50%;
    margin-top: -22px;
    z-index: 10;
}

.featured-products-carousel-wrapper .swiper-button-next:after,
.featured-products-carousel-wrapper .swiper-button-prev:after {
    font-size: 16px;
    font-weight: bold;
}

.featured-products-carousel-wrapper .swiper-button-next:hover,
.featured-products-carousel-wrapper .swiper-button-prev:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.featured-products-carousel-wrapper .swiper-button-prev {
    left: 10px;
}

.featured-products-carousel-wrapper .swiper-button-next {
    right: 10px;
}

/* Hide arrows when disabled */
.featured-products-carousel-wrapper .swiper-button-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Pagination */
.featured-products-carousel-wrapper .swiper-pagination {
    position: static;
    margin-top: 20px;
    text-align: center;
}

.featured-products-carousel-wrapper .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: #ccc;
    opacity: 1;
    margin: 0 4px;
    transition: all 0.3s ease;
}

.featured-products-carousel-wrapper .swiper-pagination-bullet-active {
    background: #333;
    transform: scale(1.2);
}

/* Dynamic bullets styling */
.featured-products-carousel-wrapper .swiper-pagination-bullet-active-main {
    background: #333;
}

.featured-products-carousel-wrapper .swiper-pagination-bullet-active-prev,
.featured-products-carousel-wrapper .swiper-pagination-bullet-active-next {
    background: #666;
    transform: scale(0.8);
}

.featured-products-carousel-wrapper .swiper-pagination-bullet-active-prev-prev,
.featured-products-carousel-wrapper .swiper-pagination-bullet-active-next-next {
    background: #999;
    transform: scale(0.6);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .featured-products-carousel-wrapper .swiper-button-next,
    .featured-products-carousel-wrapper .swiper-button-prev {
        width: 36px;
        height: 36px;
        margin-top: -18px;
    }

    .featured-products-carousel-wrapper .swiper-button-next:after,
    .featured-products-carousel-wrapper .swiper-button-prev:after {
        font-size: 14px;
    }

    .featured-products-carousel-wrapper .swiper-button-prev {
        left: 5px;
    }

    .featured-products-carousel-wrapper .swiper-button-next {
        right: 5px;
    }
}

@media (max-width: 480px) {
    /* Hide navigation arrows on very small screens to save space */
    .featured-products-carousel-wrapper .swiper-button-next,
    .featured-products-carousel-wrapper .swiper-button-prev {
        display: none;
    }

    /* Make pagination more prominent on mobile */
    .featured-products-carousel-wrapper .swiper-pagination {
        margin-top: 15px;
    }

    .featured-products-carousel-wrapper .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
        margin: 0 3px;
    }
}

/* Accessibility improvements */
.featured-products-carousel-wrapper .swiper-button-next:focus,
.featured-products-carousel-wrapper .swiper-button-prev:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.featured-products-carousel-wrapper .swiper-pagination-bullet:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Animation for slide transitions */
.featured-products-carousel-wrapper .swiper-slide {
    transition: transform 0.3s ease;
}

/* Hover effects on products within carousel */
.featured-products-carousel-wrapper .swiper-slide .product:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.featured-products-carousel-wrapper .swiper-slide .product img {
    transition: transform 0.3s ease;
}

.featured-products-carousel-wrapper .swiper-slide .product:hover img {
    transform: scale(1.02);
}

/* Loading state */
.featured-products-carousel-wrapper.loading {
    opacity: 0.7;
    pointer-events: none;
}

.featured-products-carousel-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: carousel-loading 1s linear infinite;
    z-index: 100;
}

@keyframes carousel-loading {
    to {
        transform: rotate(360deg);
    }
}

/* Ensure WooCommerce styling is preserved */
.featured-products-carousel-wrapper .woocommerce ul.products {
    display: contents;
}

.featured-products-carousel-wrapper .woocommerce ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
}

/* Theme compatibility - Blocksy theme specific adjustments */
.blocksy .featured-products-carousel-wrapper .swiper-slide .product {
    border: 1px solid var(--theme-border-color, #e1e8ed);
    border-radius: var(--theme-border-radius, 3px);
}

.blocksy .featured-products-carousel-wrapper .swiper-button-next,
.blocksy .featured-products-carousel-wrapper .swiper-button-prev {
    color: var(--theme-text-color, #333);
    background: var(--theme-background-color, rgba(255, 255, 255, 0.9));
}

.blocksy .featured-products-carousel-wrapper .swiper-pagination-bullet-active {
    background: var(--theme-accent-color, #333);
}
