/* 基础样式重置和全局设置 */
* {
    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: #374151;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 50%, #ecfdf5 100%);
    min-height: 100vh;
}

/* 导航栏样式 */
.header {
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700;
}

/* 主要内容布局 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    min-height: calc(100vh - 64px);
}

/* 目录导航样式 */
.table-of-contents {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.toc-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #10b981;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin: 0.5rem 0;
}

.toc-list a {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: block;
    padding: 0.25rem 0;
    border-radius: 4px;
}

.toc-list a:hover {
    color: #10b981;
    background-color: #f0fdf4;
    padding-left: 0.5rem;
}

/* 文章容器样式 */
.article-container {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* 返回链接 */
.back-link {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #10b981;
}

.back-link::before {
    content: '←';
    margin-right: 0.5rem;
    font-weight: bold;
}

/* 文章头部 */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.article-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.article-category {
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
}

/* 分享按钮 */
.share-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.share-btn:hover {
    background: #f9fafb;
    border-color: #10b981;
    color: #10b981;
}

.share-icon {
    width: 16px;
    height: 16px;
}

/* 文章内容样式 */
.article-content {
    font-size: 1rem;
    line-height: 1.8;
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 1.5rem 0 0.75rem 0;
}

.article-content p {
    margin: 1rem 0;
    color: #4b5563;
}

.article-content ul, .article-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin: 0.5rem 0;
    color: #4b5563;
}

.article-content a {
    color: #10b981;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.article-content a:hover {
    border-bottom-color: #10b981;
}

/* 代码块样式 */
.code-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.code-block code {
    color: #1e293b;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* 高亮框样式 */
.highlight-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    position: relative;
}

.highlight-box::before {
    content: '💡';
    position: absolute;
    top: -8px;
    left: 16px;
    background: white;
    padding: 0 8px;
    font-size: 1.2rem;
}

.highlight-box strong {
    color: #065f46;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }
    
    .table-of-contents {
        position: static;
        max-height: none;
        order: 2;
    }
    
    .article-container {
        padding: 1.5rem;
    }
    
    .article-title {
        font-size: 1.875rem;
    }
}

@media (max-width: 768px) {
    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .share-inline {
        justify-content: center;
    }
    
    .share-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-content h2 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .article-container {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .share-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .share-btn span {
        display: none;
    }
    
    .share-icon {
        width: 18px;
        height: 18px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

.article-container {
    animation: fadeIn 0.6s ease-out;
}

.table-of-contents {
    animation: fadeIn 0.8s ease-out;
}

/* 打印样式 */
@media print {
    .table-of-contents,
    .share-inline,
    .back-link {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .article-container {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    body {
        background: white;
    }
}