/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --sidebar-bg: #2d3748;
    --sidebar-text: #e2e8f0;
    --content-bg: #f7fafc;
    --card-bg: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ==================== 返回按钮 ==================== */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--card-bg);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.back-button:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.back-button a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== 主容器 ==================== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ==================== 左侧边栏 ==================== */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 100px 0 40px 0;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 0 24px 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 搜索框 */
.search-box {
    padding: 0 24px 24px 24px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 导航菜单 */
.nav-menu {
    padding: 0 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    padding: 12px 12px 8px 12px;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    margin-bottom: 4px;
}

.nav-section a {
    display: block;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-section a:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

/* ==================== 右侧内容区 ==================== */
.content {
    margin-left: 300px;
    flex: 1;
    padding: 100px 60px 60px 60px;
    max-width: 1200px;
}

.content-section {
    background: var(--card-bg);
    padding: 40px;
    margin-bottom: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.content-section:hover {
    box-shadow: var(--shadow-hover);
}

.content-section h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.8;
}

/* 信息框 */
.info-box {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-left: 4px solid var(--primary-color);
    padding: 24px;
    border-radius: 8px;
    margin: 24px 0;
}

.info-row {
    margin-bottom: 16px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row .label {
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

.info-row code {
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.info-row ol {
    margin-left: 24px;
    line-height: 2;
}

.info-row li {
    margin-bottom: 8px;
}

.info-row li code {
    font-weight: 600;
    color: var(--primary-color);
}

/* 提示框 */
.tip-box {
    background: #e6fffa;
    border-left: 4px solid #38b2ac;
    padding: 20px 24px;
    border-radius: 8px;
    margin: 24px 0;
}

.tip-box ul {
    margin-left: 24px;
}

.tip-box li {
    margin-bottom: 12px;
    color: #2d3748;
    line-height: 1.8;
}

.tip-box li:last-child {
    margin-bottom: 0;
}

.tip-box strong {
    color: #38b2ac;
}

/* 警告框 */
.warning-box {
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    padding: 20px 24px;
    border-radius: 8px;
    margin: 24px 0;
}

.warning-box ul {
    margin-left: 24px;
}

.warning-box li {
    margin-bottom: 12px;
    color: #2d3748;
    line-height: 1.8;
}

.warning-box li:last-child {
    margin-bottom: 0;
}

.warning-box strong {
    color: #ed8936;
}

/* 注释框 */
.note-box {
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 20px 24px;
    border-radius: 8px;
    margin: 24px 0;
    color: #2d3748;
    line-height: 1.8;
}

.note-box code {
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #4299e1;
}

/* 代码块 */
.code-block {
    background: #282c34;
    border-radius: 12px;
    overflow: hidden;
    margin: 24px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-header span {
    color: #abb2bf;
    font-size: 13px;
    font-weight: 500;
}

.copy-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-btn.copied {
    background: #48bb78;
}

.code-block pre {
    margin: 0;
    padding: 24px 20px;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
}

/* ==================== 页脚 ==================== */
.content-footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.content-footer p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.copyright {
    font-size: 14px;
    opacity: 0.7;
}

/* ==================== 滚动条样式 ==================== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.code-block pre::-webkit-scrollbar {
    height: 8px;
}

.code-block pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.code-block pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .content {
        margin-left: 260px;
        padding: 100px 40px 40px 40px;
    }

    .content-section {
        padding: 30px;
    }

    .content-section h2 {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .back-button {
        top: 10px;
        left: 10px;
        padding: 10px 16px;
    }

    .back-button a {
        font-size: 14px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        padding: 80px 20px 40px 20px;
    }

    .content-section {
        padding: 24px;
    }

    .content-section h2 {
        font-size: 24px;
    }

    .section-desc {
        font-size: 15px;
    }
}
