/* ========================================
   Blog Table of Contents (TOC) Styles
   ======================================== */

/* TOC Sidebar Container */
.Blog_Sidebar_Main {
    border-radius: 10px;
    background: #ffffff;
    padding: 0;
    border: 1px solid #E5E5E5;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 100px;
    width: 100%;
    max-width: 306px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    align-self: flex-start;
}

/* When TOC should stop at content end */
.Blog_Sidebar_Main.toc-stopped {
    position: absolute;
    top: auto;
}

/* TOC Container */
.toc-container {
    width: 100%;
    padding: 24px;
}

/* TOC Title */
.toc-title {
    color: #1F2227;
    font-size: 20px;
    font-style: normal;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
}

/* Progress Bar */
.toc-container .progress {
    height: 3px;
    margin-bottom: 24px;
    background-color: #E5E5E5;
    border-radius: 2px;
}

.toc-container .progress-bar {
    background-color: #597BF7;
    border-radius: 2px;
}

/* TOC List */
ul.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* TOC Items */
li.toc-item {
    list-style: none;
    margin-bottom: 0;
    padding: 0;
    border-left: 2px solid #E5E5E5;
    transition: all 0.2s ease;
}

li.toc-item.active {
    border-left: 2px solid #597BF7;
}

/* TOC Links */
li.toc-item a.toc-link {
    padding: 12px 0 12px 16px;
    display: block;
    color: #667085;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

li.toc-item:hover a.toc-link {
    color: #597BF7;
    background-color: #F8F9FD;
}

li.toc-item.active a.toc-link {
    color: #597BF7;
    font-weight: 500;
    background-color: #F8F9FD;
}

/* Custom Scrollbar */
.Blog_Sidebar_Main::-webkit-scrollbar {
    width: 4px;
}

.Blog_Sidebar_Main::-webkit-scrollbar-track {
    background: #F8F8F8;
    border-radius: 2px;
}

.Blog_Sidebar_Main::-webkit-scrollbar-thumb {
    background: #DCDCDC;
    border-radius: 2px;
}

.Blog_Sidebar_Main::-webkit-scrollbar-thumb:hover {
    background: #597BF7;
}

/* Detail Left Container */
.Detail_Left {
    position: relative;
}

/* Offcanvas Body - Allow sticky to work */
.Mob_Sidebar .offcanvas-body {
    overflow: visible !important;
    height: auto;
}

/* Column container for proper sticky behavior */
.col-lg-3 {
    position: relative;
}

/* Ensure blog detail section allows proper stacking */
section.Blog_Detail_Can .row {
    position: relative;
}

/* ========================================
   Scroll to Top Button
   ======================================== */

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: #597BF7;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 12px rgba(89, 123, 247, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: #4A6BE6;
    box-shadow: 0px 6px 16px rgba(89, 123, 247, 0.4);
    transform: translateY(-2px);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Large Desktop (1200px - 1366px) */
@media only screen and (min-width: 1200px) and (max-width: 1366.51px) {
    .Blog_Sidebar_Main {
        position: sticky;
        top: 100px;
        max-width: 275px;
        max-height: calc(100vh - 120px);
    }
}

/* Tablet & Small Desktop (992px - 1199px) */
@media only screen and (min-width: 992px) and (max-width: 1199.51px) {
    .Blog_Sidebar_Main {
        position: sticky;
        top: 100px;
        max-width: 220px;
        max-height: calc(100vh - 120px);
    }

    .toc-title {
        font-size: 18px;
    }

    li.toc-item a.toc-link {
        font-size: 13px;
        padding: 10px 0 10px 12px;
    }
}

/* Mobile & Tablet (below 992px) */
@media(max-width:991.51px) {
    .Blog_Sidebar_Main {
        position: relative !important;
        max-width: 100% !important;
        max-height: none !important;
        height: auto !important;
        width: 100% !important;
        top: 0 !important;
    }

    .Mob_Sidebar {
        width: 320px;
    }

    button.Mob_Sidebar_Btn {
        position: fixed;
        left: 10px;
        top: 30%;
        border-radius: 12px;
        border: 1px solid #DEDEDE;
        background: #FFFFFF;
        box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.15);
        z-index: 999;
        padding: 12px;
        transition: all 0.2s ease;
    }

    button.Mob_Sidebar_Btn:hover {
        background: #F8F9FD;
        border-color: #597BF7;
    }

    .Mob_Sidebar .offcanvas-body {
        padding: 16px;
    }

    .Mob_Sidebar .Blog_Sidebar_Main {
        position: relative !important;
        top: 0 !important;
        background: #ffffff;
        padding: 0;
    }

    .Mob_Sidebar .Blog_Sidebar_Main .toc-container {
        padding: 24px;
    }

    .toc-title {
        font-size: 20px;
    }
}

/* Small Mobile (below 768px) */
@media (max-width: 767.51px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    .scroll-to-top svg {
        width: 20px;
        height: 20px;
    }

    .Mob_Sidebar {
        width: 280px;
    }
}

/* Desktop - Show sidebar, hide mobile button */
@media (min-width:992px) {
    button.Mob_Sidebar_Btn {
        display: none;
    }

    .Mob_Sidebar {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        transform: none !important;
        width: auto !important;
        z-index: auto;
    }

    .Mob_Sidebar .offcanvas-header {
        display: none;
    }

    .Mob_Sidebar .offcanvas-body {
        overflow: visible !important;
        padding: 0;
    }

    .Detail_Left {
        position: relative;
        height: auto;
        min-height: 100vh;
    }

    /* Ensure sticky works on desktop */
    .col-lg-3 {
        position: relative;
    }
}
