/**
 * Elementor Upsells & Cross-sells Widget Styles
 */

/* General Wrapper */
.eupsell-widget-wrapper {
    width: 100%;
}

/* Widget Notice */
.eupsell-widget-notice {
    padding: 15px;
    background: #f0f0f1;
    border-left: 4px solid #72aee6;
    margin: 10px 0;
}

.eupsell-widget-notice p {
    margin: 0;
    color: #50575e;
}

/* Heading */
.eupsell-heading {
    margin: 0 0 20px;
    padding: 0;
}

/* Grid Layout */
.eupsell-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Product Item */
.eupsell-product-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    transition: all 0.3s ease;
    height: 100%;
}

.eupsell-product-item:hover {
    transform: translateY(-5px);
}

/* Product Image */
.eupsell-product-image {
    position: relative !important;
    overflow: hidden !important;
    margin-bottom: 15px;
    display: block !important;
    width: 100% !important;
}

.eupsell-product-image a {
    display: block !important;
    position: relative;
    width: 100% !important;
}

.eupsell-product-image img {
    width: 100% !important;
    height: auto;
    display: block !important;
    transition: transform 0.3s ease;
}

/* When height is set via Elementor controls */
.eupsell-product-image[style*="height"] {
    height: auto; /* Will be overridden by inline style */
}

.eupsell-product-image[style*="height"] a {
    height: 100% !important;
    display: block !important;
}

.eupsell-product-image[style*="height"] img {
    height: 100% !important;
    width: 100% !important;
}

/* When object-fit is specifically set (not default) */
.eupsell-product-image img[style*="object-fit: fill"],
.eupsell-product-image img[style*="object-fit: contain"],
.eupsell-product-image img[style*="object-fit: cover"],
.eupsell-product-image img[style*="object-fit: scale-down"] {
    /* Ensure height is set when object-fit is used */
    min-height: 200px;
}

/* When aspect ratio is set, image fills container */
.eupsell-product-image[style*="aspect-ratio"] {
    overflow: hidden !important;
}

.eupsell-product-image[style*="aspect-ratio"] a {
    height: 100% !important;
}

.eupsell-product-image[style*="aspect-ratio"] img {
    height: 100% !important;
    width: 100% !important;
}

.eupsell-product-item:hover .eupsell-product-image img {
    transform: scale(1.05);
}

/* Product Content */
.eupsell-product-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Product Title */
.eupsell-product-title {
    margin: 0 0 10px;
    padding: 0;
    font-size: 16px;
    line-height: 1.4;
    text-align: inherit; /* Allow Elementor to control */
}

.eupsell-product-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
    display: inline-block;
}

/* Product Rating */
.eupsell-product-rating {
    margin-bottom: 10px;
}

.eupsell-product-rating .star-rating {
    font-size: 14px;
}

/* Product Price */
.eupsell-product-price {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    text-align: inherit; /* Allow Elementor to control */
}

.eupsell-product-price del {
    opacity: 0.6;
    font-weight: 400;
    margin-right: 5px;
}

.eupsell-product-price ins {
    text-decoration: none;
}

/* Add to Cart Button */
.eupsell-product-button {
    margin-top: auto;
    text-align: inherit; /* Allow Elementor to control */
}

.eupsell-add-to-cart,
.eupsell-product-button .button {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* When button is not full width */
.eupsell-add-to-cart[style*="width: auto"] {
    width: auto !important;
}

.eupsell-add-to-cart:hover,
.eupsell-product-button .button:hover {
    opacity: 0.8;
}

/* Carousel Layout */
.eupsell-carousel-wrapper {
    position: relative;
}

.eupsell-carousel {
    overflow: hidden;
    padding: 0 50px;
}

.eupsell-carousel .swiper-wrapper {
    align-items: stretch;
}

.eupsell-carousel .swiper-slide {
    height: auto;
    display: flex;
}

.eupsell-carousel .swiper-slide .eupsell-product-item {
    width: 100%;
}

/* Swiper Navigation */
.eupsell-carousel .swiper-button-next,
.eupsell-carousel .swiper-button-prev {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    color: #000;
    transition: all 0.3s ease;
}

.eupsell-carousel .swiper-button-next::after,
.eupsell-carousel .swiper-button-prev::after {
    font-size: 20px;
    font-weight: bold;
}

.eupsell-carousel .swiper-button-next:hover,
.eupsell-carousel .swiper-button-prev:hover {
    opacity: 0.7;
}

.eupsell-carousel .swiper-button-prev {
    left: 0;
}

.eupsell-carousel .swiper-button-next {
    right: 0;
}

/* Swiper Pagination */
.eupsell-carousel .swiper-pagination {
    bottom: -30px;
    position: relative;
    margin-top: 20px;
}

.eupsell-carousel .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #000;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.eupsell-carousel .swiper-pagination-bullet-active {
    opacity: 1;
}

/* WooCommerce Compatibility */
.eupsell-product-button .added_to_cart {
    display: inline-block;
    margin-top: 10px;
    text-align: center;
    width: 100%;
}

/* Variation Attributes */
.eupsell-product-variation-attributes {
    margin: 10px 0;
    font-size: 13px;
    color: #666;
}

.eupsell-product-variation-attributes span {
    display: inline-block;
    margin-right: 5px;
    padding: 3px 8px;
    background: #f5f5f5;
    border-radius: 3px;
    font-size: 12px;
}

/* Out of Stock Badge */
.eupsell-product-item .out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 1;
}

.eupsell-product-image {
    position: relative;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .eupsell-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .eupsell-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .eupsell-carousel {
        padding: 0 40px;
    }
    
    .eupsell-carousel .swiper-button-next,
    .eupsell-carousel .swiper-button-prev {
        width: 35px;
        height: 35px;
        margin-top: -17.5px;
    }
    
    .eupsell-carousel .swiper-button-next::after,
    .eupsell-carousel .swiper-button-prev::after {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .eupsell-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .eupsell-carousel {
        padding: 0 30px;
    }
    
    .eupsell-carousel .swiper-button-next,
    .eupsell-carousel .swiper-button-prev {
        width: 30px;
        height: 30px;
        margin-top: -15px;
    }
    
    .eupsell-carousel .swiper-button-next::after,
    .eupsell-carousel .swiper-button-prev::after {
        font-size: 16px;
    }
    
    .eupsell-product-title {
        font-size: 14px;
    }
    
    .eupsell-product-price {
        font-size: 16px;
    }
}
