/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 70px; /* 为固定导航栏留出空间 */
}

/* ============================
   固定导航栏样式
   ============================ */

.main-nav {
    background-color: #2c3e50;
    padding: 0.5rem 0;
    position: fixed; /* 固定定位 */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 站点标题样式 */
.site-title {
    display: flex;
    flex-direction: column;
}

.site-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s;
}

.site-name:hover {
    color: #1abc9c;
    text-decoration: none;
}

.site-subtitle {
    font-size: 0.7rem;
    color: #bdc3c7;
    margin-top: 0.1rem;
    font-style: italic;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-left: 1.5rem;
    position: relative;
}

/* 导航链接 */
.nav-link {
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.8rem 0.5rem;
    display: block;
    position: relative;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: #1abc9c;
}

.nav-link.active {
    color: #1abc9c;
    border-bottom-color: #1abc9c;
}

/* 下拉菜单样式 */
.dropdown-toggle {
    display: flex;
    align-items: center;
}

.dropdown-arrow {
    font-size: 0.6em;
    margin-left: 5px;
    transition: transform 0.3s;
}

/* 下拉菜单容器 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1001;
    display: none; /* 默认隐藏 */
    min-width: 150px;
    padding: 0.5rem 0;
    background-color: white;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* 鼠标悬停在.dropdown上时显示下拉菜单 */
.dropdown:hover .dropdown-menu {
    display: block;
}

/* 鼠标悬停时箭头旋转 */
.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* 下拉菜单项 */
.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    clear: both;
    font-weight: 400;
    color: #333;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: all 0.2s;
}

.dropdown-item:hover {
    color: #1abc9c;
    background-color: #f8f9fa;
}

/* ============================
   统一的页面布局样式
   ============================ */

/* 页面内容容器 - 所有页面统一使用 */
.page-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

/* 主内容区域 */
.main-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* 页面标题 */
.page-title {
    color: #2c3e50;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #1abc9c;
}

/* 章节标题 */
.section-title {
    color: #2c3e50;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* 内容卡片 */
.content-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #1abc9c;
}

/* 页脚统一样式 */
footer {
    text-align: center;
    padding: 1.5rem;
    color: #7f8c8d;
    border-top: 1px solid #eee;
    margin-top: 3rem;
    background: white;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .nav-container {
        padding: 0.5rem 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .site-title {
        margin-bottom: 0.5rem;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-item {
        margin: 0;
        width: 100%;
    }
    
    .nav-link {
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* 移动端点击显示下拉菜单 */
    .dropdown-menu {
        position: static;
        width: 100%;
        border: none;
        box-shadow: none;
        background-color: rgba(0,0,0,0.1);
        border-radius: 0;
        display: none;
    }
    
    /* 移动端添加active类来显示下拉菜单 */
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-item {
        color: #ecf0f1;
        padding-left: 1.5rem;
    }
    
    .dropdown-item:hover {
        background-color: rgba(255,255,255,0.1);
    }
    
    .page-container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }
    
    .main-content {
        padding: 1.5rem;
    }
}

/* ============================
   文章页面布局样式
   ============================ */

/* 文章布局容器 */
.article-layout {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

/* 文章网格布局 */
.article-grid {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    gap: 2rem;
    align-items: start;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .article-grid {
        grid-template-columns: 220px 1fr 250px;
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .article-grid {
        grid-template-columns: 200px 1fr;
    }
    
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .article-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .left-sidebar {
        display: none;
    }
}

/* ============================
   左侧边栏样式
   ============================ */

.left-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.sidebar-title {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* 文章列表 */
.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-item {
    border-bottom: 1px solid #f0f0f0;
}

.article-item:last-child {
    border-bottom: none;
}

.article-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
}

.article-link:hover {
    background-color: #f8f9fa;
    color: #1abc9c;
}

.article-link.active {
    background-color: #e8f4f1;
    color: #1abc9c;
    border-left: 4px solid #1abc9c;
}

.article-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.article-date {
    font-size: 0.8rem;
    color: #95a5a6;
    white-space: nowrap;
    margin-left: 0.5rem;
}

/* 分类筛选 */
.category-filter {
    padding: 1.5rem;
}

.category-filter h4 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 0.8rem;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 0.5rem;
}

.category-link {
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    padding: 0.3rem 0;
    display: block;
    transition: color 0.2s;
}

.category-link:hover {
    color: #1abc9c;
}

/* ============================
   右侧边栏样式
   ============================ */

.right-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.right-sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-chapters {
    background: none;
    border: 1px solid #ddd;
    color: #7f8c8d;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-chapters:hover {
    background: #f8f9fa;
}

/* 章节导航 */
.chapter-nav {
    padding: 0 1.5rem 1.5rem;
}

.chapter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-item {
    margin-bottom: 0.8rem;
}

.chapter-link {
    display: block;
    font-size: 0.95rem;
    color: #555;
    text-decoration: none;
    padding: 0.3rem 0;
    transition: color 0.2s;
    border-left: 3px solid transparent;
    padding-left: 0.8rem;
}

.chapter-link:hover,
.chapter-link.active {
    color: #1abc9c;
    border-left-color: #1abc9c;
}

.subchapter-list {
    list-style: none;
    padding-left: 1.2rem;
    margin-top: 0.5rem;
    border-left: 1px dashed #eee;
}

.subchapter-link {
    display: block;
    font-size: 0.85rem;
    color: #7f8c8d;
    text-decoration: none;
    padding: 0.2rem 0.8rem;
    transition: color 0.2s;
}

.subchapter-link:hover,
.subchapter-link.active {
    color: #1abc9c;
}

/* 阅读进度 */
.reading-progress {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1abc9c, #16a085);
    width: 0%;
    transition: width 0.3s ease;
}

/* 文章信息 */
.article-meta {
    padding: 1.5rem;
}

.article-meta h4 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 0.8rem;
}

.meta-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: #555;
}

.meta-list li {
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
}

.meta-list li:before {
    content: "•";
    color: #1abc9c;
    position: absolute;
    left: 0;
}

/* ============================
   文章正文样式
   ============================ */

.article-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    min-height: 500px;
}

.article-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #7f8c8d;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1abc9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.article-error {
    padding: 3rem;
    text-align: center;
}

.article-error button {
    background: #1abc9c;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

.article-error button:hover {
    background: #16a085;
}

/* 文章内容样式 */
.article-content {
    padding: 2.5rem;
}

.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.article-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f1f8ff;
    color: #1abc9c;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* 文章正文 */
.article-section {
    margin-bottom: 2.5rem;
}

.article-section h2 {
    color: #2c3e50;
    margin: 2rem 0 1.2rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
    font-size: 1.5rem;
}

.article-section h3 {
    color: #2c3e50;
    margin: 1.5rem 0 1rem 0;
    font-size: 1.2rem;
}

.article-section p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
    color: #444;
}

.article-section ul,
.article-section ol {
    margin: 1rem 0 1rem 1.5rem;
    line-height: 1.8;
}

/* 表格样式 */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
    border: 1px solid #eee;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

table th {
    background: #f8f9fa;
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
}

table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eee;
}

table tr:hover {
    background: #f8f9fa;
}

/* 文章页脚 */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.prev-article,
.next-article {
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
    max-width: 45%;
}

.prev-article:hover,
.next-article:hover {
    color: #1abc9c;
}

.article-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

.action-btn.liked {
    background: #e8f4f1;
    color: #1abc9c;
    border-color: #1abc9c;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

pre:hover .copy-code-btn {
    opacity: 1;
}

.copyright-notice {
    text-align: center;
    font-size: 0.85rem;
    color: #95a5a6;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

/* 折叠状态 */
#chaptersContent.collapsed {
    display: none;
}