/* WP自定义项目筛选器样式 */

/* 筛选器容器 */
#cpf-filter-container {
    margin: 20px 0;
}

/* 筛选器栏 */
.cpf-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    margin-bottom: 50px;
    padding: 0 8px;
}

/* 筛选器组 */
.cpf-filter-group {
    flex: 1;
    min-width: 150px;
    margin-right: 20px;
}

.cpf-filter-group:last-child {
    margin-right: 0;
}

/* 筛选器输入包装器 */
.cpf-filter-input-wrapper {
    position: relative;
}

/* 筛选器输入框 */
.cpf-filter-input {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cpf-filter-input:hover {
    border-bottom-color: #fff;
}

.cpf-input-text {
    color: #ddd;
    font-size: 16px;
    transition: color 0.2s ease;
}

.cpf-input-arrow {
    font-size: 16px;
    color: #ddd;
    font-weight: bold;
    transition: color 0.2s ease;
}

.cpf-filter-input:hover .cpf-input-text,
.cpf-filter-input:hover .cpf-input-arrow {
    color: #fff;
}

/* 下拉框选项 */
.cpf-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #000 !important;
    color: #ddd;
    padding: 12px;
    z-index: 1000;
    display: none;
    max-height: 600px;
    overflow: hidden;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.cpf-filter-input-wrapper.active .cpf-dropdown-options {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

/* 选项列表 */
.cpf-options-list {
    max-height: 400px;
    overflow-y: auto;
}

.cpf-option-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1px;
}

.cpf-option-item input[type="checkbox"] {
    margin-right: 10px;
    flex-shrink: 0;
    accent-color: #000;
}

.cpf-option-text {
    flex: 1;
    font-size: 14px;
    transition: color 0.2s ease;
    color: #ddd;
}

/* 选中状态的视觉反馈 */
.cpf-option-item input[type="checkbox"]:checked + .cpf-option-text {
    color: #fff;
    font-weight: 400;
}

/* 隐藏的选项 */
.cpf-option-item.hidden {
    display: none;
}

/* 关键词搜索组 */
.cpf-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 15px;
    border-bottom: 1px solid #ddd;
}

.cpf-search-wrapper:hover {
    border-bottom-color: #fff;
}

#cpf-keyword-input {
    flex: 1;
    padding: 0;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #ddd;
}

#cpf-keyword-input::placeholder {
    color: #ddd;
}

#cpf-keyword-search-btn {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    width: 20px;
    height: 20px;
}

#cpf-keyword-search-btn:hover {
    color: #fff;
}

#cpf-keyword-search-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

/* 结果区域 */
#cpf-results-wrapper {
    position: relative;
}

.cpf-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 瀑布流结果网格 - 恢复瀑布流布局 */
.cpf-results-grid {
    width: 100%;
    transition: opacity 0.3s ease;
    position: relative;
    min-height: 200px;
    box-sizing: border-box;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* 结果项目 - 瀑布流布局 */
.cpf-result-item {
    background: transparent;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: absolute;
    border-radius: 0;
    box-shadow: none;
    font-size: 14px;
    margin: 0;
    box-sizing: border-box;
}

.cpf-result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.25), 
                0 8px 20px rgba(255, 255, 255, 0.15),
                0 4px 12px rgba(255, 255, 255, 0.1),
                0 0 30px rgba(255, 255, 255, 0.12);
}

.cpf-result-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

/* 结果项目图片容器 */
.cpf-result-item .image-container {
    position: relative;
    width: 100%;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    border-radius: 0;
}

/* 图片覆盖层 */
.cpf-result-item .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cpf-result-item:hover .image-overlay {
    opacity: 0;
}

.cpf-result-item img {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 0;
}

.cpf-result-item:hover img {
    transform: scale(1.02);
}

/* 项目分类样式 */
.cpf-result-item.ratio-portrait {
    height: 640px !important;
    min-height: 640px !important;
    max-height: 640px !important;
}

.cpf-result-item.ratio-landscape {
    height: 310px !important;
    min-height: 310px !important;
    max-height: 310px !important;
}

.cpf-result-item.ratio-wide {
    height: 310px !important;
    min-height: 310px !important;
    max-height: 310px !important;
}

/* 超宽项目样式 - 瀑布流布局 */
.cpf-result-item.wide-item {
    /* 宽度由JavaScript动态设置 */
}

/* 平板端超宽项目 */
@media (min-width: 768px) and (max-width: 1199px) {
    .cpf-result-item.wide-item {
        flex: 0 0 calc(100% - 0px); /* 平板端占满整行 */
    }
}

/* 移动端超宽项目 */
@media (max-width: 767px) {
    .cpf-result-item.wide-item {
        flex: 0 0 100%; /* 移动端占满整行 */
    }
}

.cpf-placeholder-image {
    width: 100%;
    height: 100%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    border-radius: 0;
}

.cpf-result-item h2 {
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.3;
    color: #fff; /* 改为白色，默认就清晰显示 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7); /* 添加阴影确保可读性 */
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 2;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.cpf-result-item:hover h2 {
    /* 移除颜色变化，现在默认就是白色 */
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); /* 只增强阴影效果 */
}

/* 无结果提示 */
.cpf-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* 懒加载图片样式 */
.cpf-lazy-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
    opacity: 0;
    background-color: #f0f0f0;
}

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

.cpf-lazy-image.loading {
    opacity: 0.5;
}

/* 懒加载占位效果 */
.cpf-lazy-image:not(.loaded) {
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 响应式设计 */

/* 平板设备 (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .cpf-filter-bar {
        gap: 12px;
    }
    
    .cpf-filter-group {
        min-width: 140px;
    }
    
    /* 平板端下拉框优化 */
    .cpf-dropdown-options {
        max-height: 500px;
    }
    
    /* 平板端瀑布流容器优化 */
    .cpf-results-grid {
        padding: 20px 12px;
    }
    
    /* 平板端项目间距优化 */
    .cpf-result-item {
        margin-bottom: 16px !important;
    }
    
    /* 平板端项目高度调整 */
    .cpf-result-item.ratio-portrait {
        height: 400px !important; /* 平板端竖版高度减少 */
        min-height: 400px !important;
        max-height: 400px !important;
    }

    .cpf-result-item.ratio-landscape {
        height: 200px !important; /* 平板端横版高度减少 */
        min-height: 200px !important;
        max-height: 200px !important;
    }

    .cpf-result-item.ratio-wide {
        height: 200px !important; /* 平板端超宽高度减少 */
        min-height: 200px !important;
        max-height: 200px !important;
    }
    
    /* 平板端项目标题优化 */
    .cpf-result-item h2 {
        font-size: 14px;
        bottom: 18px;
        left: 18px;
        right: 18px;
    }
}

/* 移动设备 (小于768px) */
@media (max-width: 767px) {
    .cpf-filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 35px;
    }
    
    .cpf-filter-group {
        min-width: auto;
        margin-right: 0;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* 移动端所有筛选组都占满宽度，单独一行 */
    
    /* 移动端下拉框优化 */
    .cpf-dropdown-options {
        position: absolute;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        transform: translateY(0);
        max-height: 120vh;
        border-radius: 8px;
    }
    
    .cpf-filter-input-wrapper.active .cpf-dropdown-options {
        transform: translateY(0);
    }
    
    /* 移动端筛选器输入框优化 */
    .cpf-filter-input {
        padding: 5px 15px !important;
    }
    
    .cpf-input-text {
        font-size: 15px;
    }
    
    .cpf-input-arrow {
        font-size: 14px;
    }

    .cpf-option-item {
        font-size: 13px;
    }
    
    /* 移动端瀑布流容器优化 */
    .cpf-results-grid {
        padding: 20px 8px;
    }
    
    /* 移动端项目间距优化 */
    .cpf-result-item {
        margin-bottom: 12px !important;
    }
    
    /* 移动端项目高度调整 - 不限制高度，让图片自然显示 */
    .cpf-result-item.ratio-portrait,
    .cpf-result-item.ratio-landscape,
    .cpf-result-item.ratio-wide {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        width: 100% !important;
    }

    /* 移动端图片容器自适应高度 */
    .cpf-result-item .image-container {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    /* 移动端图片自适应 */
    .cpf-result-item .cpf-lazy-image {
        height: auto !important;
        width: 100% !important;
        object-fit: cover;
    }

    /* 移动端强制使用正常文档流 - 覆盖所有可能的冲突 */
    .cpf-results-grid {
        display: block !important;
        height: auto !important;
        position: relative !important;
    }

    .cpf-result-item,
    .cpf-result-item.ratio-portrait,
    .cpf-result-item.ratio-landscape,
    .cpf-result-item.ratio-wide {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        margin-bottom: 20px !important;
        display: block !important;
        float: none !important;
        transform: none !important;
    }
    
    /* 移动端项目标题优化 */
    .cpf-result-item h2 {
        font-size: 14px;
        bottom: 15px;
        left: 15px;
        right: 15px;
    }
}

/* 小屏移动设备 (小于480px) */
@media (max-width: 479px) {
    .cpf-results-grid {
        min-height: 150px;
    }
    
    .cpf-filter-container {
        margin: 15px 0;
    }
    
    .cpf-filter-bar {
        gap: 15px;
    }

    .cpf-filter-group {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* 小屏移动端筛选器输入框进一步优化 */
    .cpf-filter-input {
        padding: 6px 15px !important;
    }
    
    .cpf-input-text {
        font-size: 15px;
    }

    .cpf-input-arrow {
        font-size: 13px;
    }

    .cpf-option-item {
        font-size: 13px;
    }
    
    /* 小屏移动端项目标题进一步优化 */
    .cpf-result-item h2 {
        font-size: 13px;
        bottom: 12px;
        left: 12px;
        right: 12px;
    }
} 

/* 置顶文章样式 */
#cpf-pinned-wrapper {
    margin-bottom: 0px;
    position: relative; /* 让内部 .cpf-loader 居中定位 */
}

.cpf-pinned-grid {
    display: block;
    position: relative;
    /* gap handled by JS */
}

.cpf-pinned-item {
    flex: none;
    width: auto;
} 

/* 添加置顶项目样式以保持一致 */
.cpf-pinned-item {
    background: transparent;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; /* 保持在 flex 流中 */
    border-radius: 0;
    box-shadow: none;
    font-size: 14px;
    margin: 0;
    box-sizing: border-box;
}

/* Hover 效果保持一致 */
.cpf-result-item:hover,
.cpf-pinned-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.25),
                0 8px 20px rgba(255, 255, 255, 0.15),
                0 4px 12px rgba(255, 255, 255, 0.1),
                0 0 30px rgba(255, 255, 255, 0.12);
}

/* 链接区域 */
.cpf-result-item a,
.cpf-pinned-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

/* 图片容器 */
.cpf-result-item .image-container,
.cpf-pinned-item .image-container {
    position: relative;
    width: 100%;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    border-radius: 0;
}

/* 覆盖层 */
.cpf-result-item .image-overlay,
.cpf-pinned-item .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cpf-result-item:hover .image-overlay,
.cpf-pinned-item:hover .image-overlay {
    opacity: 0;
}

/* 图片 */
.cpf-result-item img,
.cpf-pinned-item img {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 0;
}

.cpf-result-item:hover img,
.cpf-pinned-item:hover img {
    transform: scale(1.02);
}

/* 标题 */
.cpf-result-item h2,
.cpf-pinned-item h2 {
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 2;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.cpf-result-item:hover h2,
.cpf-pinned-item:hover h2 {
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
} 

/* 置顶项目尺寸匹配 - 桌面端 */
.cpf-pinned-item.ratio-portrait {
    height: 640px !important;
    min-height: 640px !important;
    max-height: 640px !important;
}
.cpf-pinned-item.ratio-landscape,
.cpf-pinned-item.ratio-wide {
    height: 310px !important;
    min-height: 310px !important;
    max-height: 310px !important;
} 

/* Wide pinned item spans 2 columns on desktop */
.cpf-pinned-item.ratio-wide { grid-column: span 2; }

/* Tablet columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .cpf-pinned-grid { grid-template-columns: repeat(2, 1fr); }
    .cpf-pinned-item.ratio-wide { grid-column: span 2; }
}

/* Mobile single column */
@media (max-width: 767px) {
    .cpf-pinned-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        position: relative !important;
        height: auto !important;
        padding: 0 8px !important;
    }

    .cpf-pinned-item,
    .cpf-pinned-item.ratio-portrait,
    .cpf-pinned-item.ratio-landscape,
    .cpf-pinned-item.ratio-wide {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        grid-column: span 1 !important;
        display: block !important;
        margin: 0 !important;
    }

    .cpf-pinned-item .image-container {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    .cpf-pinned-item .cpf-lazy-image,
    .cpf-pinned-item img {
        height: auto !important;
        width: 100% !important;
        min-height: auto !important;
        max-height: none !important;
        object-fit: cover !important;
    }
}

.cpf-loader.pinned {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999;
} 