/* ==================== 基础样式 ==================== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background: #fafafa;
}

/* ==================== 容器布局（修复靠右问题）==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==================== 头部导航 ==================== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 26px;
    font-weight: bold;
    text-decoration: none;
    color: #fff;
    letter-spacing: -0.5px;
}

/* ==================== 主内容区 ==================== */
main {
    padding: 30px 0;
    min-height: 60vh;
}

/* ==================== 英雄区域 ==================== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.hero h1 {
    margin: 0 0 15px 0;
    font-size: 2.5em;
    font-weight: 700;
}

.hero p {
    margin: 0;
    font-size: 1.2em;
    opacity: 0.95;
}

/* ==================== 分类导航 ==================== */
.category-nav {
    background: white;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.category-nav-title {
    margin: 0 0 20px 0;
    font-size: 1.5em;
    color: #333;
    text-align: center;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    border: 2px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.category-card.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.category-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.category-name {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.category-card.active .category-name {
    color: white;
}

.category-count {
    font-size: 0.85em;
    color: #666;
}

.category-card.active .category-count {
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== 文章卡片标签 ==================== */
.post-tag {
    margin-bottom: 10px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
}

/* ==================== 文章网格布局 ==================== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

/* ==================== 文章卡片 ==================== */
.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.post-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.post-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-content h2 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    line-height: 1.4;
}

.post-content h2 a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.post-content h2 a:hover {
    color: #667eea;
}

.post-date {
    color: #999;
    font-size: 0.85em;
    margin: 0 0 12px 0;
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
    margin: 0 0 15px 0;
    flex: 1;
}

.read-more {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.read-more:hover {
    color: #764ba2;
    transform: translateX(3px);
}

/* ==================== 详情页样式 ==================== */
.post-detail {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    max-width: 900px;
    margin: 0 auto;
}

.post-header {
    text-align: center;
    margin-bottom: 30px;
}

.post-header h1 {
    font-size: 2em;
    margin: 0 0 15px 0;
    color: #333;
    line-height: 1.4;
}

.post-meta {
    color: #999;
    font-size: 0.9em;
}

.post-image-container {
    margin: 30px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.post-detail-image {
    width: 100%;
    height: auto;
    display: block;
}

.post-body {
    font-size: 1.1em;
    line-height: 1.8;
    color: #444;
}

.content-text {
    margin: 30px 0;
}

.en-content {
    font-size: 1.2em;
    font-style: italic;
    color: #333;
    line-height: 1.8;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.post-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    color: #764ba2;
}

/* ==================== Google Ads 广告位 ==================== */
.ad-placeholder {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    margin: 30px 0;
    color: #666;
    font-size: 0.9em;
}

.ad-placeholder::before {
    content: "Advertisement";
    display: block;
    font-size: 0.75em;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.top-ad {
    min-height: 100px;
}

.bottom-ad {
    min-height: 250px;
}

/* 首页顶部横幅广告 */
.hero-banner-ad {
    max-width: 728px;
    margin: 20px auto 30px;
    text-align: center;
}

/* 侧边栏广告（用于未来扩展） */
.sidebar-ad {
    position: sticky;
    top: 100px;
    width: 300px;
}

/* ==================== 静态页面样式 ==================== */
.static-page {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.static-page h1 {
    margin-top: 0;
    color: #333;
}

.static-page h2 {
    color: #555;
    margin-top: 30px;
}

.static-page p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 15px;
}

.static-page a {
    color: #667eea;
    text-decoration: none;
}

.static-page a:hover {
    text-decoration: underline;
}

/* ==================== Footer ==================== */
footer {
    background: #2d3748;
    color: #e2e8f0;
    padding: 40px 20px;
    margin-top: 60px;
    text-align: center;
}

footer a {
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

/* ==================== 分页导航 ==================== */
.pagination {
    margin: 40px 0;
    padding: 20px 0;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pagination-btn.disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
}

.pagination-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.pagination-info {
    font-size: 0.95em;
    color: #666;
    font-weight: 500;
}

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .hero {
        padding: 40px 15px;
    }

    .hero h1 {
        font-size: 1.8em;
    }

    .hero p {
        font-size: 1em;
    }

    /* 分类导航移动端优化 */
    .category-nav {
        padding: 20px 15px;
    }

    .category-nav-title {
        font-size: 1.3em;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .category-card {
        padding: 15px 10px;
    }

    .category-icon {
        font-size: 2em;
    }

    .category-name {
        font-size: 0.9em;
    }

    /* 文章网格 */
    .post-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .post-image {
        height: 200px;
    }

    .post-detail {
        padding: 25px 20px;
    }

    .post-header h1 {
        font-size: 1.5em;
    }

    .en-content {
        font-size: 1.1em;
        padding: 15px;
    }

    /* 分页移动端优化 */
    .pagination {
        margin: 30px 0;
        padding: 15px 0;
    }

    .pagination-wrapper {
        gap: 10px;
    }

    .pagination-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .pagination-info {
        font-size: 0.85em;
    }

    /* 返回顶部按钮移动端 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    .hero-banner-ad {
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    /* 分类卡片更小屏幕优化 */
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-card {
        padding: 12px 8px;
    }

    .category-icon {
        font-size: 1.8em;
        margin-bottom: 5px;
    }

    .category-name {
        font-size: 0.85em;
    }

    /* 文章卡片 */
    .post-card {
        border-radius: 8px;
    }

    .post-content {
        padding: 15px;
    }

    .post-content h2 {
        font-size: 1.1em;
    }

    .post-excerpt {
        font-size: 0.95em;
    }

    .read-more {
        font-size: 0.9em;
    }

    /* 英雄区域 */
    .hero {
        padding: 30px 15px;
        margin-bottom: 20px;
    }

    .hero h1 {
        font-size: 1.5em;
    }

    .hero p {
        font-size: 0.95em;
    }

    /* 分页更紧凑 */
    .pagination-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .pagination-btn {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .category-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .category-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 15px;
    }

    .category-icon {
        font-size: 1.5em;
        margin-bottom: 0;
    }

    .category-name {
        font-size: 0.95em;
    }
}

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

.post-card {
    animation: fadeIn 0.5s ease-out;
}

/* ==================== 可访问性优化 ==================== */
a:focus,
button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ==================== 打印样式 ==================== */
@media print {
    header,
    footer,
    .ad-placeholder,
    .read-more {
        display: none;
    }

    .post-detail {
        box-shadow: none;
    }
}
