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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --light-gray: #ecf0f1;
    --dark-gray: #34495e;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--dark-gray);
    background-color: #f8f9fa;
    line-height: 1.6;
}

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

/* ============ 导航栏 ============ */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a252f 100%);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: white;
    letter-spacing: 1px;
}

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

.nav-links a {
    color: #bdc3c7;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 4px;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background-color: rgba(52, 152, 219, 0.2);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-display {
    color: #bdc3c7;
    font-weight: 500;
}

.btn-login,
.btn-register,
.btn-logout {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

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

.btn-login:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-register {
    background-color: var(--success-color);
    color: white;
    margin-left: 8px;
}

.btn-register:hover {
    background-color: #229954;
    transform: translateY(-2px);
}

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

.btn-logout:hover {
    background-color: #c0392b;
}

/* ============ 主容器布局 ============ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.content-area {
    flex: 1;
}

.sidebar-ads {
    position: sticky;
    top: 80px;
    height: fit-content;
}

/* ============ 模态框 ============ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 弹窗广告模态框内容居中 */
.popup-ad-modal {
    margin: auto;
    position: relative;
    z-index: 1001;
}

.popup-ad-content {
    text-align: center !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--primary-color);
}

/* ============ 认证表单 ============ */
.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--light-gray);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #aaa;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

/* ============ 分类板块 ============ */
.section-category {
    display: none;
}

.section-category.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--secondary-color);
}

.section-header h2 {
    font-size: 28px;
    color: var(--primary-color);
}

.section-icon {
    font-size: 32px;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: var(--transition);
    cursor: pointer;
    display: grid;
    grid-template-columns: 120px 1fr;
    height: 120px;
}

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

.news-image {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-body {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.news-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-excerpt {
    font-size: 13px;
    color: #7f8c8d;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #95a5a6;
}

.news-date {
    color: var(--secondary-color);
    font-weight: 500;
}

.news-badge {
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ============ 文章详情模态框 ============ */
.article-modal {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
}

.article-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.article-header h1 {
    font-size: 28px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.article-content {
    padding: 40px;
    font-size: 16px;
    line-height: 1.8;
    color: var(--dark-gray);
}

.article-content p {
    margin-bottom: 15px;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-top: 1px solid var(--light-gray);
    background-color: #f8f9fa;
}

.btn-secondary {
    padding: 10px 20px;
    background-color: var(--light-gray);
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

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

.points-display {
    color: var(--success-color);
    font-weight: 600;
}

/* ============ 页脚 ============ */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 60px;
}

.footer p {
    margin: 8px 0;
    font-size: 14px;
}

/* ============ 响应式设计 ============ */
@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
        margin-left: 1rem;
    }

    .nav-links a {
        padding: 6px 10px;
        font-size: 14px;
    }

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

    .section-header h2 {
        font-size: 22px;
    }

    .article-header {
        padding: 20px;
    }

    .article-header h1 {
        font-size: 22px;
    }

    .article-content,
    .article-footer {
        padding: 20px;
    }

    .banner-container {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        flex-direction: column;
        gap: 10px;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-left: 0;
    }

    .user-section {
        width: 100%;
        justify-content: center;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============ 广告栏 ============ */
.ad-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.ad-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--secondary-color);
}

.ads-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ad-item {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    transition: var(--transition);
    height: 150px;
}

.ad-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.ad-item-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding: 20px;
}

/* ============ 导航标签 ============ */
.nav-tab {
    cursor: pointer;
}

.nav-tab.active {
    color: white;
    background-color: rgba(52, 152, 219, 0.2);
}

/* ============ 打印样式 ============ */
@media print {
    .navbar,
    .banner,
    .footer,
    .modal,
    .sidebar-ads {
        display: none;
    }

    body {
        background-color: white;
    }

    .news-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
