.floating-toc {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 280px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.toc-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.toc-toggle {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toc-toggle:hover {
    color: #333;
}

.toc-content {
    overflow-y: auto;
    flex-grow: 1;
    padding: 8px 0;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-item {
    margin: 0;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #555;
    font-size: 13px;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    background: #f5f5f5;
    color: #333;
    border-left-color: #007cba;
}

.toc-link.active {
    background: #e3f2fd;
    color: #007cba;
    border-left-color: #007cba;
    font-weight: 500;
}

.toc-level-3 .toc-link {
    font-size: 12px;
    color: #666;
}

.toc-level-4 .toc-link {
    font-size: 11px;
    color: #777;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .floating-toc {
        position: fixed;
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
        transform: none;
        width: auto;
        max-height: 50vh;
    }
    
    .toc-header {
        padding: 10px 12px;
    }
    
    .toc-title {
        font-size: 13px;
    }
}

/* Collapsed state */
.floating-toc.collapsed {
    width: auto;
}

.floating-toc.collapsed .toc-content {
    display: none;
}

.floating-toc.collapsed .toc-header {
    border-radius: 8px;
}

/* Scrollbar styling */
.toc-content::-webkit-scrollbar {
    width: 4px;
}

.toc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}