/* styles.css - 完整样式 */

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* 平滑滚动 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
}

span{
    line-height: 1.6;
}

/* ========== 布局容器 ========== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ========== 左侧导航栏 ========== */
.sidebar {
    width: 350px;
    background-color: #2c3e50;
    color: #ecf0f1;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    font-size: 14px;
}

.nav-menu {
    padding: 20px 0;
}

.menu-primary {
    list-style: none;
}

.menu-item {
    margin-bottom: 5px;
}

/* 一级菜单标题 */
.menu-header {
    padding: 10px 20px;
    font-weight: bold;
    color: #ecf0f1;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

.menu-header:hover {
    background-color: #34495e;
}

/* 折叠指示箭头 */
.menu-header::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.menu-item.active .menu-header::after {
    transform: rotate(180deg);
}

/* 二级菜单容器 */
.menu-secondary {
    list-style: none;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

/* 展开状态的二级菜单 */
.menu-item.active .menu-secondary {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

/* 二级菜单项 */
.menu-secondary .menu-item {
    padding: 0;
}

.menu-secondary .menu-item a {
    display: block;
    padding: 8px 20px 8px 40px;
    color: #bdc3c7;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.menu-secondary .menu-item a:hover {
    color: #fff;
    background-color: #34495e;
}

/* 当前选中菜单项样式 */
.menu-secondary .menu-item a.active {
    color: #fff;
    background-color: #3498db;
    border-left: 3px solid #fff;
}

/* ========== 右侧内容区域 ========== */
.content {
    flex: 1;
    padding: 30px;
    background-color: #fff;
}

/* 默认欢迎内容 */
.default-content {
    display: block;
    padding: 20px 0;
}

/* 文档部分容器 - 默认隐藏 */
.doc-section {
    display: none;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 30px;
}

/* 当前目标文档部分 */
.doc-section:target {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

/* 淡入动画 */
@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: translateY(10px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 内容样式 ========== */
h1 {
    margin-bottom: 20px;
    color: #2c3e50;
}

h2 {
    margin: 25px 0 15px;
    color: #34495e;
}

p {
    margin-bottom: 15px;
}

/* 代码块样式 */
pre {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'Courier New', Courier, monospace;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #f8f8f8;
    padding: 2px 4px;
    border-radius: 3px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .content {
        padding: 20px;
    }
    
    /* 移动端菜单调整为默认展开 */
    .menu-secondary {
        max-height: none;
        display: block;
    }
    
    .menu-header::after {
        display: none;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .sidebar {
        display: none;
    }
    
    .content {
        padding: 0;
        width: 100%;
    }
    
    .doc-section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .default-content {
        display: none !important;
    }
}

/* 图片放大相关样式 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
}

.image-modal-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {transform: translate(-50%, -50%) scale(0.5); opacity: 0;}
    to {transform: translate(-50%, -50%) scale(1); opacity: 1;}
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover {
    color: #bbb;
}

/* 文档中的图片样式 */
.doc-section img {
    cursor: pointer;
    transition: 0.3s;
    max-width: 100%;
    height: auto;
}

.doc-section img:hover {
    opacity: 0.7;
}