/**
 * Sticky Sidebar for Product Pages - Final Polish
 */

@media (min-width: 992px) {

    /* Reset any sticky behavior for sidebar headings to avoid overlapping */
    #product-sidebar h1,
    #product-sidebar h2,
    #product-sidebar h3,
    #product-sidebar h4,
    .widget-title {
        position: static !important;
        top: auto !important;
    }

    /* Target the container as well as the inner sidebar */
    #product-sidebar,
    div.shop-sidebar,
    #shop-sidebar,
    .post-sidebar,
    .is-sticky-sidebar {
        position: -webkit-sticky !important;
        position: sticky !important;
        /* Ensure it clears the Flatsome sticky header (usually ~90-110px) */
        top: 140px !important;
        z-index: 8;
        /* Lower than header (usually 100+) but above content */
        /* IE/Edge */
        align-self: flex-start;
    }

    /* Hide scrollbar for Chrome/Safari but keep functionality */
    .post-sidebar::-webkit-scrollbar,
    .is-sticky-sidebar::-webkit-scrollbar {
        display: none;
    }

    /* Force the parent row to allow sidebars to stick without breaking grid */
    .product-main.row,
    .row.shop-container,
    .blog-single .row,
    .nt-single-container .row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        overflow: visible !important;
        position: relative !important;
        margin-bottom: 60px !important;
        /* Khoảng cách an toàn trước footer */
    }

    /* Ensure the column doesn't restrict the sticky child */
    .large-3.col {
        overflow: visible !important;
        height: auto !important;
    }
}