/* 文章详情 */
.article-detail {padding: 30px 30px 0 30px;}
/* 文章头部 */
.article-header { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px dashed #f0f0f0; }
.article-title {font-size: 26px;line-height: 1.4;color: #2c3e50;margin-bottom: 15px;}
.article-meta { display: flex; gap: 20px; font-size: 14px; color: #999; }
/* 详情页：时间与浏览量小图标 */
.article-header .article-meta .publish-date::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center/contain;
    vertical-align: -2px;
}
.article-header .article-meta .views::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") no-repeat center/contain;
    vertical-align: -2px;
}
.article-meta span { display: flex; align-items: center; gap: 5px; }
/* 文章内容 */
.article-content { line-height: 1.8; font-size: 16px; color: #333; margin-bottom: 30px; }
.article-content h1, .article-content h2, .article-content h3, .article-content h4, .article-content h5, .article-content h6 { margin: 20px 0 15px; color: #2c3e50; }
.article-content p { margin-bottom: 15px; }
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 15px auto;        /* 上下间距，水平居中 */
    display: block;           /* 使 auto 外边距生效 */
}
.article-content ul,
.article-content ol {
    margin: 15px 0;
    padding-left: 30px;
}
.article-content li {
    margin-bottom: 8px;
}
.article-content blockquote {
    border-left: 4px solid #0d6fb8;
    padding-left: 20px;
    margin: 20px 0;
    color: #666;
    font-style: italic;
}
.article-content code { background-color: #f8f9fa; padding: 2px 6px; border-radius: 3px; font-family: 'Courier New', monospace; font-size: 14px; }
.article-content pre { background-color: #f8f9fa; padding: 15px; border-radius: 6px; overflow-x: auto; margin: 15px 0; }
.article-content pre code { background: none; padding: 0; }
/* 文章标签 */
.article-tags { margin-bottom: 30px; padding: 20px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.tag-label { font-weight: bold; color: #666; margin-right: 10px; }
.tag-item { background-color: #f0f0f0; color: #666; padding: 4px 12px; border-radius: 15px; font-size: 12px; margin-right: 8px; margin-bottom: 8px; display: inline-block; transition: all 0.3s; }
.tag-item:hover { background-color: #0d6fb8; color: white; }
/* 文章操作 */
.article-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}
.action-btn { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border: 1px solid #ddd; background-color: white; color: #666; border-radius: 25px; cursor: pointer; transition: all 0.3s; font-size: 14px; }
.action-btn:hover { background-color: #0d6fb8; color: white; border-color: #0d6fb8; }
.action-btn.liked { background-color: #e74c3c; color: white; border-color: #e74c3c; }
.action-btn.favorited { background-color: #f39c12; color: white; border-color: #f39c12; }
/* 相关文章 */
.related-articles { margin-bottom: 30px; padding:0 30px; }
.related-articles h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #0d6fb8;
}
.related-list,
.related-list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 参考图：三列布局 */
    gap: 24px 20px;
}
.related-item { border-radius: 6px; overflow: hidden; background-color: #fff; transition: transform 0.3s, box-shadow 0.3s; }
.related-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.related-item a { display: block; }
.related-thumb {
    width: 100%;
    aspect-ratio: 605 / 375; /* 与站内统一缩略图比例一致 */
    height: auto;
    overflow: hidden;
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-content { padding:5px; }
.related-content h4 {
    font-size: 16px;
    font-weight: normal;
    line-height: 24px;
    height: 48px;               /* 两行固定高度 */
    color: #333;
    display: -webkit-box;      /* 两行省略 */
    line-clamp: 2;             /* 标准属性 */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-content h4:hover { color: #0d6fb8; }
.related-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    align-items: center;
}
.related-title-list li a {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    color: #333;
    text-decoration: none; /* 去除下划线 */
}
.related-title-list li a:hover { text-decoration: none; }
.related-title-list li:last-child a { border-bottom: none; }
.related-title-list .rank {
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
    font-size: 12px;
}
/* 序号配色：1/2/3 */
.related-title-list .rank.num-1 {
    background: #ff4d4f;
    color: #fff;
}
.related-title-list .rank.num-2 {
    background: #ffa940;
    color: #fff;
}
.related-title-list .rank.num-3 {
    background: #52c41a;
    color: #fff;
}
.related-title-list .view-count {
    color: #999;
    font-size: 12px;
}
.related-title-list .view-count .icon-eye {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") no-repeat center/contain;
    vertical-align: -2px;
}
/* 相关文章时间/浏览图标 */
.related-meta .date::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center/contain;
    vertical-align: -2px;
}
.related-meta .views::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") no-repeat center/contain;
    vertical-align: -2px;
}
/* 文章导航 */
.article-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.nav-item {
    border-radius: 6px;
    overflow: hidden;
    background-color: #f8f9fa;
    transition: transform 0.3s, box-shadow 0.3s;
}
.nav-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
}
.nav-thumb {
    width: 80px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.nav-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.nav-content {
    flex: 1;
}
.nav-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    display: block;
}
.nav-content h4 {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    margin: 0;
}
.nav-content h4:hover {
    color: #0d6fb8;
}
.next-article a {
    flex-direction: row-reverse;
}
/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        display: block; /* 允许整体显示 */
    }
    /* 默认隐藏侧边栏下所有模块 */
    .sidebar .sidebar-widget { display: none; }
    /* 仅显示 推荐文章 模块 */
    .sidebar .sidebar-widget.recommended-widget { display: block; }
    /* 推荐文章：左图右文横排 */
    .recommended-articles .recommended-item a { display: flex; gap: 12px; }
    .recommended-articles .rec-thumb { width: 120px; height: 80px; flex-shrink: 0; overflow: hidden; border-radius: 0; }
    .recommended-articles .rec-thumb img { width: 100%; height: 100%; object-fit: cover; }
    .recommended-articles .rec-content { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 0; }
    .recommended-articles .rec-content h4 { font-size: 16px; line-height: 22px; margin: 0 0 8px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .recommended-articles .rec-content h4 { line-clamp: 2; }
    .article-detail {
        padding: 20px;
    }
    
    .article-title {
        font-size: 24px;
    }
    
    /* 移动端：发布时间靠左，浏览数靠右 */
    .article-meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
    }
    .article-meta .views {
        margin-left: auto;
        text-align: right;
    }
    
    .article-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .related-list,
    .related-list-grid {
        grid-template-columns: 1fr; /* 移动端单列 */
    }

    /* 相关文章前三项：左图右文横向布局（与首页移动端一致） */
    .related-item a {
        display: flex;
        align-items: stretch;
        gap: 12px;
    }
    .related-thumb {
        width: 120px;
        height: 80px;
        border-radius: 0;
        overflow: hidden;
        flex-shrink: 0;
    }
    .related-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .related-content {
        flex: 1;
        padding: 0; /* 减少内边距，贴近首页移动端样式 */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .related-content h4 {
        font-size: 16px;
        line-height: 22px;
        height: auto;
        margin: 0 0 8px 0;
        line-clamp: 2; /* 标准属性 */
        -webkit-line-clamp: 2; /* 两行省略 */
    }
    .related-meta {
        margin-top: auto; /* 时间/浏览数底部对齐 */
        gap: 10px;
    }    
    .article-navigation {
        grid-template-columns: 1fr;
    }    
    .next-article a {
        flex-direction: row;
    }
}
@media (max-width: 480px) {
    .article-detail {
        padding: 15px;
    }    
    .article-title {
        font-size: 20px;
    }    
    .article-content {
        font-size: 14px;
    }    
    .nav-item a {
        padding: 12px;
    }    
    .nav-thumb {
        width: 60px;
        height: 45px;
    }
}
