/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 屏幕阅读器专用样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 容器样式 */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧侧边栏 */
.sidebar {
    width: 280px;
    background-color: #34495e;
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav ul {
    list-style: none;
}

.nav li {
    border-bottom: 1px solid #2c3e50;
}

.chapter-link {
    display: block;
    padding: 1rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.chapter-link:hover {
    background-color: #2c3e50;
    padding-left: 1.7rem;
}

.chapter-link.active {
    background-color: #3498db;
    border-left: 4px solid #2980b9;
}

/* 右侧内容区域 */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: white;
}

/* 章节内容样式 */
#chapter-content {
    max-width: 800px;
    margin: 0 auto;
}

#chapter-content h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

#chapter-content h3 {
    color: #34495e;
    margin: 1.5rem 0 1rem;
    font-size: 1.5rem;
}

#chapter-content h4 {
    color: #555;
    margin: 1.2rem 0 0.8rem;
    font-size: 1.2rem;
}

#chapter-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

#chapter-content ul,
#chapter-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

#chapter-content li {
    margin-bottom: 0.5rem;
}

/* 代码块样式 */
.code-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-inline {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* 提示框样式 */
.note {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
}

.warning {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.table th,
.table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* 页脚样式 */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .content {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    #chapter-content h2 {
        font-size: 1.5rem;
    }
    
    #chapter-content h3 {
        font-size: 1.2rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 打印样式 */
@media print {
    .sidebar {
        display: none;
    }
    
    .content {
        padding: 0;
    }
    
    .header,
    .footer {
        display: none;
    }
}