/**
 * Policy Navigation Drawer Styles
 *
 * Styles for the table of contents/navigation panel for policy documents
 */

/* Navigation Toggle Button (in header) */
.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-right: 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-toggle:hover {
    background: var(--color-gray-100);
}

.nav-toggle svg {
    width: 24px;
    height: 24px;
}

/* Navigation Drawer */
.policy-side-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 360px;
    background: var(--color-bg-primary);
    border-right: 1px solid var(--color-border-light);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Optimize for touch gestures */
    will-change: transform;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.policy-side-nav.open {
    transform: translateX(0);
}

/* Navigation Header */
.policy-side-nav .nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg-primary);
    flex-shrink: 0;
}

.policy-side-nav .nav-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.policy-side-nav .nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.policy-side-nav .nav-close:hover {
    background: var(--color-gray-100);
    color: var(--color-text-primary);
}

/* Mobile touch target fix for close button */
@media (max-width: 768px) {
    .policy-side-nav .nav-close {
        width: 44px;
        height: 44px;
    }
}

/* Navigation Content */
.policy-side-nav .nav-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
}

/* Navigation Sections */
.nav-section {
    padding: 0.75rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.nav-section:last-child {
    border-bottom: none;
}

/* Accordion wrapper grows to push account section to bottom */
.nav-accordion {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Both accordion sections can grow when open */
.nav-accordion > .nav-section {
    min-height: 0;
    overflow-y: auto;
    border-bottom: 1px solid var(--color-border-light);
}

/* The open section takes available space */
.nav-accordion > .nav-section:not(.collapsed) {
    flex: 1;
}

/* Collapsed sections shrink to header only */
.nav-accordion > .nav-section.collapsed {
    flex: none;
    overflow: hidden;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0 0 0.75rem 0;
}

/* Navigation Action Button */
.nav-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    text-decoration: none;
}

.nav-action:hover {
    background: var(--color-accent-500);
    border-color: var(--color-accent-500);
    color: white;
}

.nav-action svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.nav-action .btn-text {
    flex: 1;
}

/* Navigation Info */
.nav-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.nav-info svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.nav-info p {
    margin: 0;
}

.nav-info.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

/* Search Input */
.nav-search {
    display: flex;
    gap: 0.5rem;
}

.nav-search-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    transition: all 0.2s ease;
}

.nav-search-input:focus {
    outline: none;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px rgba(155, 68, 68, 0.1);
}

.nav-search-input::placeholder {
    color: var(--color-text-tertiary);
}

.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--color-accent-500);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-search-btn:hover {
    background: var(--color-accent-600);
}

/* Question Input in Navigation */
.nav-question-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-question-input .question-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    transition: all 0.2s ease;
    resize: none;
    min-height: 2.5rem;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.4;
}

.nav-question-input .question-input:focus {
    outline: none;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px rgba(155, 68, 68, 0.1);
}

.nav-question-input .question-input::placeholder {
    color: var(--color-text-tertiary);
}

.nav-question-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--color-accent-500);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-question-btn:hover {
    background: var(--color-accent-600);
}

.nav-question-btn:active {
    transform: scale(0.95);
}

/* Expand All Button */
.nav-expand-all {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-expand-all:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-accent-500);
    color: var(--color-accent-500);
}

/* Topics List */
.topics-list {
    margin-top: 0.5rem;
}

.topic-item {
    margin-bottom: 0.25rem;
}

.topic-item.has-children .topic-header {
    cursor: pointer;
}

.topic-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.topic-header:hover {
    background: var(--color-bg-secondary);
}

.topic-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.topic-item.expanded .topic-expand {
    transform: rotate(90deg);
}

.topic-title {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
}

.topic-page {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
}

.topic-children {
    margin-left: 1.5rem;
    margin-top: 0.25rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--color-border-light);
}

.subtopic-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subtopic-item:hover {
    background: var(--color-bg-secondary);
}

.subtopic-title {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.subtopic-page {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

/* Recent Nodes */
.nav-section-header--toggle {
    cursor: pointer;
    user-select: none;
}

.nav-section-header--toggle .nav-section-title {
    margin-bottom: 0;
}

.nav-section-header--toggle .nav-expand-all svg {
    transition: transform 0.2s ease;
}

#recentNodesSection.collapsed .nav-section-header--toggle .nav-expand-all svg {
    transform: rotate(-90deg);
}

#recentNodesSection.collapsed .recent-nodes-list {
    display: none;
}

#topicsNavigationSection.collapsed .nav-section-header--toggle .nav-expand-all svg {
    transform: rotate(-90deg);
}

#topicsNavigationSection.collapsed .topics-list {
    display: none;
}

.recent-nodes-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.recent-node-item {
    padding: 0.625rem 0.75rem;
    background: var(--color-bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recent-node-item:hover {
    background: var(--color-accent-500);
    color: white;
}

.recent-node-title {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Quick Links */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--color-bg-secondary);
    color: var(--color-accent-500);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Compact Quick Links - for BanterBox Links section */
.nav-section--compact {
    padding-top: 0.5rem;
}

.nav-section--compact .nav-section-title {
    font-size: 0.6875rem;
    margin-bottom: 0.375rem;
}

.quick-links--compact {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
}

.nav-link--compact {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.375rem;
    background: var(--color-bg-tertiary);
    border-radius: 4px;
}

.nav-link--compact svg {
    width: 14px;
    height: 14px;
}

.nav-link--compact:hover {
    background: var(--color-bg-secondary);
}

/* User Account Section - Always at bottom of sidebar */
.nav-account {
    margin-top: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border-light);
    flex-shrink: 0;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-accent-500);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-link {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.logout-link:hover {
    color: var(--color-accent-500);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.auth-actions .btn {
    padding: 0.625rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-actions .btn-primary {
    background: var(--color-accent-500);
    color: white;
    border: none;
}

.auth-actions .btn-primary:hover {
    background: var(--color-accent-600);
}

.auth-actions .btn-outline {
    background: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
}

.auth-actions .btn-outline:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-accent-500);
}

/* Compact auth actions - styled like quick-links */
.auth-actions--compact {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 5px;
}

/* Auth link variants */
.nav-link--auth {
    border: 1px solid var(--color-border-light);
    background: transparent;
}

.nav-link--auth:hover {
    border-color: var(--color-accent-500);
    background: transparent;
}

.nav-link--auth-primary {
    background: var(--color-accent-500);
    color: white;
}

.nav-link--auth-primary svg {
    stroke: white;
}

.nav-link--auth-primary:hover {
    background: var(--color-accent-600);
    color: white;
}

/* Compact user info */
.user-info--compact {
    gap: 0.625rem;
    padding-top: 5px;
}

.user-avatar--compact {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.user-email--compact {
    font-size: 0.75rem;
}

/* Navigation Overlay */
.policy-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1090;
}

.policy-nav-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Loading Placeholder */
.loading-placeholder {
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Short Viewport (small laptops) - tighten sidebar chrome */
@media (max-height: 800px) {
    .policy-side-nav .nav-header {
        padding: 0.75rem 1.25rem;
    }

    .policy-side-nav .nav-content {
        padding-top: 0.5rem;
    }

    .nav-section {
        padding: 0.5rem 1.25rem 0.75rem;
    }

    .nav-section-title {
        margin-bottom: 0.375rem;
    }

    .nav-section-header {
        margin-bottom: 0.375rem;
    }

    .nav-action {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .nav-account {
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .policy-side-nav {
        width: 100%;
        max-width: 320px;
    }
}

/* ============================================================
   DESKTOP: PERSISTENT SIDEBAR (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
    /* Sidebar is always visible on desktop */
    .policy-side-nav {
        transform: translateX(0);
        box-shadow: none;
        transition: width 0.3s ease, transform 0.3s ease;
    }

    /* Adjust main content when sidebar is visible */
    .reader-layout {
        margin-left: 360px;
        transition: margin-left 0.3s ease;
    }

    /* Adjust fixed input area to respect sidebar width */
    .reader-input {
        left: 360px;
        transition: left 0.3s ease;
    }

    /* Adjust audiobook player to respect sidebar width */
    .audiobook-player {
        left: 360px !important;
        transition: left 0.3s ease;
    }

    /* Adjust suggestions bar to respect sidebar width */
    .policy-suggestions-wrapper {
        left: 360px;
        transition: left 0.3s ease;
    }

    /* Hide overlay on desktop */
    .policy-nav-overlay {
        display: none;
    }

    /* Hide close button on desktop, show collapse toggle instead */
    .policy-side-nav .nav-close {
        display: none;
    }

    /* Collapse toggle button */
    .nav-collapse-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        background: transparent;
        border: 1px solid var(--color-border-light);
        border-radius: 6px;
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .nav-collapse-toggle:hover {
        background: var(--color-gray-100);
        color: var(--color-text-primary);
    }

    .nav-collapse-toggle svg {
        transition: transform 0.2s ease;
    }

    /* Collapsed state */
    .policy-side-nav.collapsed {
        width: 56px;
        overflow: visible;
    }

    .policy-side-nav.collapsed .nav-header {
        padding: 1rem 0.75rem;
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
    }

    .policy-side-nav.collapsed .nav-title,
    .policy-side-nav.collapsed .nav-content {
        display: none;
    }

    .policy-side-nav.collapsed .nav-collapse-toggle {
        transform: rotate(180deg);
        width: 40px;
        height: 40px;
        background: var(--color-accent-500);
        color: white;
        border-radius: 8px;
        border-color: var(--color-accent-500);
    }

    .policy-side-nav.collapsed .nav-collapse-toggle:hover {
        background: var(--color-accent-600);
        transform: rotate(180deg) scale(1.05);
    }

    .reader-layout.sidebar-collapsed {
        margin-left: 56px;
    }

    /* Adjust input area when sidebar is collapsed */
    .reader-layout.sidebar-collapsed .reader-input {
        left: 56px;
    }

    /* Adjust audiobook player when sidebar is collapsed */
    .reader-layout.sidebar-collapsed .audiobook-player {
        left: 56px !important;
    }

    /* Adjust suggestions bar when sidebar is collapsed */
    .reader-layout.sidebar-collapsed .policy-suggestions-wrapper {
        left: 56px;
    }

    /* Hide hamburger menu on desktop when sidebar is expanded */
    .nav-toggle {
        display: none;
    }

    /* Show hamburger menu when sidebar is collapsed (as additional way to expand) */
    .reader-layout.sidebar-collapsed .nav-toggle {
        display: flex;
    }
}

/* Below desktop: show mobile toggle, hide collapse toggle */
@media (max-width: 1023px) {
    .nav-collapse-toggle {
        display: none;
    }

    .reader-layout {
        margin-left: 0;
    }
}

/* ============================================================
   ADMIN DASHBOARD BUTTON STYLES
   ============================================================ */

/* Desktop Header Dashboard Button */
.nav-admin-dashboard {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.125rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-admin-dashboard:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    color: white !important;
}

.nav-admin-dashboard svg {
    transition: transform 0.2s ease;
}

.nav-admin-dashboard:hover svg {
    transform: rotate(180deg);
}

.nav-admin-dashboard span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Mobile Navigation Drawer Dashboard Button */
.nav-admin-dashboard-mobile {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white !important;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-admin-dashboard-mobile:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    color: white !important;
}

.nav-admin-dashboard-mobile svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nav-admin-dashboard-mobile:hover svg {
    transform: rotate(180deg);
}

.nav-admin-dashboard-mobile span {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Add subtle animation on page load */
@keyframes dashboardPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    }
    50% {
        box-shadow: 0 2px 12px rgba(59, 130, 246, 0.35);
    }
}

.nav-admin-dashboard,
.nav-admin-dashboard-mobile {
    animation: dashboardPulse 2s ease-in-out infinite;
}


/* ===========================
   Hierarchical TOC Styles
   =========================== */

/* TOC Category (top-level like "Ten Major Findings") */
.toc-category {
    margin-bottom: 0.25rem;
}

.toc-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toc-category-header:hover {
    background: var(--color-bg-secondary);
    border-radius: 6px;
}

.toc-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.toc-expand-btn svg {
    width: 12px;
    height: 12px;
}

.toc-category:not(.collapsed) .toc-category-header .toc-expand-btn {
    transform: rotate(90deg);
}

.toc-category-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
}

.toc-category-title.toc-node {
    cursor: pointer;
    /* Reset .toc-node styles that shouldn't apply to category titles */
    padding: 0;
    margin-bottom: 0;
    border-radius: 0;
}

.toc-category-title.toc-node:hover {
    color: var(--color-accent-500);
}

/* TOC Children (container for subcategories/nodes) */
.toc-children {
    padding-left: 0.5rem;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.toc-category.collapsed .toc-children {
    display: none;
}

/* TOC Subcategory (e.g., "Finding 1: World War Risk") */
.toc-subcategory {
    margin-bottom: 0.125rem;
}

.toc-subcategory-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    user-select: none;
    border-radius: 4px;
}

.toc-subcategory-header:hover {
    background: var(--color-bg-secondary);
}

.toc-subcategory:not(.collapsed) .toc-subcategory-header .toc-expand-btn {
    transform: rotate(90deg);
}

.toc-subcategory-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    line-height: 1.3;
}

/* TOC Nodes (leaf-level items) */
.toc-nodes {
    padding-left: 1.5rem;
    overflow: hidden;
}

.toc-subcategory.collapsed .toc-nodes {
    display: none;
}

.toc-node {
    padding: 0.375rem 0.625rem;
    margin-bottom: 0.125rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toc-node:hover {
    background: var(--color-bg-secondary);
}

.toc-node-title {
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    line-height: 1.3;
}

.toc-node:hover .toc-node-title {
    color: var(--color-accent-500);
}

/* Visited node indicator */
.toc-node.visited {
    opacity: 0.8;
}

.toc-node.visited .toc-node-title::after {
    content: ' ✓';
    color: var(--color-success, #22c55e);
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* Current node highlight */
.toc-node.current {
    background: var(--color-accent-100, rgba(59, 130, 246, 0.1));
}

.toc-node.current .toc-node-title {
    color: var(--color-accent-500);
    font-weight: 600;
}

/* Standalone TOC item (like "New to BanterBox?") */
.toc-standalone {
    padding: 0.75rem 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--color-border-light);
    cursor: pointer;
}

.toc-standalone:hover {
    background: var(--color-bg-secondary);
    border-radius: 6px;
}

.toc-standalone-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.toc-standalone:hover .toc-standalone-title {
    color: var(--color-accent-500);
}

.toc-standalone-desc {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    margin-top: 0.2rem;
    line-height: 1.3;
}

.toc-external-doc::after {
    content: '\2197';  /* ↗ arrow */
    float: right;
    opacity: 0.4;
    font-size: 0.8rem;
    margin-top: 0.1rem;
}

/* Loading placeholder */
.topics-list .loading-placeholder {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}
