/**
 * Waterfall 瀑布流布局 CSS
 *
 * @package GoodBase
 * @since 1.0.0
 */

/* 注意：分类页面的显示/隐藏由各自的模板文件单独控制 */
/* 图片分类页：category-image.php */
/* 文章分类页：category-article.php */
/* 视频分类页：category-video.php */
/* 音频分类页：category-audio.php */

/* 筛选隐藏的卡片 - 通用样式 */
.waterfall-item.filtered-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* 筛选显示的卡片 - 通用样式 */
.waterfall-item.filtered-visible {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 筛选加载状态 */
.waterfall-container.filtering {
    position: relative;
    pointer-events: none;
}

.waterfall-container.filtering::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.waterfall-container.filtering::after {
    opacity: 1;
}

/* 空状态提示 */
.filter-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
    grid-column: 1 / -1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.filter-empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.filter-empty-state .empty-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.filter-empty-state .empty-hint {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.waterfall-category .page-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.1px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.waterfall-category .page-title {
    margin: 0 0 0.5rem 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.waterfall-category .page-title[style*="background-image"] {
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.waterfall-category .archive-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* 筛选器样式 */
.category-filter-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 0.3rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex-basis: 100%;
    width: 100%;
    justify-content: flex-start;
}

/* 确保所有筛选组的图标和内容对齐 */
.filter-group > .filter-label {
    width: 32px;
    flex-shrink: 0;
}

/* 确保分类筛选器中的标签可以换行 */
.filter-group > .filter-tags {
    flex: 1;
    min-width: 0;
    width: auto;
}

/* 权限筛选行：左侧权限筛选，右侧VIP和排序 */
.filter-group-permission {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.filter-group-permission > .filter-label {
    flex-shrink: 0;
    width: 32px;
}

.filter-group-permission > .filter-tags {
    flex: 1;
    margin-left: 0;
    min-width: 0;
}

.filter-group-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.filter-group-vip {
    flex-basis: auto;
    width: auto;
}

.filter-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #FF6347;
    margin-top: -4px;
    white-space: nowrap;
    line-height: 1.2;
}

.filter-label-icon {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 32px;
    height: 32px;
    padding: 0;
    padding-top: 6px;
    padding-left: 0;
    cursor: default;
}

.category-filter-bar .filter-label-icon i {
    font-size: 20px;
    color: #FF4500 !important;
    transform: scale(1.2);
}

/* 标签筛选图标往下移动 */
.filter-group:nth-of-type(2) .filter-label-icon {
    padding-top: 8px;
}

/* 权限筛选图标往下移动 */
.filter-group-permission .filter-label-icon {
    padding-top: 8px;
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
    overflow-x: visible;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
    margin-right: 0;
    padding-right: 0;
    width: 100%;
    max-width: 100%;
}

.filter-tag {
    padding: 6px 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.filter-tag:hover {
    border-color: #2271b1;
    color: #2271b1;
    background: #f0f7ff;
}

.filter-tag.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.filter-tag.active:hover {
    background: #135e96;
    border-color: #135e96;
}

/* VIP升级按钮样式 */
.filter-group-vip {
    margin-left: auto;
}

.vip-upgrade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    background: linear-gradient(135deg, #ff4757 0%, #ffa502 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
    white-space: nowrap;
    height: 30px;
    width: 168px;
    line-height: 1;
}

.vip-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
    background: linear-gradient(135deg, #ff6348 0%, #ffb347 100%);
}

.vip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    flex-shrink: 0;
}

.vip-icon svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.vip-text {
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.3px;
}


/* ============================================
   瀑布流容器布局 - 基础样式
   ============================================ */
.waterfall-container {
    display: grid;
    gap: 20px;
    margin-bottom: 2rem;
}

/* 默认：没有侧边栏时，一行5个卡片 */
.waterfall-container {
    grid-template-columns: repeat(5, 1fr);
}

/* 有侧边栏时：一行4个卡片 */
.category-content-wrapper:has(.content-sidebar) .waterfall-container {
    grid-template-columns: repeat(4, 1fr);
}

/* 兼容不支持 :has() 的浏览器 - 使用JavaScript添加类名 */
.category-content-wrapper.has-sidebar .waterfall-container {
    grid-template-columns: repeat(4, 1fr);
}

.category-content-wrapper.no-sidebar .waterfall-container {
    grid-template-columns: repeat(5, 1fr);
}

/* ============================================
   卡片样式说明：
   各分类页的卡片样式已独立到各自的CSS文件中：
   - 图片分类页：Template/PC/Static/css/category-image.css
   - 文章分类页：Template/PC/Static/css/category-article.css
   - 视频分类页：Template/PC/Static/css/category-video.css
   - 音频分类页：Template/PC/Static/css/category-audio.css
   
   如需修改某个分类页的卡片样式，请编辑对应的CSS文件。
   ============================================ */

.waterfall-category .no-posts {
    text-align: center;
    padding: 3rem 0;
}

.waterfall-category .no-posts h2 {
    margin: 0 0 1rem 0;
    color: #333;
}

.waterfall-category .no-posts p {
    color: #666;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    /* 中等屏幕：有侧边栏时3列，无侧边栏时4列 */
    .category-content-wrapper.has-sidebar .waterfall-container,
    .category-content-wrapper:has(.content-sidebar) .waterfall-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-content-wrapper.no-sidebar .waterfall-container,
    .category-content-wrapper:not(:has(.content-sidebar)) .waterfall-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    /* 平板：有侧边栏时2列，无侧边栏时3列 */
    .category-content-wrapper.has-sidebar .waterfall-container,
    .category-content-wrapper:has(.content-sidebar) .waterfall-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .category-content-wrapper.no-sidebar .waterfall-container,
    .category-content-wrapper:not(:has(.content-sidebar)) .waterfall-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    /* 手机：统一1列 */
    .waterfall-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

