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

:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --secondary-color: #722ed1;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-tertiary: #8c8c8c;
    --border-color: #e8e8e8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --sidebar-width: 280px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 顶部导航栏 */
.top-nav {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

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

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 4px 0;
}

.nav-links::-webkit-scrollbar {
    height: 4px;
}

.nav-links::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.nav-link {
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    padding: 8px 20px;
    position: relative;
    white-space: nowrap;
    cursor: pointer;
}

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

.nav-link.active {
    color: var(--primary-color);
    font-weight: 500;
}

.nav-link.active::after {
    display: none;
}

/* 分类标签导航 */
.category-tabs {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.category-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.category-tabs-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 16px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.category-tabs-list::-webkit-scrollbar {
    height: 4px;
}

.category-tabs-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.category-tab {
    padding: 8px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #e6f7ff;
}

.category-tab.active {
    color: var(--card-bg);
    background: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

/* 主容器 */
.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    gap: 32px;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    position: sticky;
    top: 90px;
    height: calc(100vh - 112px);
    overflow-y: auto;
    align-self: flex-start;
}

.sidebar-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-number {
    font-size: 14px;
    font-weight: 600;
    min-width: 32px;
    opacity: 0.6;
}

.nav-item.active .nav-number {
    opacity: 1;
}

.nav-title {
    font-size: 14px;
    line-height: 1.4;
}

/* 主内容区 */
.main-content {
    flex: 1;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 48px;
    min-width: 0;
}

/* 页面头部 */
.page-header {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
}

/* 章节样式 */
.chapter {
    margin-bottom: 64px;
    scroll-margin-top: 100px;
}

.chapter:last-child {
    margin-bottom: 0;
}

.chapter-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.chapter-number {
    display: inline-block;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.chapter-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.chapter-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.view-detail-btn {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.view-detail-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.chapter-content {
    line-height: 1.8;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 16px;
}

.intro {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding: 20px;
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.chapter-content h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px 0;
}

.chapter-content h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px 0;
}

.chapter-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 16px;
}

.chapter-content ul {
    margin: 16px 0 24px 24px;
    color: var(--text-secondary);
}

.chapter-content li {
    margin-bottom: 12px;
    font-size: 16px;
    line-height: 1.7;
}

.chapter-content li::marker {
    color: var(--primary-color);
}

/* 内容占位符 */
.content-placeholder {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-color);
    border-radius: 8px;
    text-align: center;
    color: var(--text-tertiary);
    border: 1px dashed var(--border-color);
}

/* 项目列表 */
.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.project-item {
    padding: 24px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.project-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.project-item h4 {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.project-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* 页脚 */
.page-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

.page-footer p {
    margin-bottom: 8px;
}

.page-footer a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.page-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(24, 144, 255, 0.4);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .sidebar {
        display: none;
    }
    
    .container {
        padding: 16px;
    }
    
    .main-content {
        padding: 32px 24px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 16px;
        height: 56px;
    }
    
    .nav-links {
        gap: 6px;
        padding: 2px 0;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 6px 16px;
    }
    
    .sidebar {
        top: 136px;
    }
    
    .container {
        padding: 12px;
        gap: 16px;
    }
    
    .main-content {
        padding: 24px 16px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .page-subtitle {
        font-size: 16px;
    }
    
    .chapter-title {
        font-size: 24px;
        min-width: auto;
    }
    
    .chapter-title-row {
        gap: 12px;
    }
    
    .view-detail-btn {
        padding: 6px 16px;
        font-size: 13px;
    }
    
    .chapter-content h3 {
        font-size: 20px;
    }
    
    .project-list {
        grid-template-columns: 1fr;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 高亮当前章节 */
.chapter {
    transition: all 0.3s ease;
}

.chapter:target {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(24, 144, 255, 0.05);
    }
    100% {
        background-color: transparent;
    }
}

/* 分页控件 */
.pagination-container {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-number {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-number:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.pagination-number.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.pagination-info {
    margin-left: 16px;
    color: var(--text-tertiary);
    font-size: 14px;
    white-space: nowrap;
}

/* 响应式：分页控件 */
@media (max-width: 768px) {
    .pagination {
        gap: 8px;
    }
    
    .pagination-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .pagination-number {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }
    
    .pagination-info {
        margin-left: 8px;
        font-size: 12px;
    }
    
    .pagination-numbers {
        gap: 6px;
    }
}

