/**
 * 产品筛选器增强样式
 * Enhanced Product Filters
 */

/* ==========================================
   筛选工具栏容器
   ========================================== */
.product-tools {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ==========================================
   筛选器主体
   ========================================== */
.product-filters {
    margin-bottom: 20px;
}

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

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

.filter-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.filter-label:before {
    content: '';
    width: 4px;
    height: 16px;
    background: #0085cd;
    margin-right: 10px;
    border-radius: 2px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ==========================================
   筛选按钮样式
   ========================================== */
.filter-btn {
    padding: 8px 20px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.filter-btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 133, 205, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.filter-btn:hover {
    background: #e8f4f8;
    color: #0085cd;
    border-color: #b3e0f2;
}

.filter-btn:hover:before {
    width: 200px;
    height: 200px;
}

.filter-btn.active {
    background: linear-gradient(135deg, #0085cd 0%, #006ba1 100%);
    border-color: #0085cd;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 133, 205, 0.3);
    transform: translateY(-2px);
}

.filter-btn.active:before {
    display: none;
}

/* 筛选项计数 */
.filter-btn .count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.filter-btn:not(.active) .count {
    background: rgba(0, 133, 205, 0.1);
    color: #0085cd;
}

/* ==========================================
   搜索框样式
   ========================================== */
.product-search {
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-search input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e5e5e5;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s;
    background: #f9f9f9;
}

.product-search input:focus {
    outline: none;
    border-color: #0085cd;
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 133, 205, 0.1);
}

.product-search input::placeholder {
    color: #999;
}

.product-search-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #0085cd 0%, #006ba1 100%);
    border: none;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.product-search-btn:hover {
    background: linear-gradient(135deg, #006ba1 0%, #005580 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 133, 205, 0.4);
}

/* ==========================================
   筛选结果信息
   ========================================== */
.filter-result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid #e5e5e5;
    margin-top: 20px;
}

.result-count {
    font-size: 14px;
    color: #666;
}

.result-count strong {
    color: #0085cd;
    font-weight: 700;
    font-size: 18px;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.clear-filters-btn,
.sort-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-filters-btn:hover,
.sort-btn:hover {
    border-color: #0085cd;
    color: #0085cd;
    background: #f8f9fa;
}

.clear-filters-btn:before {
    content: '✕ ';
    margin-right: 4px;
}

/* ==========================================
   下拉排序选择器
   ========================================== */
.sort-dropdown {
    position: relative;
    display: inline-block;
}

.sort-dropdown select {
    padding: 8px 32px 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s;
}

.sort-dropdown select:hover {
    border-color: #0085cd;
    color: #0085cd;
}

.sort-dropdown:after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #999;
    pointer-events: none;
}

/* ==========================================
   活动筛选标签
   ========================================== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e5e5e5;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #e8f4f8;
    border: 1px solid #b3e0f2;
    border-radius: 20px;
    font-size: 13px;
    color: #0085cd;
    font-weight: 500;
}

.active-filter-tag .remove {
    margin-left: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0085cd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.active-filter-tag .remove:hover {
    background: #006ba1;
    transform: rotate(90deg);
}

/* ==========================================
   加载状态
   ========================================== */
.filter-loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.filter-loading.show {
    display: block;
}

.filter-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0085cd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================
   空状态
   ========================================== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
    margin: 20px 0;
}

.no-results-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-results h3 {
    font-size: 20px;
    color: #666;
    margin-bottom: 10px;
}

.no-results p {
    font-size: 14px;
    color: #999;
}

/* ==========================================
   移动端适配
   ========================================== */
@media (max-width: 991px) {
    .product-tools {
        padding: 20px;
    }

    .filter-result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .filter-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    .product-tools {
        padding: 15px;
        border-radius: 8px;
    }

    .filter-label {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .filter-options {
        gap: 8px;
    }

    .filter-btn {
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 20px;
    }

    .product-search {
        flex-direction: column;
    }

    .product-search input {
        width: 100%;
        padding: 10px 16px;
    }

    .product-search-btn {
        width: 100%;
        padding: 10px 20px;
    }

    .filter-result-info {
        padding: 12px 0;
        margin-top: 15px;
    }

    .result-count {
        font-size: 13px;
    }

    .result-count strong {
        font-size: 16px;
    }

    .clear-filters-btn,
    .sort-btn,
    .sort-dropdown select {
        padding: 6px 12px;
        font-size: 12px;
    }

    .active-filters {
        gap: 6px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .active-filter-tag {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ==========================================
   打印样式
   ========================================== */
@media print {
    .product-tools,
    .filter-actions,
    .product-search,
    .active-filters {
        display: none !important;
    }
}

/* ==========================================
   高对比度模式
   ========================================== */
@media (prefers-contrast: high) {
    .filter-btn {
        border-width: 3px;
    }

    .filter-btn.active {
        box-shadow: 0 0 0 3px rgba(0, 133, 205, 0.5);
    }
}

/* ==========================================
   深色模式支持（可选）
   ========================================== */
@media (prefers-color-scheme: dark) {
    .product-tools {
        background: #1a1a1a;
        box-shadow: 0 2px 8px rgba(255,255,255,0.05);
    }

    .filter-label {
        color: #e0e0e0;
    }

    .filter-btn {
        background: #2a2a2a;
        color: #ccc;
    }

    .filter-btn:hover {
        background: #333;
        color: #fff;
    }

    .product-search input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .result-count {
        color: #ccc;
    }

    .no-results {
        background: #2a2a2a;
    }

    .no-results h3 {
        color: #ccc;
    }
}
