/* ===== 公共变量 ===== */
:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

/* ===== 头部 ===== */
.docs-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.logo-home-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-home-link:hover {
    opacity: 0.85;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.logo-text-link {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-text-link:hover {
    opacity: 0.85;
}

.header-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.header-update {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.link-item {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.link-item:hover {
    color: var(--primary);
    background: #eff6ff;
}

/* ===== 主容器 ===== */
.docs-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    padding: 20px 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
}

.nav-tree {
    padding: 0 12px;
}

.nav-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.nav-list {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    color: var(--primary);
    background: #eff6ff;
}

.nav-link.active {
    color: var(--primary);
    background: #eff6ff;
    font-weight: 500;
}

/* 子导航（文章内页跳转） */
.nav-sub-list {
    list-style: none;
    padding-left: 20px;
    margin: 0 0 8px;
    border-left: 2px solid var(--border);
    margin-left: 17px;
}

.nav-sub-link {
    display: block;
    padding: 5px 12px;
    font-size: 12.5px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-sub-link:hover {
    color: var(--primary);
    background: #eff6ff;
}

.nav-sub-link.active {
    color: var(--primary);
    font-weight: 500;
}

/* AI徽标 */
.ai-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1.5;
}

/* ===== 右侧内容 ===== */
.content-area {
    flex: 1;
    padding: 32px;
    min-height: calc(100vh - 60px);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.content-section h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.content-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 28px 0 14px;
}

.content-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 10px;
}

.content-section p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 12px;
}

.content-section ul,
.content-section ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.content-section li {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 6px;
}

.content-section li strong {
    color: var(--text);
}

.content-section dl {
    margin-bottom: 16px;
}

.content-section dt {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-top: 12px;
}

.content-section dd {
    font-size: 15px;
    color: var(--text-secondary);
    padding-left: 20px;
    margin-top: 4px;
}

/* ===== 功能卡片 ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: box-shadow 0.2s;
}

.feature-card:hover {
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px 0;
}

.feature-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* ===== 信息网格 ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.info-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px;
}

.info-item strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}

.info-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== 评分等级 ===== */
.grade {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}

.grade.excellent { background: #d1fae5; color: #065f46; }
.grade.good { background: #dbeafe; color: #1e40af; }
.grade.warning { background: #fef3c7; color: #92400e; }
.grade.danger { background: #fee2e2; color: #991b1b; }

/* ===== 代码块 ===== */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 12px 0;
}

/* ===== 表格 ===== */
.code-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.code-table th,
.code-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.code-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
}

.code-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== 引用块 & 分割线 ===== */
.content-section blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 16px 0;
    background: #eff6ff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.content-section hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ===== 返回顶部按钮 ===== */
.back-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

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

.back-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .feature-grid,
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .docs-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        position: static;
        height: auto;
        max-height: 200px;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .content-section h1 {
        font-size: 24px;
    }
    
    .content-section h2 {
        font-size: 18px;
    }
    
    .feature-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .back-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ===== 页脚 ===== */
.site-footer {
    text-align: center;
    padding: 16px 20px;
    color: #94a3b8;
    font-size: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.8;
}

.site-footer-inner a {
    color: #94a3b8;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.site-footer-inner a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.site-footer-inner .footer-sep {
    margin: 0 6px;
    opacity: 0.5;
}

.site-footer-update {
    margin-top: 2px;
    font-size: 11px;
    color: #94a3b8;
    opacity: 0.8;
}

/* 页脚响应式 */
@media (max-width: 640px) {
    .site-footer {
        padding: 14px 16px;
        font-size: 11px;
    }
    .site-footer-inner .footer-sep {
        margin: 0 4px;
    }
    .site-footer-update {
        font-size: 10px;
    }
}
