/* Sticky Product Section Styles */

/* Wrapper for sticky behavior */
.sticky-wrapper {width: 563px;}

/* Base sticky styles - only for first .part child */
.single-product .parts > .part:first-child {
    transition: all 0.3s ease-in-out;
    will-change: transform;
}

/* When sticky is active - only for first .part child */
.single-product .parts > .part:first-child.is-sticky {
    position: fixed !important;
    top: 20px;
    z-index: 999;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    right: 20px;
}

/* RTL support */
body.rtl .single-product .parts > .part:first-child.is-sticky {
    right: auto;
    left: 20px;
}

/* When stopped at footer - only for first .part child */
.single-product .parts > .part:first-child.is-absolute {
    position: absolute !important;
    z-index: 999;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    right: 20px;
}

body.rtl .single-product .parts > .part:first-child.is-absolute {
    right: auto;
    left: 20px;
}

/* Content shift animation */
.single-product .product-main-content,
.single-product .woocommerce-tabs,
.single-product .related-products,
.single-product .upsells {
    transition: margin 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Shift content when sticky is active */
body.has-sticky-product .single-product .product-main-content,
body.has-sticky-product .single-product .woocommerce-tabs,
body.has-sticky-product .single-product .related-products,
body.has-sticky-product .single-product .upsells {
    margin-right: 440px;
}

/* RTL support for content shift */
body.rtl.has-sticky-product .single-product .product-main-content,
body.rtl.has-sticky-product .single-product .woocommerce-tabs,
body.rtl.has-sticky-product .single-product .related-products,
body.rtl.has-sticky-product .single-product .upsells {
    margin-right: 0;
    margin-left: 440px;
}

/* Smooth animation for shifted content */
.content-shifted {
    animation: shiftContent 0.3s ease-in-out forwards;
}

@keyframes shiftContent {
    from {
        opacity: 0.8;
        transform: translateX(0);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .single-product .parts > .part:first-child.is-sticky,
    .single-product .parts > .part:first-child.is-absolute {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        max-width: 100%;
        box-shadow: none;
    }
    
    body.has-sticky-product .single-product .product-main-content,
    body.has-sticky-product .single-product .woocommerce-tabs,
    body.has-sticky-product .single-product .related-products,
    body.has-sticky-product .single-product .upsells {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .single-product .parts > .part:first-child.is-sticky,
    .single-product .parts > .part:first-child.is-absolute {
        max-width: 350px;
    }
    
    body.has-sticky-product .single-product .product-main-content,
    body.has-sticky-product .single-product .woocommerce-tabs,
    body.has-sticky-product .single-product .related-products,
    body.has-sticky-product .single-product .upsells {
        margin-right: 380px;
    }
    
    body.rtl.has-sticky-product .single-product .product-main-content,
    body.rtl.has-sticky-product .single-product .woocommerce-tabs,
    body.rtl.has-sticky-product .single-product .related-products,
    body.rtl.has-sticky-product .single-product .upsells {
        margin-right: 0;
        margin-left: 380px;
    }
}

/* Ensure proper stacking context - only for first .part child */
.single-product .parts > .part:first-child.is-sticky > * {
    position: relative;
    z-index: 1;
}

/* Improve appearance during sticky state - only for first .part child */
.single-product .parts > .part:first-child.is-sticky {
    border-radius: 8px;
    padding: 20px;
}

/* Smooth height transitions */
.sticky-wrapper {
    transition: height 0.3s ease-in-out;
}