/* ========================================
   文档页面专用样式 (doc.css)
   ======================================== */

/* 文档页面布局 */
.doc-page {
    background: #fff;
}

.doc-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 60px;
    min-height: 100vh;
}

/* 遮罩层 */
.doc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

.doc-overlay.active {
    display: block;
}

/* ==================== 左侧栏目文章 ==================== */
.doc-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    background: #fff;
}

.doc-sidebar-header {
    display: none;
    padding: 16px;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #e5e7eb;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.doc-sidebar-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.doc-sidebar-close svg {
    width: 18px;
    height: 18px;
}

.doc-sidebar-nav {
    padding: 24px 16px;
}

.doc-nav-group {
    margin-bottom: 16px;
}

.doc-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    padding-left: 12px;
}

.doc-nav-link {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: #475569;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.doc-nav-link:hover {
    color: #2563eb;
    background: #f8fafc;
}

.doc-nav-link.active {
    color: #2563eb;
    border-left-color: #2563eb;
    background: #eff6ff;
    font-weight: 500;
}

/* ==================== 右侧内容区 ==================== */
.doc-content-area {
    flex: 1;
    display: flex;
    min-width: 0;
}

/* 正文区域 */
.doc-main {
    flex: 1;
    min-width: 0;
    padding: 32px 48px;
}

.doc-article-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px;
    line-height: 1.3;
}

.doc-article-meta {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.doc-article-body {
    font-size: 16px;
    line-height: 1.8;
    color: #334155;
}

.doc-article-body h2 {
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
    margin: 32px 0 12px;
}

.doc-article-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 24px 0 10px;
}

.doc-article-body p {
    margin-bottom: 16px;
}

.doc-article-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

/* 上一篇/下一篇 */
.doc-article-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.doc-prev-next {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.doc-prev-next:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.doc-prev-next.prev {
    align-items: flex-start;
}

.doc-prev-next.next {
    align-items: flex-end;
    text-align: right;
}

.doc-prev-next-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.doc-prev-next-title {
    font-size: 15px;
    color: #6366f1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ==================== 右侧文章导航 ==================== */
.doc-toc {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 32px 24px 32px 16px;
}

.doc-toc-header {
    display: none;
    padding: 16px;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #e5e7eb;
    justify-content: space-between;
    align-items: center;
}

.doc-toc-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.doc-toc-close svg {
    width: 18px;
    height: 18px;
}

.doc-toc-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    padding-left: 8px;
}

.doc-toc-nav {
    padding-left: 8px;
}

.doc-toc-link {
    display: block;
    padding: 6px 0 6px 12px;
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.doc-toc-link:hover {
    color: #2563eb;
}

.doc-toc-link.active {
    color: #2563eb;
    border-left-color: #2563eb;
}

.doc-toc-link.level-3 {
    padding-left: 24px;
    font-size: 13px;
}

.doc-toc-link.level-4 {
    padding-left: 36px;
    font-size: 13px;
}

/* 右侧二维码卡片 */
.doc-toc-card {
    margin-top: 24px;
    padding: 16px;
    text-align: center;
    border-radius: 8px;
    background: #f8fafc;
}

.doc-toc-card img {
    width: 140px;
    height: 140px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.doc-toc-card p {
    margin: 10px 0 0;
    font-size: 13px;
    color: #64748b;
}

/* ==================== 移动端工具栏 ==================== */
.doc-mobile-toolbar {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 44px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 85;
    padding: 0 16px;
    justify-content: space-between;
    align-items: center;
}

.doc-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
}

.doc-toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.doc-toolbar-btn:hover {
    background: #f8fafc;
}

/* PC端隐藏底部微信栏 */
.doc-page .g-mobile-bottom-bar {
    display: none;
}

/* ==================== 移动端响应式 ==================== */
@media (max-width: 1024px) {
    /* 显示移动端工具栏 */
    .doc-mobile-toolbar {
        display: flex;
    }

    /* 布局调整 */
    .doc-layout {
        display: block;
        padding-top: 104px;
    }

    /* 左侧栏目 - 抽屉式 */
    .doc-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100%;
        background: #fff;
        z-index: 95;
        padding: 0;
        transition: left 0.3s;
        border-right: 1px solid #e5e7eb;
    }

    .doc-sidebar.open {
        left: 0;
    }

    .doc-sidebar-header {
        display: flex;
    }

    .doc-sidebar-nav {
        padding: 16px;
        height: calc(100% - 57px);
        overflow-y: auto;
    }

    /* 右侧导航 - 抽屉式 */
    .doc-toc {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100%;
        background: #fff;
        z-index: 95;
        padding: 0;
        transition: right 0.3s;
        border-left: 1px solid #e5e7eb;
    }

    .doc-toc.open {
        right: 0;
    }

    .doc-toc-header {
        display: flex;
    }

    .doc-toc-title {
        padding: 12px 16px;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0;
    }

    .doc-toc-nav {
        padding: 16px;
        height: calc(100% - 100px);
        overflow-y: auto;
    }

    .doc-toc-card {
        display: none;
    }

    /* 正文区域 */
    .doc-main {
        width: 100%;
        padding: 16px;
        padding-bottom: 80px;
    }

    /* 移动端显示底部微信栏 */
    .doc-page .g-mobile-bottom-bar {
        display: block;
    }
}

@media (max-width: 640px) {
    .doc-article-title {
        font-size: 22px;
    }

    .doc-article-footer {
        grid-template-columns: 1fr;
    }

    .doc-prev-next.next {
        align-items: flex-start;
        text-align: left;
    }
}
