/* iframe自适应样式 */
#iframeContainer {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}


#contentFrame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border: none;
    background: #fff;
    display: block;
    box-sizing: border-box;
    overflow: auto;
}

@media (max-width: 768px) {
    #iframeContainer {
        max-width: 100vw;
        padding: 0;
    }
}
/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c7a2c;
    --secondary-color: #4a9e4a;
    --accent-color: #7cb342;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --background-light: #f8fffe;
    --background-white: #ffffff;
    --border-color: #e8f5e8;
    --shadow-light: 0 2px 15px rgba(44, 122, 44, 0.1);
    --shadow-medium: 0 5px 30px rgba(44, 122, 44, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --main-padding-x: 32px;
    --card-margin-x: 1.2rem;
    --section-title-size: 2.2rem;
    --article-title-size: 1.15rem;
    --category-title-size: 1.1rem;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    height: 100vh;
    overflow-x: hidden;
}

/* 导航栏 */
.navbar {
    background: var(--background-white);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-light);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

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

}

.nav-logo h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}


.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--accent-color);
    color: white;
}

.nav-search {
    display: flex;
    align-items: center;
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    border: 2px solid var(--border-color);
}

.nav-search input {
    border: none;
    background: transparent;
    padding: 0.5rem;
    outline: none;
    width: 200px;
}

.nav-search button {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-search button:hover {
    background: var(--secondary-color);
}

/* 主内容区 */
.main-content {
    margin-top: 72px;
}

/* 首页横幅 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 6rem 0 4rem 0;
    /* 上边距加大，底部不变 */
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 分类部分 */
.categories-section,
.articles-section {
    padding: 1rem 0 1rem 0;
    /* 上方2rem，下方4rem */
}

.section-title {
    font-size: var(--section-title-size);
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.category-card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 1rem 1rem;
    margin-left: var(--card-margin-x);
    margin-right: var(--card-margin-x);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid var(--border-color);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: var(--accent-color);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.category-title {
    font-size: var(--category-title-size);
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.category-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 文章部分 */
.articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}


.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.articles-grid.list-view {
    grid-template-columns: 1fr;
}

.article-card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 1.2rem 1rem;
    margin-left: var(--card-margin-x);
    margin-right: var(--card-margin-x);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
    border-left: 4px solid transparent;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-left-color: var(--accent-color);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.article-category {
    background: var(--accent-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.reading-time {
    color: var(--text-light);
    font-size: 0.8rem;
}

.article-title {
    font-size: var(--article-title-size);
    color: var(--text-dark);
    margin-bottom: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

.article-preview {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 加载更多按钮 */
.load-more {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.load-more-btn,
.simple-load-more {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 400;
    box-shadow: none;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.load-more-btn:hover,
.simple-load-more:hover {
    background: #e9ecef;
    color: #222;
    border: 1px solid #cccccc;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--background-white);
    margin: auto;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.2rem; /* 缩小header高度和左右间距 */
    border-bottom: 1px solid var(--border-color);
    background: var(--background-light);
}

.modal-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: #ffa031;
    border: none;
    font-size: 1.5rem; /* 缩小按钮 */
    cursor: pointer;
    color: #fff; /* 白色图标 */
    transition: var(--transition);
    width: 2.2rem;
    height: 2.2rem;
    line-height: 2.2rem;
    text-align: center;
    padding: 0;
    border-radius: 50%;
}

.close-btn:hover {
    background: #ffb85c;
    color: #fff;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background: rgb(255, 250, 232);
}

.article-content {
    line-height: 1.8;
    font-size: 1rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0.7rem 1.2rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
}

.btn-primary,
.btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-secondary {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* 加载指示器 */
.loading-spinner {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    #contentFrame {
        position: fixed;
        /* 手机端打开空白，由于iframe覆盖内容导致 */
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        border: none;
        background: #fff;
    }

    .nav-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .hero-section {
        padding: 9rem 0 2.5rem 0;
        /* 移动端上边距更大，底部更紧凑 */
    }

    .nav-search {
        width: 100%;
        flex-direction: row !important;
        display: flex;
        align-items: center;
    }

    .nav-search input {
        width: 100%;
    }

    .nav-search button {
        writing-mode: horizontal-tb !important;
        -webkit-writing-mode: horizontal-tb !important;
        letter-spacing: 0.05em;
        font-size: 1rem;
        margin-left: 0.5rem;
        padding: 0.5rem 1.2rem;
    }

    .nav-menu {
        gap: 1rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-stats {
        flex-direction: row !important;
        justify-content: center;
        gap: 1.2rem;
    }

    .stat-item {
        min-width: 90px;
        padding: 0 4px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .category-card {
        padding: 1rem 0.5rem;
        font-size: 0.95rem;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .category-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .category-title {
        font-size: 1rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .articles-header {
        flex-direction: column;
        gap: 1rem;
    }

    .modal-content {
        width: 98%;
        margin: auto;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        overflow-y: auto;
    }
    .modal-header {
        padding: 0.5rem 0.7rem;
    }
    .close-btn {
        font-size: 1.2rem;
        width: 1.7rem;
        height: 1.7rem;
        line-height: 1.7rem;
    }

    .main-content {
        margin-top: 120px;
    }

    .nav-search button {
        writing-mode: inherit;
        white-space: nowrap;
        min-width: auto;
        padding: 0.5rem 1rem;
    }

    .hero-stats {
        flex-direction: row;
        justify-content: center;
        gap: 1.2rem;
        flex-wrap: nowrap;
    }

    .category-card {
        padding: 0.7rem 0.3rem;
    }
}