/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f9f4;
    color: #1a1a2e;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

body.dark-mode {
    background-color: #0f0f1a;
    color: #e0e0e0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body.dark-mode .navbar {
    background: linear-gradient(135deg, #1a3a2a, #0f2a1a);
}

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

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links li a {
    color: #fff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background 0.3s;
    font-weight: 500;
}

.nav-links li a:hover, .nav-links li a.active {
    background: rgba(255,255,255,0.2);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.theme-toggle button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s;
}

.theme-toggle button:hover {
    background: rgba(255,255,255,0.2);
}

/* 搜索区域 */
.search-section {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    padding: 60px 0;
    text-align: center;
}

body.dark-mode .search-section {
    background: linear-gradient(135deg, #1a3a2a, #0f2a1a);
}

.search-section h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #1a5e20;
}

body.dark-mode .search-section h1 {
    color: #a5d6a7;
}

.search-section p {
    font-size: 1.1rem;
    color: #2e7d32;
    margin-bottom: 25px;
}

body.dark-mode .search-section p {
    color: #81c784;
}

.search-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar input {
    padding: 12px 20px;
    border: 2px solid #2ecc71;
    border-radius: 30px;
    width: 350px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: #1e8449;
}

.search-bar button {
    padding: 12px 25px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s, transform 0.2s;
}

.search-bar button:hover {
    background: #1e8449;
    transform: scale(1.05);
}

.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filters select {
    padding: 10px 15px;
    border: 2px solid #2ecc71;
    border-radius: 20px;
    background: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

body.dark-mode .filters select {
    background: #1a3a2a;
    color: #e0e0e0;
    border-color: #4caf50;
}

/* 文章网格 */
.articles-grid-section {
    padding: 50px 0;
}

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

.article-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

body.dark-mode .article-card {
    background: #1a1a2e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
}

.card-img {
    height: 200px;
    background-size: cover;
    background-position: center;
}

.card-body {
    padding: 20px;
}

.card-category {
    display: inline-block;
    background: #2ecc71;
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.card-body h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.card-body h3 a {
    color: inherit;
    text-decoration: none;
}

.card-body h3 a:hover {
    color: #2ecc71;
}

.card-body p {
    color: #666;
    margin-bottom: 15px;
}

body.dark-mode .card-body p {
    color: #aaa;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.rating i {
    color: #f1c40f;
    margin-right: 2px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-buttons a {
    color: #2ecc71;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.share-buttons a:hover {
    color: #1e8449;
}

/* 热力图 */
.heatmap-section {
    padding: 50px 0;
    background: #e8f5e9;
}

body.dark-mode .heatmap-section {
    background: #1a3a2a;
}

.heatmap-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #1a5e20;
}

body.dark-mode .heatmap-section h2 {
    color: #a5d6a7;
}

.heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.heatmap-item {
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #fff;
    transition: transform 0.2s;
}

.heatmap-item:hover {
    transform: scale(1.05);
}

/* 数据统计 */
.stats-section {
    padding: 50px 0;
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #1a5e20;
}

body.dark-mode .stats-section h2 {
    color: #a5d6a7;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

body.dark-mode .stat-card {
    background: #1a1a2e;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5rem;
    color: #2ecc71;
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 2rem;
    font-weight: bold;
    color: #1a5e20;
}

body.dark-mode .stat-card p {
    color: #a5d6a7;
}

/* 页脚 */
.footer {
    background: #1a5e20;
    color: #fff;
    padding: 30px 0;
    text-align: center;
}

body.dark-mode .footer {
    background: #0f2a1a;
}

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

.footer-links a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

/* 管理后台 */
.admin-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.admin-stats .stat-card {
    padding: 20px;
}

.admin-form {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

body.dark-mode .admin-form {
    background: #1a1a2e;
}

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: 500;
}

.admin-form input, .admin-form textarea, .admin-form select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

body.dark-mode .admin-form input, body.dark-mode .admin-form textarea, body.dark-mode .admin-form select {
    background: #2a2a3e;
    color: #e0e0e0;
    border-color: #4a4a5e;
}

.admin-form button {
    padding: 12px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.admin-form button:hover {
    background: #1e8449;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

body.dark-mode .admin-table {
    background: #1a1a2e;
}

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

body.dark-mode .admin-table th, body.dark-mode .admin-table td {
    border-color: #2a2a3e;
}

.admin-table th {
    background: #2ecc71;
    color: #fff;
}

.admin-table tr:hover {
    background: #f0faf0;
}

body.dark-mode .admin-table tr:hover {
    background: #2a3a2a;
}

.admin-table a {
    color: #e74c3c;
    text-decoration: none;
}

.error {
    color: #e74c3c;
    background: #fde8e8;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.success {
    color: #27ae60;
    background: #e8f5e9;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
}

.login-form {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.dark-mode .login-form {
    background: #1a1a2e;
}

.login-form h2 {
    text-align: center;
    color: #1a5e20;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.login-form input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

.login-form button {
    padding: 12px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.login-form button:hover {
    background: #1e8449;
}

.login-form a {
    text-align: center;
    color: #2ecc71;
    text-decoration: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        gap: 10px;
    }

    .nav-links.active {
        display: flex;
    }

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

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

    .search-section h1 {
        font-size: 1.8rem;
    }

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}