/* TPWST Related Products Carousel Styles - Fixed Display Issues */

.tpwst-related-products-carousel-wrapper {
    direction: rtl;
    margin: 20px 0;
    position: relative;
    overflow: visible;
}

.tpwst-related-products-carousel {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tpwst-related-products-carousel.tpwst-carousel-loaded {
    opacity: 1;
}

.tpwst-related-products-carousel.tpwst-carousel-loading {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpwst-related-products-carousel.tpwst-carousel-loading:before {
    content: "טוען מוצרים קשורים...";
    color: #666;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ביטול כל הסטיילים של פלקס כשהקרוסלה פעילה */
.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel {
    display: block !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ביטול סטיילים של WooCommerce Blocks */
.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel.wc-block-product-template {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
}

.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel.is-flex-container {
    display: block !important;
    flex-wrap: nowrap !important;
}

.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel.columns-4,
.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel.columns-3,
.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel.columns-2 {
    grid-template-columns: none !important;
    display: block !important;
}

/* תיקון לקונטיינר OWL */
.tpwst-related-products-carousel-wrapper .owl-stage-outer {
    overflow: hidden !important;
    position: relative !important;
}

.tpwst-related-products-carousel-wrapper .owl-stage {
    position: relative !important;
    display: flex !important;
    align-items: stretch !important;
}

.tpwst-related-products-carousel-wrapper .owl-item {
    position: relative !important;
    min-height: 1px !important;
    float: none !important;
    display: flex !important;
    align-items: stretch !important;
}

/* תיקון עיצוב הפריטים */
.tpwst-carousel-item {
    margin: 0 !important;
    padding: 10px !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    background: white !important;
    border-radius: 8px !important;
    /* box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important; */
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.tpwst-carousel-item:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.tpwst-carousel-item.wc-block-product {
    display: block !important;
    width: 100% !important;
    flex: none !important;
    position: relative !important;
}

/* תיקון תמונות */
.tpwst-carousel-item .wc-block-components-product-image {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 8px 8px 0 0 !important;
    background: #f8f9fa !important;
    margin-bottom: 15px !important;
    display: block !important;
}

.tpwst-carousel-item .wc-block-components-product-image a {
    display: block !important;
    text-decoration: none !important;
    position: relative !important;
}

.tpwst-carousel-item .wc-block-components-product-image img {
    width: 100% !important;
    height: auto !important;
    max-height: 250px !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
    display: block !important;
    border-radius: 8px 8px 0 0 !important;
}

.tpwst-carousel-item:hover .wc-block-components-product-image img {
    transform: scale(1.05) !important;
}

/* תיקון כותרות */
.tpwst-carousel-item .wp-block-post-title {
    margin: 15px 10px 10px 10px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    text-align: center !important;
}

.tpwst-carousel-item .wp-block-post-title a {
    color: #333 !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
    display: block !important;
    width: 100% !important;
}

.tpwst-carousel-item .wp-block-post-title a:hover {
    color: #222 !important;
}

/* תיקון מחירים */
.tpwst-carousel-item .wp-block-woocommerce-product-price {
    margin: 10px !important;
    text-align: center !important;
}

.tpwst-carousel-item .wc-block-components-product-price {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #222 !important;
    text-align: center !important;
}

/* תיקון כפתורים */
.tpwst-carousel-item .wp-block-woocommerce-product-button {
    margin: 15px 10px 10px 10px !important;
}

.tpwst-carousel-item .wc-block-components-product-button__button {
    /* width: 100% !important;
    padding: 12px 20px !important;
    background: #0073aa !important;
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    text-align: center !important;
    display: block !important; */
}

.tpwst-carousel-item .wc-block-components-product-button__button:hover {
    background: #005a87 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,115,170,0.3) !important;
}

/* OWL Carousel Navigation */
.tpwst-related-products-carousel-wrapper .owl-nav {
    margin-top: 0 !important;
    text-align: center !important;
    position: absolute !important;
    top: 50% !important;
    width: 100% !important;
    transform: translateY(-50%) !important;
    pointer-events: none !important;
}

.tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'] {
    color: #0073aa !important;
    font-size: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    border: 2px solid #222 !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    position: absolute !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    pointer-events: all !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
    left: -25px !important;
}

.tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
    right: -25px !important;
}

.tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-']:hover {
    background: #222 !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 15px rgba(0,115,170,0.3) !important;
}

.tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'].disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* OWL Carousel Dots */
.tpwst-related-products-carousel-wrapper .owl-dots {
    text-align: center !important;
    margin-top: 20px !important;
    position: relative !important;
    z-index: 100 !important;
}

.tpwst-related-products-carousel-wrapper .owl-dot {
    display: inline-block !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background: #ddd !important;
    margin: 0 5px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.tpwst-related-products-carousel-wrapper .owl-dot.active {
    background: #0073aa !important;
    transform: scale(1.2) !important;
}

.tpwst-related-products-carousel-wrapper .owl-dot:hover {
    background: #0073aa !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tpwst-carousel-item .wp-block-post-title {
        font-size: 15px !important;
        min-height: 40px !important;
    }
    
    .tpwst-carousel-item .wc-block-components-product-button__button {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'] {
        width: 45px !important;
        height: 45px !important;
        font-size: 16px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
        left: -20px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
        right: -20px !important;
    }
}

@media (max-width: 768px) {
    .tpwst-carousel-item {
        padding: 8px !important;
    }
    
    .tpwst-carousel-item .wp-block-post-title {
        font-size: 14px !important;
        min-height: 36px !important;
        margin: 10px 5px !important;
    }
    
    .tpwst-carousel-item .wc-block-components-product-button__button {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'] {
        width: 35px !important;
        height: 35px !important;
        font-size: 14px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
        left: -15px !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
        right: -15px !important;
    }
}

@media (max-width: 480px) {
    .tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'] {
        position: static !important;
        transform: none !important;
        margin: 10px 5px 0 5px !important;
        display: inline-flex !important;
    }
    
    .tpwst-related-products-carousel-wrapper .owl-nav {
        position: static !important;
        transform: none !important;
        margin-top: 15px !important;
        top: auto !important;
    }
}

/* RTL Support */
.rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
    left: -25px !important;
    right: auto !important;
}

.rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
    right: -25px !important;
    left: auto !important;
}

@media (max-width: 1200px) {
    .rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
        left: -20px !important;
        right: auto !important;
    }
    
    .rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
        right: -20px !important;
        left: auto !important;
    }
}

@media (max-width: 768px) {
    .rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-prev {
        right: -15px !important;
        left: auto !important;
    }
    
    .rtl .tpwst-related-products-carousel-wrapper .owl-nav .owl-next {
        left: -15px !important;
        right: auto !important;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .tpwst-carousel-item .wc-block-components-product-image img,
    .tpwst-carousel-item .wc-block-components-product-button__button,
    .tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-'],
    .tpwst-related-products-carousel-wrapper .owl-dot,
    .tpwst-carousel-item {
        transition: none !important;
    }
    
    .tpwst-carousel-item:hover .wc-block-components-product-image img,
    .tpwst-carousel-item .wc-block-components-product-button__button:hover,
    .tpwst-carousel-item:hover {
        transform: none !important;
    }
}

/* Focus styles for accessibility */
.tpwst-carousel-item a:focus,
.tpwst-carousel-item button:focus,
.tpwst-related-products-carousel-wrapper .owl-nav [class*='owl-']:focus,
.tpwst-related-products-carousel-wrapper .owl-dot:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* Loading animation */
@keyframes tpwstSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tpwst-related-products-carousel.tpwst-carousel-loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: tpwstSpin 1s linear infinite;
}

/* Ensure proper spacing in product collection */
.tpwst-related-products-carousel-wrapper .wp-block-woocommerce-product-collection {
    padding: 0 !important;
    margin: 0 !important;
}

.tpwst-related-products-carousel-wrapper .wp-block-heading {
    margin-bottom: 20px !important;
    text-align: center !important;
    font-size: 24px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

/* Fix for themes that might override OWL styles */
.tpwst-related-products-carousel-wrapper .owl-carousel .owl-item {
    float: none !important;
    width: auto !important;
}

.tpwst-related-products-carousel-wrapper .owl-carousel .owl-stage {
    display: flex !important;
}

.tpwst-related-products-carousel-wrapper .owl-carousel .owl-stage-outer {
    overflow: hidden !important;
}

/* High contrast for accessibility */
@media (prefers-contrast: high) {
    .tpwst-carousel-item {
        border: 2px solid #000 !important;
    }
    
    .tpwst-carousel-item .wc-block-components-product-button__button {
        border: 2px solid #fff !important;
    }
}

/* ביטול כל הסגנונות שעלולים להפריע */
.tpwst-related-products-carousel-wrapper .tpwst-related-products-carousel li {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* הסתרת אלמנטים מיותרים שעלולים להפריע */
.tpwst-related-products-carousel-wrapper .wc-block-components-product-image__inner-container {
    display: none !important;
}