/* 响应式网站样式表 */

/* CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS 变量定义 */
:root {
    --primary-color: #05c;
    --secondary-color: #333;
    --background-color: #fff;
    --sidebar-bg: #f8f8f8;
    --border-color: #e5e5e5;
    --text-color: #333;
    --link-color: #05c;
    --hover-color: #0066cc;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --max-width: 1200px;
    --sidebar-width: 280px;
    --header-height: 80px;
}

/* 基础样式 */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 链接样式 */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Microsoft YaHei', sans-serif;
    margin: 1em 0 0.5em;
    line-height: 1.3;
    color: var(--secondary-color);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* 段落样式 */
p {
    margin: 1em 0;
    text-indent: 2em;
}

/* 列表样式 */
ul, ol {
    margin: 1em 0;
    padding-left: 2em;
}

li {
    margin: 0.5em 0;
}

/* 图片样式 */
img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

th {
    background-color: var(--sidebar-bg);
    font-weight: 600;
}

/* Header 样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.header-title a {
    color: white;
    text-decoration: none;
}

.header-title a:hover {
    color: #f0f0f0;
    text-decoration: none;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 主要内容区域 */
.main-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
}

/* 文章内容区域 */
.article-content {
    flex: 1;
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-height: 500px;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

.sidebar h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* 目录导航样式 */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-color);
}

.nav-menu a:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

.nav-menu ul {
    padding-left: 20px;
    margin: 5px 0;
}

.nav-menu h3, .nav-menu h4 {
    margin: 15px 0 5px;
    font-size: 1rem;
    color: var(--secondary-color);
}

/* Footer 样式 */
footer {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

/* 移动端覆盖菜单 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 2001;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-content {
    padding: 20px;
}

/* 响应式设计 */

/* 平板端 */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .main-container {
        padding: 15px;
        gap: 15px;
    }
    
    .article-content {
        padding: 30px;
    }
}

/* 移动端 */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    html {
        font-size: 14px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-container {
        flex-direction: column;
        padding: 15px;
        gap: 0;
    }
    
    .sidebar {
        display: none;
    }
    
    .article-content {
        padding: 20px;
        margin: 0;
    }
    
    /* 移动端显示覆盖菜单 */
    .mobile-menu-overlay.active {
        display: block;
    }
    
    /* 移动端字体调整 */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    
    /* 移动端段落调整 */
    p {
        text-indent: 1.5em;
    }
    
    /* 移动端表格滚动 */
    table {
        font-size: 0.9rem;
    }
    
    .table-container {
        overflow-x: auto;
        margin: 1em 0;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    .header-content {
        padding: 0 10px;
    }
    
    .main-container {
        padding: 10px;
    }
    
    .article-content {
        padding: 15px;
    }
    
    .mobile-menu {
        width: 90%;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
}

/* 打印样式 */
@media print {
    .sidebar,
    .menu-toggle,
    .mobile-menu-overlay,
    .mobile-menu {
        display: none !important;
    }
    
    .main-container {
        flex-direction: column;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .article-content {
        box-shadow: none;
        padding: 20px 0;
    }
    
    header {
        position: static;
        background: white !important;
        color: black !important;
        box-shadow: none;
    }
    
    .header-title a {
        color: black !important;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-content {
    animation: fadeIn 0.5s ease;
}

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

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

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

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

/* 焦点样式 */
button:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --border-color: #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

