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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 容器布局 */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 侧边栏样式 */
.sidebar {
    width: 280px;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1001;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #6c757d;
    margin: 4px 0;
    transition: 0.3s;
}

.sidebar-nav {
    padding: 1rem 0;
}

/* 目录列表样式 */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list ul {
    list-style: none;
    padding-left: 1.5rem;
    margin: 0;
}

.toc-item {
    margin: 0;
}

.toc-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.toc-link:hover {
    background-color: #e9ecef;
    color: #212529;
    border-left-color: #007bff;
}

.toc-link.active {
    background-color: #e3f2fd;
    color: #1976d2;
    border-left-color: #1976d2;
    font-weight: 500;
}

.toc-link.active:hover {
    background-color: #e3f2fd;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    max-width: calc(100% - 280px);
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0;
}

.page-content {
    font-size: 1rem;
    line-height: 1.7;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #212529;
    scroll-margin-top: 100px;
}

.page-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.page-content h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.25rem;
}

.page-content h3 {
    font-size: 1.5rem;
}

.page-content h4 {
    font-size: 1.25rem;
}

.page-content h5 {
    font-size: 1.1rem;
}

.page-content h6 {
    font-size: 1rem;
}

.page-content p {
    margin-bottom: 1rem;
}

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

.page-content li {
    margin-bottom: 0.5rem;
}

.page-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
    font-style: italic;
}

.page-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.page-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1rem 0;
}

.page-content pre code {
    background-color: transparent;
    padding: 0;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.page-content th,
.page-content td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

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

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 1rem 0;
}

.page-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #6c757d;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    margin: 0 0.25rem;
}

.badge-blue {
    background-color: #007bff;
    color: #fff;
}

.badge-green {
    background-color: #28a745;
    color: #fff;
}

.badge-yellow {
    background-color: #ffc107;
    color: #212529;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 1rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .page-content h1 {
        font-size: 1.75rem;
    }
    
    .page-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-content {
        font-size: 0.95rem;
    }
}

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

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

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

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

.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

/* 高亮当前章节 */
.toc-link.current {
    background-color: #e3f2fd;
    color: #1976d2;
    border-left-color: #1976d2;
    font-weight: 500;
} 