/* 博客页面特定样式 */
.blog-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 100px 0 80px;
    text-align: center;
}

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

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

.blog-search {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.blog-search input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.blog-search .btn {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    padding: 0 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 40px;
    cursor: pointer;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    margin: 60px 0;
}

/* 文章筛选 */
.blog-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 文章网格 */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box; /* 确保不超出容器 */
}

.article-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.article-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background-color: #f1f3f5; /* 图片加载失败时显示背景色 */
}

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

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

.article-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover .article-overlay {
    opacity: 1;
}

.article-content {
    padding: 25px;
}

.article-category {
    display: inline-block;
    padding: 4px 12px;
    background: #f8f9fa;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.article-category.tutorial { background: #e3f2fd; color: #1976d2; }
.article-category.news { background: #f3e5f5; color: #7b1fa2; }
.article-category.case { background: #e8f5e8; color: #388e3c; }
.article-category.tech { background: #fff3e0; color: #f57c00; }

.article-content h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
    line-height: 1.4;
}

.article-content h3 a {
    color: inherit;
    text-decoration: none;
}

.article-content h3 a:hover {
    color: #667eea;
}

.article-excerpt {
    color: #6c757d;
    margin-bottom: 15px;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #868e96;
}

.article-meta i {
    margin-right: 5px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.article-tags .tag {
    padding: 2px 8px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #495057;
}

/* 侧边栏 */
.blog-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-widget {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.sidebar-widget h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #495057;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* 热门文章 */
.popular-article {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.popular-article:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.popular-article-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.popular-article-content h4 {
    margin-bottom: 5px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.popular-article-content h4 a {
    color: inherit;
    text-decoration: none;
}

.popular-article-content h4 a:hover {
    color: #667eea;
}

.popular-article-meta {
    font-size: 0.8rem;
    color: #868e96;
    display: flex;
    gap: 10px;
}

/* 分类列表 */
.categories-list {
    list-style: none;
    padding: 0;
}

.categories-list li {
    margin-bottom: 10px;
}

.categories-list a {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
}

.categories-list a:hover {
    background: #667eea;
    color: white;
}

.categories-list span {
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud .tag {
    padding: 5px 12px;
    background: #f8f9fa;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tag-cloud .tag:hover {
    background: #667eea;
    color: white;
}

/* 无文章状态 */
.no-articles {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
    z-index: 1;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.no-articles i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.no-articles h3 {
    color: #6c757d;
    margin-bottom: 10px;
}

.no-articles p {
    color: #868e96;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-hero h1 {
        font-size: 2.2rem;
    }
    
    .blog-filters {
        justify-content: center;
    }

    .blog-sidebar {
        position: static; /* 移动端取消粘性定位 */
        top: auto;
    }
}

@media (max-width: 480px) {
    .blog-hero {
        padding: 80px 0 60px;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .sidebar-widget {
        padding: 20px;
    }
    
    .blog-search input {
        padding: 12px 15px;
    }
    
    .blog-search .btn {
        padding: 0 20px;
    }
}