.doc-layout {
    display: flex;
    min-height: calc(100vh - 5rem);
    position: relative;
}

/* ---- 侧边栏 ---- */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: rgba(8, 8, 8, 0.95);
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    z-index: 50;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 44px;
    min-width: 44px;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .doc-group-title,
.sidebar.collapsed .doc-link,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1rem 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #222;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #666;
}

.sidebar-toggle {
    background: none;
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: 0.2s;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    border-color: #fff;
    color: #fff;
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s;
}

.sidebar-search {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #222;
}

.sidebar-search input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    outline: none;
    font-family: inherit;
    border-radius: 4px;
    transition: 0.2s;
}

.sidebar-search input:focus {
    border-color: #555;
    color: #fff;
}

.sidebar-search input::placeholder {
    color: #444;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.doc-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #555;
    letter-spacing: 0.15em;
    padding: 0.8rem 1.2rem 0.4rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.doc-group-title:hover {
    color: #888;
}

.doc-group-items {
    display: none;
}

.doc-link {
    display: block;
    padding: 0.5rem 1.2rem 0.5rem 2rem;
    font-size: 0.8rem;
    color: #777;
    text-decoration: none;
    transition: 0.15s;
    border-left: 2px solid transparent;
    cursor: pointer;
}

.doc-link:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.03);
}

.doc-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-left-color: #fff;
}

.sidebar-footer {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid #222;
    font-size: 0.7rem;
    color: #444;
}

/* ---- 主内容区 ---- */
.doc-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #222;
}

.doc-breadcrumb {
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 0.1em;
}

.doc-meta {
    font-size: 0.7rem;
    color: #444;
}

/* ---- 文档正文样式 ---- */
.doc-body {
    max-width: 860px;
}

.doc-body h2 {
    font-size: 1.6rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #222;
    color: #ddd;
}

.doc-body h2:first-child {
    margin-top: 0;
}

.doc-body h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.8rem;
    color: #bbb;
}

.doc-body p {
    margin-bottom: 1rem;
    color: #999;
    line-height: 1.8;
}

.doc-body ul {
    margin: 0.8rem 0 1.2rem 1.5rem;
    color: #999;
}

.doc-body li {
    margin-bottom: 0.4rem;
}

.doc-body strong {
    color: #ccc;
}

.doc-body a {
    color: #888;
    text-decoration: underline;
    transition: color 0.2s;
}

.doc-body a:hover {
    color: #fff;
}

.doc-body pre {
    background: rgba(15, 15, 15, 0.8);
    border: 1px solid #222;
    border-radius: 4px;
    padding: 1.2rem 1.5rem;
    margin: 1rem 0 1.5rem;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #aaa;
}

.doc-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
    color: #bbb;
}

.doc-body pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.doc-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 0.85rem;
}

.doc-body th {
    text-align: left;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid #333;
    color: #bbb;
}

.doc-body td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #1a1a1a;
    color: #888;
}

/* ---- 加载状态 ---- */
.doc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #555;
    font-size: 0.9rem;
}

.doc-loading .cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #555;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 5rem;
        height: calc(100vh - 5rem);
        z-index: 200;
    }

    .sidebar.collapsed {
        left: -280px;
        width: 280px;
        min-width: 280px;
    }

    .sidebar.collapsed .sidebar-title,
    .sidebar.collapsed .sidebar-search,
    .sidebar.collapsed .doc-group-title,
    .sidebar.collapsed .doc-link,
    .sidebar.collapsed .sidebar-footer {
        display: block;
    }

    .sidebar.collapsed .sidebar-header {
        justify-content: space-between;
        padding: 1rem 1.2rem;
    }

    .doc-content {
        padding: 1.5rem 1rem;
    }
}
