* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0ea5e9;
    --bg-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --code-bg: #f1f5f9;
    --hover-bg: #f1f5f9;
    --shadow-color: rgba(0, 0, 0, 0.05);
}

/* 暗色模式 */
body.dark-mode {
    --primary-color: #38bdf8;
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --header-bg: #1e293b;
    --text-color: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --code-bg: #334155;
    --hover-bg: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 顶部导航 */
.header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px var(--shadow-color);
    transition: background 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.logo span {
    color: #FD7F88;
}

.logo img {
    display: block;
    border-radius: 4px;
}

.logo svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.top-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.top-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.top-nav a:hover,
.top-nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 主题切换按钮 */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--text-secondary);
    position: relative;
    width: 36px;
    height: 36px;
}

.theme-toggle:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.theme-toggle svg {
    position: absolute;
    transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

body.dark-mode .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

body.dark-mode .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* 容器布局 */
.container {
    display: flex;
    position: relative;
    justify-content: center;
    padding-left: 280px;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    height: calc(100vh - 60px);
    position: fixed;
    left: 0;
    top: 60px;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.search-box {
    padding: 0 1.5rem 1rem;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.sidebar-nav {
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-section-title:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.nav-section-title::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.nav-section.collapsed .nav-section-title::after {
    transform: rotate(-90deg);
}

.nav-section-items {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    max-height: 1000px;
    opacity: 1;
}

.nav-section.collapsed .nav-section-items {
    max-height: 0;
    opacity: 0;
}

.nav-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* 主内容区 */
.content {
    width: 100%;
    max-width: 900px;
    padding: 3rem;
    min-height: calc(100vh - 60px);
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* 文档内容样式 */
.doc-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.doc-content h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.doc-content h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.doc-content p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.doc-content ul, .doc-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.doc-content li {
    margin-bottom: 0.5rem;
}

.doc-content code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'Consolas', 'Monaco', monospace;
}

.doc-content pre {
    background: #282c34;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.doc-content pre code {
    background: none;
    padding: 0;
    color: #abb2bf;
}

.doc-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    background: var(--hover-bg);
    margin-bottom: 1rem;
    border-radius: 4px;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.doc-content th,
.doc-content td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

/* 视频容器样式 */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 比例 */
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 图片懒加载样式 */
.doc-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.doc-content img.lazy-img {
    background: linear-gradient(
        90deg,
        var(--hover-bg) 0%,
        var(--code-bg) 50%,
        var(--hover-bg) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    min-height: 200px;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.doc-content img.lazy-img.loaded {
    opacity: 1;
    animation: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 图片预览功能 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.image-preview-overlay.active {
    opacity: 1;
}

.image-preview-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-preview-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    cursor: default;
}

.image-preview-overlay.active .image-preview-img {
    transform: scale(1);
}

.image-preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* 关键词标签样式 */
.keywords-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.keywords-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.keywords-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    cursor: default;
}

.keyword-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.doc-content th {
    background: var(--hover-bg);
    font-weight: 600;
}

/* 提示框 */
.tip, .warning, .danger {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.tip {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.warning {
    background: #fff7ed;
    border-color: #f59e0b;
    color: #92400e;
}

.danger {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 101;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }

    .top-nav {
        display: none;
    }

    .container {
        padding-left: 0;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 60px;
        z-index: 99;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        padding: 1.5rem;
    }

    .menu-toggle {
        display: flex;
    }

    .doc-content h1 {
        font-size: 2rem;
    }

    .doc-content h2 {
        font-size: 1.5rem;
    }
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

