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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}

.header-content {
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    min-height: 600px;
}

/* 文章卡片样式 - 增强版 */
.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    max-height: 400px;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 图片容器 */
.article-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-image {
    transform: scale(1.05);
}

/* 图片加载状态 */
.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #667eea;
    font-size: 2rem;
}

.image-loading i {
    animation: spin 1s linear infinite;
}

.image-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
}

.image-error i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* 图片占位符 */
.image-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #ccc;
}

.image-placeholder i {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* 标签覆盖层 */
.image-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

/* 收藏按钮 */
.favorite-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.favorite-btn:hover {
    background: white;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #e74c3c;
}

/* 文章内容区域 */
.article-content-area {
    padding: 1.5rem;
}

.article-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-excerpt {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* 加载更多按钮 */
.btn-load-more {
    display: block;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-load-more:hover {
    background: #5a6fd8;
}

.btn-load-more:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 搜索框 */
.search-box {
    margin-bottom: 2rem;
    text-align: center;
}

.search-input {
    padding: 0.8rem 1.5rem;
    border: 2px solid #ddd;
    border-radius: 25px;
    width: 300px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 图片懒加载动画 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .search-input {
        width: 250px;
    }
    
    .article-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .article-image-container {
        height: 180px;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    .article-excerpt {
        font-size: 0.85rem;
    }
}

/* 暗黑模式 */
.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.dark-mode .article-card {
    background: #2d2d2d;
}

.dark-mode .article-title {
    color: #ffffff;
}

dark-mode .article-excerpt {
    color: #b0b0b0;
}

.dark-mode .article-image-container {
    background: #1a1a1a;
}

.dark-mode .image-placeholder {
    color: #555;
}

.dark-mode .image-error {
    color: #777;
}

.dark-mode header {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

/* 加载动画 */
.loading-more {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading-more i {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none;
    transition: all 0.3s ease;
    z-index: 100;
}

.back-to-top:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* 暗黑模式切换按钮 */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.dark-mode-toggle:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}
