wsx-doc-sidebar {
    display: flex;
    flex-direction: column;
    width: 280px;
    min-width: 280px;
    height: 100%;
    background: var(--wsx-press-sidebar-bg, #f9fafb);
    border-right: 1px solid var(--wsx-press-border, #e5e7eb);
    overflow-y: auto;
    position: sticky;
    top: 70px; /* Navigation height */
    max-height: calc(100vh - 70px);
}

/* 浅色模式（通过类名，覆盖媒体查询） */
.light wsx-doc-sidebar,
[data-theme="light"] wsx-doc-sidebar {
    background: var(--wsx-press-sidebar-bg, #f9fafb);
    border-right-color: var(--wsx-press-border, #e5e7eb);
}

/* 暗色模式（通过类名） */
.dark wsx-doc-sidebar,
[data-theme="dark"] wsx-doc-sidebar {
    background: var(--wsx-press-sidebar-bg, #1f2937);
    border-right-color: var(--wsx-press-border, #374151);
}

/* 暗色模式（通过媒体查询作为后备，仅当没有显式类名时） */
@media (prefers-color-scheme: dark) {
    html:not(.light):not([data-theme="light"]) wsx-doc-sidebar {
        background: var(--wsx-press-sidebar-bg, #1f2937);
        border-right-color: var(--wsx-press-border, #374151);
    }
}

.doc-sidebar {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.doc-sidebar-loading,
.doc-sidebar-empty {
    padding: 2rem;
    text-align: center;
    color: var(--wsx-press-text-secondary, #6b7280);
}

.doc-sidebar-nav {
    padding: 1.5rem 0;
}

.doc-sidebar-category {
    margin-bottom: 2rem;
}

.doc-sidebar-category:last-child {
    margin-bottom: 0;
}

.doc-sidebar-category-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wsx-press-text-secondary, #6b7280);
    padding: 0.5rem 1.5rem;
    margin: 0 0 0.5rem 0;
}

/* 浅色模式分类标题（覆盖媒体查询） */
.light .doc-sidebar-category-title,
[data-theme="light"] .doc-sidebar-category-title {
    color: var(--wsx-press-text-secondary, #6b7280);
}

/* 暗色模式分类标题 */
.dark .doc-sidebar-category-title,
[data-theme="dark"] .doc-sidebar-category-title {
    color: var(--wsx-press-text-secondary, #9ca3af);
}

@media (prefers-color-scheme: dark) {
    html:not(.light):not([data-theme="light"]) .doc-sidebar-category-title {
        color: var(--wsx-press-text-secondary, #9ca3af);
    }
}

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

.doc-sidebar-item {
    margin: 0;
}

.doc-sidebar-link {
    display: block;
    padding: 0.5rem 1.5rem;
    color: var(--wsx-press-text-primary, #111827);
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.doc-sidebar-link:hover {
    background: var(--wsx-press-sidebar-hover-bg, #f3f4f6);
    color: var(--wsx-press-text-primary, #111827);
}

.doc-sidebar-link.active {
    background: var(--wsx-press-sidebar-active-bg, #fef2f2);
    color: var(--wsx-press-sidebar-active-color, #dc2626);
    border-left-color: var(--wsx-press-sidebar-active-color, #dc2626);
    font-weight: 500;
}

/* 浅色模式链接样式（覆盖媒体查询） */
.light .doc-sidebar-link,
[data-theme="light"] .doc-sidebar-link {
    color: var(--wsx-press-text-primary, #111827);
}

.light .doc-sidebar-link:hover,
[data-theme="light"] .doc-sidebar-link:hover {
    background: var(--wsx-press-sidebar-hover-bg, #f3f4f6);
    color: var(--wsx-press-text-primary, #111827);
}

.light .doc-sidebar-link.active,
[data-theme="light"] .doc-sidebar-link.active {
    background: var(--wsx-press-sidebar-active-bg, #fef2f2);
    color: var(--wsx-press-sidebar-active-color, #dc2626);
    border-left-color: var(--wsx-press-sidebar-active-color, #dc2626);
}

/* 暗色模式链接样式 */
.dark .doc-sidebar-link,
[data-theme="dark"] .doc-sidebar-link {
    color: var(--wsx-press-text-primary, #e5e7eb);
}

.dark .doc-sidebar-link:hover,
[data-theme="dark"] .doc-sidebar-link:hover {
    background: var(--wsx-press-sidebar-hover-bg, #374151);
    color: var(--wsx-press-text-primary, #f3f4f6);
}

.dark .doc-sidebar-link.active,
[data-theme="dark"] .doc-sidebar-link.active {
    background: var(--wsx-press-sidebar-active-bg, rgba(220, 38, 38, 0.15));
    color: var(--wsx-press-sidebar-active-color, #f87171);
    border-left-color: var(--wsx-press-sidebar-active-color, #f87171);
}

@media (prefers-color-scheme: dark) {
    html:not(.light):not([data-theme="light"]) .doc-sidebar-link {
        color: var(--wsx-press-text-primary, #e5e7eb);
    }

    html:not(.light):not([data-theme="light"]) .doc-sidebar-link:hover {
        background: var(--wsx-press-sidebar-hover-bg, #374151);
        color: var(--wsx-press-text-primary, #f3f4f6);
    }

    html:not(.light):not([data-theme="light"]) .doc-sidebar-link.active {
        background: var(--wsx-press-sidebar-active-bg, rgba(220, 38, 38, 0.15));
        color: var(--wsx-press-sidebar-active-color, #f87171);
        border-left-color: var(--wsx-press-sidebar-active-color, #f87171);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    wsx-doc-sidebar {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    wsx-doc-sidebar {
        display: none; /* 在移动设备上隐藏侧边栏 */
    }
}
