* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body.dark-mode {
    background: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .navbar {
    background: #16213e;
}

body.dark-mode .news-card {
    background: #0f3460;
    color: #e0e0e0;
}

body.dark-mode .hero {
    background: linear-gradient(135deg, #0f3460, #16213e);
}

body.dark-mode .stats-card {
    background: #16213e;
    color: #e0e0e0;
}

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

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.3s;
}

.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #e74c3c;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#theme-toggle, .hamburger {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
}

#theme-toggle:hover, .hamburger:hover {
    background: rgba(0,0,0,0.1);
}

.hamburger {
    display: none;
}

.hero {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 3rem 1rem;
    text-align: center;
    border-radius: 0 0 30px 30px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
}

.search-bar input, .search-bar select {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
    color: #333;
    outline: none;
}

.search-bar input {
    flex: 2;
    min-width: 200px;
}

.search-bar select {
    flex: 1;
    min-width: 120px;
}

#search-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: #e74c3c;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#search-btn:hover {
    background: #c0392b;
}

.template-switcher {
    text-align: center;
    margin: 1rem 0;
}

.tmpl-btn {
    padding: 0.5rem 1.5rem;
    margin: 0 0.25rem;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: transparent;
    color: #667eea;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.tmpl-btn.active, .tmpl-btn:hover {
    background: #667eea;
    color: #fff;
}

.stats-heatmap {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.stats-card {
    background: #fff;
    padding: 1rem 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.news-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

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

.card-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
}

.card-content {
    padding: 1rem;
}

.card-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.card-content p {
    color: #666;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.9rem;
}

.category {
    background: #667eea;
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
}

.tag {
    background: #e0e0e0;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.rating, .heat {
    color: #f39c12;
}

.share-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.9rem;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 暗色模式覆盖 */
body.dark-mode .search-bar input, body.dark-mode .search-bar select {
    background: #333;
    color: #e0e0e0;
}

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

body.dark-mode .tag {
    background: #444;
    color: #e0e0e0;
}

/* 管理后台样式 */
.admin-main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.login-form {
    max-width: 400px;
    margin: 4rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.login-form button {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.admin-panel {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-section {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 10px;
}

.admin-section h3 {
    margin-bottom: 1rem;
}

.admin-section input, .admin-section textarea {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.admin-section button {
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 0.5rem 0;
}

.admin-section table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-section th, .admin-section td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
}

.success {
    color: #27ae60;
    background: #d4edda;
    padding: 0.5rem;
    border-radius: 5px;
}

.error {
    color: #e74c3c;
    background: #f8d7da;
    padding: 0.5rem;
    border-radius: 5px;
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        background: #fff;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    .nav-links.active {
        display: flex;
    }
    .hamburger {
        display: block;
    }
    .hero h1 {
        font-size: 1.5rem;
    }
    .search-bar {
        flex-direction: column;
    }
    .search-bar input, .search-bar select {
        width: 100%;
    }
    .news-grid {
        grid-template-columns: 1fr;
        padding: 0.5rem;
    }
    .stats-heatmap {
        flex-direction: column;
        align-items: center;
    }
}