/* 文档系统样式 */
:root {
    --primary-color: #7c8aff;
    --primary-hover: #6a77e0;
    --background-color: #1a1d24;
    --sidebar-bg: #22262e;
    --header-bg: #1f222a;
    --text-color: #e0e0e0;
    --text-muted: #a8b3cf;
    --border-color: #333742;
    --code-bg: #2d323c;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --danger-color: #ff6b6b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 头部样式 */
.doc-header {
    background-color: var(--header-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.2rem;
    height: 100%;
}

.logo svg {
    margin-right: 10px;
}

.doc-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
    height: 100%;
}

.doc-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 5px;
}

.doc-nav a:hover {
    color: var(--primary-color);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 2px;
    transition: 0.3s;
}

/* 移动端侧边栏容器 */
.sider-container {
    position: fixed;
    top: 60px;
    left: -300px;
    width: 280px;
    height: calc(100vh - 60px);
    background-color: var(--sidebar-bg);
    box-shadow: var(--shadow);
    z-index: 99;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.sider-container.active {
    left: 0;
}

/* 主容器 */
.container {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 140px);
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-radius: 12px;
    padding: 20px;
    margin-right: 20px;
    height: fit-content;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
    align-self: flex-start;
}

.sidebar-group {
    margin-bottom: 20px;
}

.sidebar-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-group-title .toggle-icon {
    transition: transform 0.3s ease;
}

.sidebar-group-title.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.sidebar-group-items {
    list-style: none;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
}

.sidebar-group-items.collapsed {
    max-height: 0;
    opacity: 0;
}

.sidebar-item {
    margin-bottom: 8px;
}

.sidebar-item a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-item a:hover,
.sidebar-item a.active {
    background-color: rgba(124, 138, 255, 0.15);
    color: var(--primary-color);
}

/* 主内容区 */
.main-content {
    flex: 1;
    background-color: var(--sidebar-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    position: relative;
    min-height: 600px;
}

.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* 内容样式 */
#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
    margin: 24px 0 16px 0;
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.25;
}

#content h1 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

#content h2 {
    font-size: 1.5rem;
    margin-top: 30px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

#content h3 {
    font-size: 1.25rem;
}

#content h4 {
    font-size: 1.1rem;
}

#content h5 {
    font-size: 1rem;
}

#content h6 {
    font-size: 0.9rem;
}

#content p {
    margin-bottom: 16px;
    color: var(--text-muted);
}

#content a {
    color: var(--primary-color);
    text-decoration: none;
}

#content a:hover {
    text-decoration: underline;
}

#content ul,
#content ol {
    padding-left: 20px;
    margin-bottom: 16px;
}

#content li {
    margin-bottom: 8px;
    color: var(--text-muted);
}

#content code {
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

#content pre {
    background-color: var(--code-bg);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

#content pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
    line-height: 1.4;
}

#content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 10px 20px;
    margin: 20px 0;
    background-color: rgba(124, 138, 255, 0.05);
    border-radius: 0 4px 4px 0;
}

#content blockquote p {
    margin: 0;
    color: var(--text-muted);
    font-style: italic;
}

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

/* 默认图片样式 */
#content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(124, 138, 255, 0.2);
    margin: 16px 0;
    box-sizing: border-box;
}

/* 文档开头的图片（紧跟在标题后的图片） */
#content h1 + p img,
#content h2 + p img,
#content h3 + p img,
#content h4 + p img,
#content h5 + p img,
#content h6 + p img {
    width: 100%;
    max-width: 100%;
}

/* 列表项下的图片 */
#content li img {
    max-width: 80%;
    margin: 8px 0 8px 20px;
    display: block;
}

/* 段落中的图片 */
#content p img {
    max-width: 100%;
    display: block;
    margin: 16px auto;
}

#content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

#content table th,
#content table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#content table th {
    background-color: rgba(124, 138, 255, 0.1);
    font-weight: 600;
}

#content table tr:hover {
    background-color: rgba(124, 138, 255, 0.05);
}

/* 底部 */
.doc-footer {
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 960px) {
    .sidebar {
        width: 220px;
    }
    
    .header-container {
        padding: 0 15px;
    }
    
    .container {
        padding: 15px;
    }
    
    .main-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .doc-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--header-bg);
        padding: 15px;
        box-shadow: var(--shadow);
    }
    
    .doc-nav.active {
        display: block;
    }
    
    .doc-nav ul {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        height: auto;
    }
    
    .doc-nav a {
        height: auto;
        padding: 5px 0;
    }
    
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        display: none;
    }
    
    /* 确保移动端侧边栏内容正确显示 */
    .sider-container .sidebar-group-items {
        max-height: 1000px;
        opacity: 1;
    }
    
    .sider-container .sidebar-group-items.collapsed {
        max-height: 0;
        opacity: 0;
    }
    
    .header-container {
        height: auto;
        padding: 15px;
        flex-wrap: wrap;
    }
    
    .logo {
        margin-bottom: 15px;
    }
    
    #content h1 {
        font-size: 1.75rem;
    }
    
    #content h2 {
        font-size: 1.35rem;
    }
    
    .main-content {
        min-height: auto;
    }
    
    /* 移动端图片样式 */
    #content img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
        border: 1px solid rgba(124, 138, 255, 0.2);
        margin: 16px 0;
        box-sizing: border-box;
    }
    
    /* 移动端列表项下的图片 */
    #content li img {
        max-width: 100%;
        margin: 8px 0;
    }
}