/**
 * Sticky Sidebars for Single Post Page
 * Makes left and right sidebars sticky while scrolling
 */

/* Left Sidebar Sticky */
.left-sidebar-sticky {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

/* Right Sidebar Sticky */
.right-sidebar-sticky {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

/* Main content area */
.main-content-area {
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for sidebars */
.left-sidebar-sticky::-webkit-scrollbar,
.right-sidebar-sticky::-webkit-scrollbar {
    width: 6px;
}

.left-sidebar-sticky::-webkit-scrollbar-track,
.right-sidebar-sticky::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.left-sidebar-sticky::-webkit-scrollbar-thumb,
.right-sidebar-sticky::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.left-sidebar-sticky::-webkit-scrollbar-thumb:hover,
.right-sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Smooth scrolling for sidebars */
.left-sidebar-sticky,
.right-sidebar-sticky {
    scroll-behavior: smooth;
}

/* Ensure row has proper flex behavior */
.dtl_content_layer .row {
    display: flex;
    flex-wrap: wrap;
}

/* Mobile responsiveness - disable sticky on small screens */
@media (max-width: 768px) {
    .left-sidebar-sticky,
    .right-sidebar-sticky {
        position: relative !important;
        top: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .left-sidebar-sticky,
    .right-sidebar-sticky {
        top: 10px;
        max-height: calc(100vh - 20px);
    }
}

/* Prevent sidebar content from breaking layout */
.left-sidebar-sticky > *,
.right-sidebar-sticky > * {
    max-width: 100%;
}

/* Ensure images in sidebars don't overflow */
.left-sidebar-sticky img,
.right-sidebar-sticky img {
    max-width: 100%;
    height: auto;
}

/* Sticky adjustment when WordPress admin bar is present */
body.admin-bar .left-sidebar-sticky,
body.admin-bar .right-sidebar-sticky {
    top: 52px;
    max-height: calc(100vh - 72px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .left-sidebar-sticky,
    body.admin-bar .right-sidebar-sticky {
        top: 46px;
        max-height: calc(100vh - 66px);
    }
}

/* Animation for smooth transitions */
.left-sidebar-sticky,
.right-sidebar-sticky {
    transition: top 0.3s ease;
}

/* Ensure sidebar stays visible during infinite scroll */
.infinity-data {
    min-height: 100vh;
}

/* Sidebar content spacing */
.left-sidebar-sticky > div,
.right-sidebar-sticky > div {
    margin-bottom: 15px;
}

/* Handle sticky positioning for dynamically loaded content */
.single-post-item {
    width: 100%;
}

/* Prevent layout shift when content loads */
.infinity-data {
    position: relative;
}

/* Loading indicator positioning */
.infinite-scroll-loading {
    width: 100%;
    clear: both;
}
