/**
 * RankMath TOC Block - Premium Branded Styling
 * Nepal SEO - Travel Agency Branding
 * 
 * Brand Colors:
 * - Primary Orange: #f97316
 * - Dark Slate: #0f172a
 * - Teal: #14b8a6
 * - Light Teal: #e6fcf5
 */
/* Main TOC Container - Clean & Simple */
.wp-block-rank-math-toc-block,
.rank-math-toc-block,
.rank-math-block,
#rank-math-toc {
    position: relative;
    max-width: 360px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 20px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    transition: box-shadow 0.3s ease;
}
.wp-block-rank-math-toc-block:hover,
.rank-math-toc-block:hover,
#rank-math-toc:hover {
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
/* Remove animated indicator for cleaner look */
/* TOC Title - Smaller & Cleaner - Using div instead of headings */
.wp-block-rank-math-toc-block .rank-math-toc__title,
.wp-block-rank-math-toc-block div[class*="toc"][class*="title"],
.rank-math-toc-block .rank-math-toc__title,
.rank-math-toc-block div[class*="toc"][class*="title"],
#rank-math-toc .rank-math-toc__title,
#rank-math-toc div[class*="toc"][class*="title"] {
    color: #0f172a;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: left;
    letter-spacing: -0.3px;
    position: relative;
    padding-bottom: 12px;
    display: block;
}
/* Simpler underline for title */
.wp-block-rank-math-toc-block .rank-math-toc__title::after,
.wp-block-rank-math-toc-block div[class*="toc"][class*="title"]::after,
.rank-math-toc-block .rank-math-toc__title::after,
.rank-math-toc-block div[class*="toc"][class*="title"]::after,
#rank-math-toc .rank-math-toc__title::after,
#rank-math-toc div[class*="toc"][class*="title"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #14b8a6, #f97316);
    border-radius: 2px;
}
/* TOC List - Remove default styling */
.wp-block-rank-math-toc-block nav ul,
.wp-block-rank-math-toc-block nav ol,
.rank-math-toc-block nav ul,
.rank-math-toc-block nav ol,
#rank-math-toc nav ul,
#rank-math-toc nav ol {
    list-style: decimal;
    padding-left: 20px;
    /* Space for decimal numbers */
    margin: 0;
}
/* Nested lists use lowercase letters (a, b, c) */
.wp-block-rank-math-toc-block nav ol ol,
.rank-math-toc-block nav ol ol,
#rank-math-toc nav ol ol {
    list-style-type: lower-alpha;
    padding-left: 20px;
    margin-top: 8px;
}
/* TOC Nav Container - Fixed Height with Clean Scrollbar */
.wp-block-rank-math-toc-block nav,
.rank-math-toc-block nav,
#rank-math-toc nav {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-right: -4px;
}
/* Custom Scrollbar - Thinner */
.wp-block-rank-math-toc-block nav::-webkit-scrollbar,
.rank-math-toc-block nav::-webkit-scrollbar {
    width: 4px;
}
.wp-block-rank-math-toc-block nav::-webkit-scrollbar-track,
.rank-math-toc-block nav::-webkit-scrollbar-track {
    background: transparent;
}
.wp-block-rank-math-toc-block nav::-webkit-scrollbar-thumb,
.rank-math-toc-block nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.2s ease;
}
.wp-block-rank-math-toc-block nav::-webkit-scrollbar-thumb:hover,
.rank-math-toc-block nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
/* Main TOC Items - Better Spacing */
.wp-block-rank-math-toc-block nav>ol>li,
.wp-block-rank-math-toc-block nav>ul>li,
.rank-math-toc-block nav>ol>li,
.rank-math-toc-block nav>ul>li,
#rank-math-toc nav>ol>li,
#rank-math-toc nav>ul>li {
    margin-bottom: 10px;
    padding-left: 8px;
    position: relative;
    line-height: 1.6;
    transition: all 0.2s ease;
    text-align: left;
}
/* Remove the custom numbered circles - use native list markers */
/* TOC Links - Base Styling */
.wp-block-rank-math-toc-block nav a,
.rank-math-toc-block nav a,
#rank-math-toc nav a {
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: color 0.2s ease;
    display: inline-block;
}
/* Active state - Applied to links by JavaScript */
.wp-block-rank-math-toc-block nav a.active,
.rank-math-toc-block nav a.active,
#rank-math-toc nav a.active {
    color: #f97316 !important;
    font-weight: 600 !important;
    background: rgba(249, 115, 22, 0.08);
    border-left: 3px solid #14b8a6;
    /* Teal border */
    padding-left: 8px !important;
    margin-left: -11px;
    padding-right: 8px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 4px;
    display: inline-block;
}
/* Hover effect for all links */
.wp-block-rank-math-toc-block nav a:hover,
.rank-math-toc-block nav a:hover,
#rank-math-toc nav a:hover {
    color: #f97316;
}
/* Nested TOC Items - Cleaner styling */
.wp-block-rank-math-toc-block nav ol ol li,
.wp-block-rank-math-toc-block nav ul ul li,
.rank-math-toc-block nav ol ol li,
.rank-math-toc-block nav ul ul li,
#rank-math-toc nav ol ol li,
#rank-math-toc nav ul ul li {
    margin-bottom: 6px;
    padding-left: 8px;
    line-height: 1.5;
}
/* Nested links - Slightly smaller and lighter */
.wp-block-rank-math-toc-block nav ol ol a,
.wp-block-rank-math-toc-block nav ul ul a,
.rank-math-toc-block nav ol ol a,
.rank-math-toc-block nav ul ul a,
#rank-math-toc nav ol ol a,
#rank-math-toc nav ul ul a {
    font-size: 13px;
    color: #6b7280;
}
/* Nested active links */
.wp-block-rank-math-toc-block nav ol ol a.active,
.wp-block-rank-math-toc-block nav ul ul a.active,
.rank-math-toc-block nav ol ol a.active,
.rank-math-toc-block nav ul ul a.active,
#rank-math-toc nav ol ol a.active,
#rank-math-toc nav ul ul a.active {
    border-left: 2px solid #14b8a6 !important;
    /* Teal border for nested */
}
/* Sidebar positioning - works with Gutenverse templates */
@media (min-width: 1024px) {
    /* When TOC is in main content area */
    .entry-content .wp-block-rank-math-toc-block,
    .entry-content .rank-math-toc-block,
    article .wp-block-rank-math-toc-block,
    article .rank-math-toc-block {
        float: right;
        margin-left: 30px;
        margin-right: 0;
        margin-bottom: 30px;
    }
    /* When TOC is in Gutenverse sidebar */
    .guten-sidebar .wp-block-rank-math-toc-block,
    .guten-sidebar .rank-math-toc-block,
    .sidebar .wp-block-rank-math-toc-block,
    .sidebar .rank-math-toc-block,
    aside .wp-block-rank-math-toc-block,
    aside .rank-math-toc-block {
        float: none;
        margin: 0 auto 30px;
        width: 100%;
    }
    /* Sticky TOC in sidebar and Gutenverse columns - ONLY the TOC block */
    .wp-block-gutenverse-column .wp-block-rank-math-toc-block,
    .sidebar .wp-block-rank-math-toc-block,
    .guten-sidebar .wp-block-rank-math-toc-block,
    aside .wp-block-rank-math-toc-block,
    aside .rank-math-toc-block {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 90px !important;
        z-index: 10 !important;
        align-self: flex-start;
    }
    /* Ensure parent containers don't interfere */
    .wp-block-gutenverse-column>.guten-column-wrapper {
        display: block;
        /* Don't use flex to avoid layout issues */
    }
    /* Also make sticky when floated in content */
    .entry-content .wp-block-rank-math-toc-block,
    article .wp-block-rank-math-toc-block {
        position: -webkit-sticky;
        position: sticky;
        top: 90px;
        z-index: 10;
    }
    /* Prevent TOC from overlapping footer */
    footer,
    .site-footer,
    #colophon {
        position: relative;
        z-index: 100 !important;
        background: #fff;
    }
    /* Ensure comments stay in normal flow */
    .comments-area,
    #comments,
    .comment-respond {
        position: static !important;
        margin-top: 40px;
        clear: both;
    }
}
/* Mobile Responsiveness - Modal TOC */
@media (max-width: 768px) {
    /* Hide the default TOC on mobile */
    .wp-block-rank-math-toc-block,
    .rank-math-toc-block {
        display: none !important;
    }
    /* Sticky floating TOC button - will be shown by JavaScript */
    .toc-mobile-toggle {
        display: flex;
        position: fixed;
        bottom: 90px;
        /* Moved higher to avoid Tawk.to chat widget */
        right: 24px;
        width: 56px;
        height: 56px;
        background: linear-gradient(135deg, #f97316, #14b8a6);
        border: none;
        border-radius: 50%;
        box-shadow: 0 4px 16px rgba(20, 184, 166, 0.4), 0 8px 24px rgba(249, 115, 22, 0.3);
        cursor: pointer;
        z-index: 9999;
        align-items: center;
        justify-content: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        animation: pulse-subtle 3s ease-in-out infinite;
    }
    .toc-mobile-toggle:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(20, 184, 166, 0.5), 0 10px 30px rgba(249, 115, 22, 0.4);
    }
    .toc-mobile-toggle:active {
        transform: scale(0.95);
    }
    /* Icon inside button - Using Font Awesome */
    .toc-mobile-toggle::before {
        content: "\f03a";
        /* Font Awesome list icon */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        color: #ffffff;
        font-size: 22px;
        line-height: 1;
    }
    /* Subtle pulse animation */
    @keyframes pulse-subtle {
        0%,
        100% {
            box-shadow: 0 4px 16px rgba(20, 184, 166, 0.4), 0 8px 24px rgba(249, 115, 22, 0.3);
        }
        50% {
            box-shadow: 0 6px 20px rgba(20, 184, 166, 0.5), 0 10px 30px rgba(249, 115, 22, 0.4);
        }
    }
    /* Modal overlay */
    .toc-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(4px);
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    .toc-mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    /* Modal container */
    .toc-mobile-modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 80vh;
        background: #ffffff;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.2);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10001;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .toc-mobile-overlay.active .toc-mobile-modal {
        transform: translateY(0);
    }
    /* Modal header */
    .toc-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 24px;
        border-bottom: 2px solid #e5e7eb;
        background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), rgba(20, 184, 166, 0.05));
    }
    .toc-mobile-title {
        color: #0f172a;
        font-size: 18px;
        font-weight: 600;
        margin: 0;
    }
    /* Close button */
    .toc-mobile-close {
        width: 36px;
        height: 36px;
        border: none;
        background: #f1f5f9;
        color: #64748b;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        font-size: 24px;
        line-height: 1;
    }
    .toc-mobile-close:hover {
        background: #e2e8f0;
        color: #0f172a;
        transform: rotate(90deg);
    }
    /* Modal content */
    .toc-mobile-content {
        flex: 1;
        overflow-y: auto;
        padding: 24px;
    }
    /* Style the TOC inside modal */
    .toc-mobile-content .wp-block-rank-math-toc-block,
    .toc-mobile-content .rank-math-toc-block {
        display: block !important;
        max-width: 100%;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    .toc-mobile-content .wp-block-rank-math-toc-block .rank-math-toc__title,
    .toc-mobile-content .wp-block-rank-math-toc-block div[class*="toc"][class*="title"],
    .toc-mobile-content .rank-math-toc-block .rank-math-toc__title,
    .toc-mobile-content .rank-math-toc-block div[class*="toc"][class*="title"] {
        display: none;
        /* Title is in header */
    }
    .toc-mobile-content nav {
        max-height: none !important;
        padding-right: 0 !important;
    }
}
/* Smooth scroll behavior when clicking links */
html {
    scroll-behavior: smooth;
}
/* Active link highlighting (when section is in view) */
.wp-block-rank-math-toc-block nav a.active,
.rank-math-toc-block nav a.active {
    color: #f97316;
    font-weight: 700;
}