/* style.css - 修复版（解决了表格样式被限制在手机端的问题） */

/* ====================== 变量定义 ====================== */
:root {
    --primary:     #e63946;
    --primary-dark:#d00000;
    --accent:      #457b9d;
    --text:        #2b2d42;
    --gray:        #5e5e5e;
    --light-bg:    #f8f9fa;
    --white:       #ffffff;
    --shadow-sm:   0 4px 12px rgba(0,0,0,0.08);
    --shadow-md:   0 8px 24px rgba(0,0,0,0.10);
    --radius:      12px;
    --transition:  all 0.28s ease;
    --font-base:   'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ====================== 全局重置 ====================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-base);
    font-size: 16px;
    line-height: 1.68;
    color: var(--text);
    background: var(--light-bg);
}

/* ====================== 容器 ====================== */
.container {
    width: 90%;
    max-width: 1240px;
    margin: 0 auto;
}

/* ====================== 头部导航 ====================== */
.header {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav {
    display: flex;
    justify-content: center;
    gap: 3.5rem;
    padding: 1.1rem 0;
}

.nav-btn {
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.nav-btn:hover,
.nav-btn.active {
    color: var(--primary);
}

/* ====================== Banner ====================== */
.banner-wrap {
    max-width: 1140px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.banner-img {
    width: 100%;
    max-width: 1100px;
    height: auto;
    display: block;
    margin: 0 auto 2rem auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.banner-img:last-child {
    margin-bottom: 0;
}

.banner-img:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0,0,0,0.14);
}

/* ====================== 页面标题 ====================== */
.page-title {
    text-align: center;
    font-size: 2.1rem;
    color: var(--primary);
    margin: 2.8rem 0 3rem;
    position: relative;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* ====================== 文章列表页组件 ====================== */

/* 热门推荐 */
.hot-recommend {
    margin: 2rem 0 3rem;
    background: #fff;
    padding: 1.8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.section-subtitle {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.section-subtitle::after {
    content: '';
    width: 60px;
    height: 3px;
    background: var(--primary);
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.hot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.4rem;
}

.hot-card {
    padding: 1.4rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #eee;
    position: relative;
    transition: all 0.3s;
}

.hot-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.hot-tag {
    position: absolute;
    top: -10px;
    right: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.82rem;
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-weight: bold;
}

.hot1 { border-color: #e63946; }
.hot2 { border-color: #d00000; }
.hot3 { border-color: #c53030; }
.hot4 { border-color: #e67e22; }

.hot-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.7rem;
}

.hot-card h3 a {
    color: var(--text);
    text-decoration: none;
}

.hot-card .meta {
    font-size: 0.86rem;
    color: #888;
}

/* 订阅公众号 */
.subscribe-box {
    background: #fffef9;
    border: 1px solid #ffebee;
    padding: 2.2rem 1.8rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 2.5rem 0 3.5rem;
    box-shadow: var(--shadow-sm);
}

.subscribe-box h3 {
    font-size: 1.45rem;
    color: var(--primary);
    margin-bottom: 1.3rem;
}

.subscribe-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.2rem;
    flex-wrap: wrap;
}

.subscribe-qr {
    width: 170px;
    height: 170px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.subscribe-text p {
    font-size: 1.08rem;
    margin: 0.7rem 0;
    color: #555;
}

/* 相关搜索 */
.related-search {
    margin: 2rem 0 3.5rem;
    text-align: center;
}

.related-search h3 {
    font-size: 1.35rem;
    color: #555;
    margin-bottom: 1.2rem;
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    justify-content: center;
}

.search-tags a {
    background: #f5f5f5;
    padding: 0.55rem 1.1rem;
    border-radius: 20px;
    font-size: 0.96rem;
    color: var(--primary);
    border: 1px solid #ddd;
    text-decoration: none;
    transition: all 0.3s;
}

.search-tags a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 文章列表 */
.all-articles .articles-list {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    max-width: 920px;
    margin: 0 auto;
}

.article-item {
    background: white;
    padding: 1.8rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--primary);
    transition: all 0.3s;
}

.article-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.article-item h3 {
    font-size: 1.32rem;
    margin-bottom: 0.8rem;
}

.article-item h3 a {
    color: var(--text);
    text-decoration: none;
}

.article-item p {
    color: #555;
    margin-bottom: 0.7rem;
}

.article-item .meta {
    font-size: 0.9rem;
    color: #888;
    margin-top: 0.8rem;
}

/* 文章网格 (首页) */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.8rem;
    margin-bottom: 4rem;
}

.article-card {
    background: var(--white);
    padding: 1.8rem 1.6rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid #eee;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.article-card h2 {
    font-size: 1.24rem;
    line-height: 1.45;
    margin-bottom: 0.9rem;
}

.article-card h2 a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

.article-card h2 a:hover {
    color: var(--primary);
}

.article-card p {
    color: #4a4a4a;
    font-size: 0.97rem;
}

/* ====================== 文章详情页专用样式 ====================== */
.article-content {
    background: #fff;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    font-size: 1.08rem;
    line-height: 1.85;
    color: #333;
}

.article-content h2 { 
    color: #2b2d42; 
    margin: 2rem 0 1.2rem; 
    border-left: 5px solid var(--primary); 
    padding-left: 15px; 
    font-size: 1.4rem;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 0 8px 8px 0;
}

.article-content h3 {
    font-size: 1.15rem;
    color: var(--primary-dark);
    margin: 1.5rem 0 0.8rem;
    font-weight: bold;
}

.article-content p { margin-bottom: 1.4rem; text-align: justify; }
.article-content ul { margin-bottom: 1.5rem; padding-left: 1.5rem; color: #555; }
.article-content li { margin-bottom: 0.5rem; }
.article-content strong { color: var(--primary); }
.article-content a { color: var(--primary); text-decoration: underline; font-weight: 500; }

.article-content blockquote {
    background: #fff4f4;
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: #666;
    font-style: italic;
}

.article-meta { 
    color: #888; 
    font-size: 0.9rem; 
    text-align: center; 
    margin-bottom: 2.5rem; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 1.5rem; 
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* 上下篇导航 */
.prev-next { display: flex; justify-content: space-between; margin: 2rem 0; flex-wrap: wrap; gap: 1rem; }

.prev-next a { 
    flex: 1;
    min-width: 280px;
    color: var(--gray); 
    text-decoration: none; 
    transition: var(--transition); 
    background: #fff; 
    padding: 15px 20px; 
    border-radius: 8px; 
    box-shadow: var(--shadow-sm); 
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #eee;
}

.prev-next a:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.prev-next span { font-size: 0.85rem; color: #999; margin-bottom: 4px; display: block; }
.prev-next strong { font-size: 1rem; color: #333; display: block; }
.prev-next a:hover strong { color: var(--primary); }

/* ====================== 表格样式 (修复版：已移出 Media Query) ====================== */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.comparison-table th, 
.comparison-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.comparison-table th {
    background-color: var(--primary);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

.comparison-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.comparison-table tr:hover {
    background-color: #fff0f0;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2rem;
}

.stars { color: #f1c40f; letter-spacing: 2px; }

/* ====================== 侧边栏与浮动元素 ====================== */
.sidebar {
    position: fixed;
    right: 22px;
    top: 48%;
    transform: translateY(-50%);
    z-index: 998;
}

.sidebar-box {
    background: #fffef9;
    padding: 1.6rem 1.2rem;
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    text-align: center;
    width: 142px;
    border: 1px solid #ffebee;
}

.wx-qr {
    width: 108px;
    height: 108px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 0.8rem;
}

.tel {
    font-size: 0.84rem;
    font-weight: 700;
    color: #d00000;
    background: #fff0f0;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    display: inline-block;
    margin: 0.8rem 0 0.6rem;
}

.tip {
    font-size: 0.88rem;
    color: #d00000;
    background: #ffebee;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    border: 1px dashed #ffcdd2;
    display: inline-block;
    margin-top: 0.4rem;
}

.float-wechat {
    position: fixed;
    left: 20px;
    bottom: 110px;
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(230,57,70,0.35);
    cursor: pointer;
    z-index: 997;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sway 5s ease-in-out infinite;
}

.float-wechat:hover {
    transform: scale(1.14);
    animation-play-state: paused;
}

.float-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

@keyframes sway {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25%  { transform: translateX(7px) rotate(4deg); }
    50%  { transform: translateX(0) rotate(0deg); }
    75%  { transform: translateX(-7px) rotate(-4deg); }
}

/* ====================== 模态框 ====================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.78);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal-img {
    max-width: 86%;
    max-height: 86%;
    border-radius: 14px;
    box-shadow: 0 0 60px rgba(255,255,255,0.25);
}

.modal-close {
    position: absolute;
    top: 30px;
    right: 35px;
    font-size: 48px;
    color: white;
    cursor: pointer;
}

/* ====================== 底部 ====================== */
.footer {
    background: #111;
    color: #ccc;
    padding: 3.5rem 0 2rem;
    font-size: 0.94rem;
    text-align: center;
}

.site-map {
    margin-bottom: 1.8rem;
    line-height: 2.1;
}

.site-map strong {
    color: #eee;
    margin-right: 0.6rem;
}

.site-map a {
    color: #aaa;
    margin: 0 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.site-map a:hover {
    color: var(--primary);
}

.copyright a {
    color: #bbb;
    text-decoration: none;
}

.copyright a:hover {
    color: white;
}

.mobile-contact {
    margin-top: 2rem;
}

.mobile-wx {
    width: 170px;
    height: 170px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.mobile-tel {
    font-size: 1.18rem;
    color: var(--primary);
    font-weight: 600;
}

/* ====================== 响应式适配 ====================== */
.desktop-only { display: block; }
.mobile-only  { display: none; }

@media (max-width: 1200px) {
    .banner-img { max-width: 100%; }
    .hot-grid { grid-template-columns: 1fr 1fr; }
}

/* ====================== 移动端深度适配 (iPhone/Android) ====================== */
@media (max-width: 768px) {
    /* 1. 导航栏调整 */
    .nav { 
        gap: 1.5rem; 
        padding: 0.8rem 0;
    }
    .nav-btn { font-size: 1rem; }

    /* 2. 页面大标题优化（防止文字过大换行难看） */
    .page-title { 
        font-size: 1.5rem !important; /* 强制缩小标题 */
        margin: 2rem 0 1.5rem; 
        line-height: 1.4;
    }

    /* 3. 隐藏电脑端悬浮元素 */
    .sidebar, .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    /* 4. 文章页核心内容适配 */
    .article-content { 
        padding: 1.2rem !important; /* 减小内边距，增加阅读空间 */
        font-size: 1rem;            /* 调整正文字号 */
        line-height: 1.75;
    }

    /* 5. 强制图片自适应（关键！防止图片撑破屏幕） */
    .article-content img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 8px;
    }

    /* 6. 文章元数据（时间、浏览量）垂直排列 */
    .article-meta { 
        flex-direction: column; 
        gap: 0.5rem; 
        font-size: 0.85rem;
    }

    /* 7. 上下篇导航按钮适配 */
    .prev-next { gap: 1rem; }
    .prev-next a { 
        min-width: 100%; /* 按钮占满一行 */
        padding: 12px;
    }
    
    /* 8. 热门推荐网格变单列 */
    .hot-grid { grid-template-columns: 1fr; }
    
    /* 9. 订阅框适配 */
    .subscribe-content { flex-direction: column; gap: 1rem; }
    .subscribe-qr { width: 150px; height: 150px; }

    /* 10. 浮动微信图标位置调整 */
    .float-wechat { 
        bottom: 80px; 
        left: 15px; 
        width: 55px; 
        height: 55px;
    }
    .float-icon { width: 32px; height: 32px; }
    
    /* 11. 确保表格可以横向滑动 */
    .table-wrapper {
        width: 100%;
        overflow-x: scroll;
        margin-bottom: 1.5rem;
    }
    .comparison-table { min-width: 500px; /* 强制表格最小宽度，触发滑动 */ }
}
