/* ============================================================
   文档页面样式 (page_detail_doc.css)
   ============================================================ */

:root {
    --doc-primary: #16BAAA;
    --doc-primary-light: #e6f7f6;
    --doc-bg-dark: #2c3e50;
    --doc-bg-light: #f8f9fa;
    --doc-text-dark: #2c3e50;
    --doc-text-light: #666;
    --doc-border: #e8e8e8;
}

/* 文档页面导航栏默认白色背景 */
.main-header {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-header .nav-item > a {
    color: #000;
    text-shadow: none;
}

.main-header .nav-item > a:hover,
.main-header .nav-item.active > a {
    color: var(--accent-color);
}

.main-header .logo .logo-transparent {
    display: none;
}

.main-header .logo .logo-default {
    display: block;
}

.main-header.scrolled .logo .logo-transparent {
    display: none;
}

.main-header.scrolled .logo .logo-default {
    display: block;
}

.main-header .header-user-actions .user-link,
.main-header .header-user-actions .user-logout {
    color: #000;
}

.main-header .header-user-actions .user-divider {
    color: #000;
}

.main-header .header-user-actions .user-avatar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.main-header .header-user-actions .header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
    transition: all 0.2s;
}

.main-header .header-user-actions .header-avatar:hover {
    transform: scale(1.1);
}

.main-header .header-user-actions .header-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, #a88b4a 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-color);
    transition: all 0.2s;
}

.main-header .header-user-actions .header-avatar-placeholder:hover {
    transform: scale(1.1);
}

.main-header .header-user-actions .user-logout-btn {
    color: #000;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    background: transparent;
}

.main-header .header-user-actions .user-logout-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

.main-header .mobile-menu-btn span {
    background-color: var(--text-color);
}

/* 文档页面移动端导航关闭按钮颜色 */
.main-header .mobile-menu-btn.active span {
    background-color: #fff;
}

/* 文档页面语言切换按钮样式 - 与登录/注册按钮一致的交互效果 */
.main-header .lang-switch-btn {
    color: #000;
    opacity: 0.9;
    transition: all 0.2s ease;
    padding: 10px 15px;
    font-weight: normal;
    font-size: inherit;
}
.main-header .lang-switch-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}
.main-header .lang-switch-arrow {
    color: #000;
}
.main-header .lang-code-item {
    color: #000;
}
.main-header .lang-code-item.active {
    color: var(--text-color);
}

/* 文档页面：上传的自定义图标保持深色（与导航文字 #000 一致） */
.main-header .lang-switch-custom-icon {
    filter: brightness(0) invert(0);
}

/* 文档页面移动端语言按钮 */
.main-header .mobile-lang-btn {
    color: #000;
    border-color: #000;
    opacity: 0.9;
    transition: all 0.2s ease;
}
.main-header .mobile-lang-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* 文档页面语言下拉框 - 确保在侧边栏之上 */
.main-header .lang-switch-dropdown {
    z-index: 1003;
}

/* 文档布局 */
.doc-layout {
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 90px 0 20px;
}

.doc-sidebar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    margin-left: -455px;
    top: 90px;
    width: 260px;
    /* 桌面端：顶部导航90px + 底部按钮80px + 间距 */
    height: calc(100vh - 180px);
    background: #fff;
    border: 1px solid var(--doc-border);
    border-radius: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, top 0.2s ease;
    z-index: 1002;
}

.doc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.doc-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.doc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.doc-nav-section {
    padding: 0;
}

.doc-nav-logo {
    padding: 20px 20px 15px;
    font-size: 16px;
    font-weight: 600;
    color: var(--doc-text-dark);
    border-bottom: 1px solid var(--doc-border);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-nav-logo::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--doc-primary);
    border-radius: 2px;
}

.doc-nav-section-title {
    padding: 8px 20px;
    font-size: 14px;
    color: var(--doc-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.doc-nav-item {
    display: block;
    padding: 6px 20px 6px 30px;
    color: var(--doc-text-light);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.doc-nav-item:hover {
    color: var(--doc-primary);
    background: var(--doc-primary-light);
}

.doc-nav-item.active {
    color: var(--doc-primary);
    background: var(--doc-primary-light);
    border-left-color: var(--doc-primary);
    font-weight: 500;
}

.doc-nav-submenu {
    display: none;
}

.doc-nav-submenu.show {
    display: block;
}

.doc-nav-subitem {
    display: block;
    padding: 6px 20px 6px 50px;
    color: var(--doc-text-light);
    text-decoration: none;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.doc-nav-subitem:hover {
    color: var(--doc-primary);
    background: var(--doc-primary-light);
}

.doc-nav-subitem.active {
    color: var(--doc-primary);
    background: var(--doc-primary-light);
    border-left-color: var(--doc-primary);
}

.doc-main-content {
    margin-left: 280px;
    width: calc(1200px - 300px);
    max-width: calc(100% - 280px);
    padding: 0;
    box-sizing: border-box;
}

.doc-content-section {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 15px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.doc-content-section h2 {
    font-size: 26px;
    color: var(--doc-text-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--doc-primary);
    display: inline-block;
}

.doc-content-section h3 {
    font-size: 20px;
    color: var(--doc-text-dark);
    margin: 30px 0 15px;
    padding-left: 15px;
    border-left: 4px solid var(--doc-primary);
}

.doc-content-section p {
    margin-bottom: 15px;
    color: var(--doc-text-light);
}

.doc-content-section ul, .doc-content-section ol {
    margin: 15px 0 15px 25px;
    color: var(--doc-text-light);
}

.doc-content-section li {
    margin-bottom: 8px;
}

.doc-code-block {
    background: #1e1e1e;
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
}

.doc-code-header {
    background: #2d2d2d;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-code-title {
    color: #888;
    font-size: 12px;
}

.doc-code-lang {
    color: var(--doc-primary);
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(22, 186, 170, 0.2);
    border-radius: 3px;
}

.doc-code-block pre {
    padding: 15px;
    margin: 0;
    overflow-x: auto;
    color: #d4d4d4;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.doc-code-block code {
    font-family: inherit;
}

.doc-content-section code:not(.doc-code-block code) {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #e83e8c;
}

.doc-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

.doc-content-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.doc-content-section th {
    background: var(--doc-bg-dark);
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
}

.doc-content-section td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--doc-border);
}

.doc-content-section tr:hover td {
    background: var(--doc-primary-light);
}

.doc-content-section tr:nth-child(even) td {
    background: #fafafa;
}

.doc-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.doc-feature-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 25px;
    color: #fff;
}

.doc-feature-card:nth-child(2) {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.doc-feature-card:nth-child(3) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.doc-feature-card:nth-child(4) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.doc-feature-card h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.doc-feature-card p {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.doc-tip-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    border-radius: 0 6px 6px 0;
    margin: 15px 0;
}

.doc-tip-box.info {
    background: #d1ecf1;
    border-left-color: #17a2b8;
}

.doc-tip-box.success {
    background: #d4edda;
    border-left-color: #28a745;
}

.doc-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--doc-primary);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(22, 186, 170, 0.4);
}

.doc-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    position: relative;
    transition: 0.3s;
}

.doc-menu-toggle span::before,
.doc-menu-toggle span::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #fff;
    transition: 0.3s;
}

.doc-menu-toggle span::before {
    top: -6px;
}

.doc-menu-toggle span::after {
    top: 6px;
}

.doc-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

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

.doc-back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--doc-bg-dark);
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.doc-back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.doc-back-to-top:hover {
    background: var(--doc-primary);
}

/* ============================================================
   平板/移动端适配 (<=1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .doc-sidebar {
        position: fixed;
        margin-left: 0;
        left: 0;
        transform: translateX(-100%);
        width: 260px;
    }

    .doc-sidebar.open {
        transform: translateX(0);
        box-shadow: 5px 0 20px rgba(0,0,0,0.1);
    }

    .doc-sidebar.open ~ .doc-main-content {
        margin-left: 0;
    }

    .doc-main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 20px;
    }

    .doc-content-section {
        padding: 25px;
    }

    .doc-menu-toggle {
        display: flex;
    }
}

/* ============================================================
   移动端适配 (<=767px)
   ============================================================ */
@media (max-width: 767px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .main-header {
        width: 100%;
        max-width: 100vw;
        padding: 10px 15px;
        box-sizing: border-box;
    }

    .main-header .container {
        width: 100%;
        max-width: 100vw;
        padding: 10px 15px;
        box-sizing: border-box;
    }

    .main-header .nav-item > a {
        color: #fff;
        text-shadow: none;
    }

    .main-header.scrolled .nav-item > a {
        color: #fff;
        text-shadow: none;
    }

    .doc-layout {
        padding: 70px 0 20px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .doc-sidebar {
        width: 75%;
        max-width: 280px;
        /* 移动端：顶部导航70px + 底部按钮80px + 浏览器导航条 + 安全区域 */
        height: calc(100vh - 160px - env(safe-area-inset-bottom, 0px));
        padding-bottom: 10px;
    }

    .doc-sidebar.open {
        transform: translateX(0);
        box-shadow: 5px 0 20px rgba(0,0,0,0.1);
    }

    .doc-main-content {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding: 0 15px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .doc-content-section {
        padding: 15px;
        margin: 0 0 15px 0;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .doc-content-section h2 {
        font-size: 20px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .doc-content-section h3 {
        font-size: 18px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .doc-content-section p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .doc-content-section code:not(.doc-code-block code) {
        word-break: break-all;
    }

    .doc-code-block {
        margin: 10px 0;
        border-radius: 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .doc-code-block pre {
        font-size: 12px;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-x: auto;
    }

    .doc-content-section ul,
    .doc-content-section ol {
        margin: 15px 0 15px 15px;
        padding-left: 10px;
    }

    .doc-content-section table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

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

    .doc-menu-toggle {
        display: flex;
    }
}
