/* ================== 全局重置与基础样式 ================== */
* {
    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;
}

.clearfix::after {
    content: "";
    clear: both;
    display: table;
}

/* ================== 容器与布局 ================== */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-main {
    display: flex;
    gap: 2rem;
    margin: 2rem auto 3rem;
    max-width: 1200px;
}

.content-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.content-body {
    flex: 1;
    min-width: 0;
}

/* ================== 文章内容区域 ================== */
.content-article {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

/* 文章头部 */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eaeaea;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: #666;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 特色图片 */
.featured-image {
    width: 100%;
    margin: 2rem 0;
    text-align: center;
}

.featured-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-caption {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* 文章内容样式 */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    color: #2d3748;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.article-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: #4a5568;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.article-content a:hover {
    border-color: #3498db;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid #3498db;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #555;
}

.article-content pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Courier New', Consolas, monospace;
}

.article-content code {
    background: #f1f2f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    display: block;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.article-content th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 1rem;
    border: 1px solid #dee2e6;
}

.article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
}

/* 图文混排样式 */
.image-left {
    float: left;
    margin: 0 1.5rem 1rem 0;
    max-width: 50%;
}

.image-right {
    float: right;
    margin: 0 0 1rem 1.5rem;
    max-width: 50%;
}

.image-center {
    display: block;
    margin: 2rem auto;
}

/* 标签样式 */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0;
}

.tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #f1f2f6;
    color: #4a5568;
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* 分享按钮 */
.article-share {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 导航按钮 */
.article-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eaeaea;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 6px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
}

/* ================== 侧边栏样式 ================== */
.sidebar-widget {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    color: #2c3e50;
}

/* 相关文章列表 */
.related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.related-item {
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s ease;
}

.related-item:last-child {
    border-bottom: none;
}

.related-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-item a:hover {
    background-color: #f9f9f9;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin: 0 -0.5rem;
    border-radius: 4px;
}

.related-item a:hover .related-title {
    color: #3498db;
}

/* 相关文章缩略图 */
.related-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.related-noimage {
    width: 60px;
    height: 60px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.related-noimage svg {
    width: 24px;
    height: 24px;
    fill: #999;
}

/* 相关文章信息 */
.related-info {
    flex: 1;
    min-width: 0;
}

.related-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.2s ease;
}

.related-date {
    font-size: 0.8125rem;
    color: #999;
    display: block;
}

/* 空状态 */
.related-empty {
    padding: 1.5rem 0;
    text-align: center;
    color: #999;
    font-size: 0.9375rem;
}

.no-tags {
    color: #999;
    font-size: 0.875rem;
    font-style: italic;
}

/* ================== 响应式设计 ================== */

/* 大平板和桌面 */
@media (max-width: 992px) {
    .content-main {
        flex-direction: column;
    }
    
    .content-sidebar {
        width: 100%;
        order: 2;
    }
    
    .article-title {
        font-size: 1.75rem;
    }
    
    .image-left,
    .image-right {
        float: none;
        max-width: 100%;
        margin: 1rem 0;
    }
}

/* 平板 */
@media (max-width: 768px) {
    .content-container {
        padding: 0 15px;
    }
    
    .content-article {
        padding: 1.5rem;
    }
    
    .content-sidebar {
        margin-top: 1.5rem;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .article-content h2 {
        font-size: 1.5rem;
    }
    
    .article-content h3 {
        font-size: 1.25rem;
    }
    
    .article-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
    }
    
    .sidebar-widget {
        padding: 1.25rem;
    }
    
    .related-item a {
        padding: 0.625rem 0;
    }
    
    .related-thumbnail,
    .related-noimage {
        width: 50px;
        height: 50px;
    }
    
    .related-title {
        font-size: 0.875rem;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .content-article {
        padding: 1rem;
    }
    
    .article-title {
        font-size: 1.35rem;
    }
    
    .sidebar-widget {
        padding: 1rem;
    }
    
    .widget-title {
        font-size: 1rem;
    }
    
    .tag {
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
    }
}

/* ================== 深色模式支持 ================== */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .content-article,
    .sidebar-widget {
        background: #2c2c2c;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    }
    
    .article-title {
        color: #e0e0e0;
    }
    
    .article-header {
        border-bottom-color: #404040;
    }
    
    .article-meta {
        color: #aaa;
    }
    
    .article-content {
        color: #e0e0e0;
    }
    
    .article-content h2 {
        color: #e0e0e0;
        border-bottom-color: #404040;
    }
    
    .article-content h3 {
        color: #d0d0d0;
    }
    
    .article-content a {
        color: #5dade2;
    }
    
    .article-content blockquote {
        background: #3a3a3a;
        color: #ccc;
    }
    
    .article-content pre {
        background: #1e2a36;
        color: #d6e4f0;
    }
    
    .article-content code {
        background: #3a3a3a;
        color: #e0e0e0;
    }
    
    .article-content th {
        background: #3a3a3a;
        border-color: #555;
    }
    
    .article-content td {
        border-color: #555;
    }
    
    .widget-title {
        color: #e0e0e0;
        border-bottom-color: #404040;
    }
    
    .related-item {
        border-bottom-color: #404040;
    }
    
    .related-item a {
        color: #e0e0e0;
    }
    
    .related-item a:hover {
        background-color: #3a3a3a;
    }
    
    .related-noimage {
        background: #3a3a3a;
    }
    
    .related-noimage svg {
        fill: #888;
    }
    
    .related-date {
        color: #aaa;
    }
    
    .related-empty {
        color: #aaa;
    }
    
    .tag {
        background: #3a3a3a;
        color: #5dade2;
    }
    
    .tag:hover {
        background: #5dade2;
        color: #2c2c2c;
    }
    
    .no-tags {
        color: #aaa;
    }
    
    .share-btn {
        background: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .nav-link {
        background: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .nav-link:hover {
        background: #404040;
        border-color: #5dade2;
        color: #5dade2;
    }
}

/* ================== 打印样式 ================== */
@media print {
    .content-sidebar,
    .article-share,
    .article-navigation {
        display: none !important;
    }
    
    .content-article {
        box-shadow: none;
        padding: 0;
    }
    
    .article-title {
        font-size: 24pt;
    }
    
    .article-content h2 {
        font-size: 18pt;
        page-break-after: avoid;
    }
    
    .article-content h3 {
        font-size: 16pt;
        page-break-after: avoid;
    }
    
    .article-content p {
        font-size: 12pt;
    }
    
    .article-content pre,
    .article-content table,
    .article-content img {
        page-break-inside: avoid;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}