/**
 * Advanced Search - 筛选弹窗样式
 * 保持与主搜索页面一致的设计风格
 */

/* ========== 筛选弹窗容器 ========== */
.filter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-modal-overlay.active {
    display: block;
}

.filter-modal-overlay.show {
    opacity: 1;
}

/* 筛选弹窗主体 */
.filter-modal {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 2001;
}

.filter-modal-overlay.show .filter-modal {
    transform: translateX(0);
}

/* 弹窗头部 */
.filter-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    position: relative;
}

.filter-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-modal-title i {
    color: #d42323;
    font-size: 22px;
}

.filter-close-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: #f9fafb;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-close-btn:hover {
    background: #fee2e2;
    color: #d42323;
}

/* 弹窗内容区域 */
.filter-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #fafafa;
}

/* 筛选组 */
.filter-group {
    margin-bottom: 28px;
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.filter-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group-title i {
    color: #d42323;
    font-size: 14px;
}

/* 复选框样式 */
.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 6px;
    padding: 10px;
}

.filter-checkbox:hover {
    background: #fef2f2;
}

.filter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #d42323;
}

.filter-checkbox label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    margin: 0;
    flex: 1;
}

.filter-checkbox .count {
    font-size: 13px;
    color: #6b7280;
    margin-left: auto;
}

/* 价格范围输入 */
.price-range-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.price-input-wrapper {
    flex: 1;
    position: relative;
}

.price-input-wrapper .currency {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
}

.price-input {
    width: 100%;
    height: 42px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 0 12px 0 28px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fff;
}

.price-input:focus {
    outline: none;
    border-color: #d42323;
    box-shadow: 0 0 0 3px rgba(212, 35, 35, 0.1);
}

.price-range-separator {
    color: #6b7280;
    font-size: 14px;
}

/* 价格快捷选择 */
.price-quick-select {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.price-quick-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.price-quick-btn:hover {
    border-color: #d42323;
    color: #d42323;
    background: #fef2f2;
}

.price-quick-btn.active {
    background: #d42323;
    color: #fff;
    border-color: #d42323;
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 100px;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option label {
    display: block;
    padding: 10px 16px;
    text-align: center;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.radio-option input[type="radio"]:checked + label {
    background: #d42323;
    color: #fff;
    border-color: #d42323;
}

.radio-option label:hover {
    border-color: #d42323;
}

/* 评分筛选 */
.rating-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.rating-option:hover {
    background: #fef2f2;
}

.rating-option input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #d42323;
}

.rating-stars {
    display: flex;
    gap: 2px;
    margin-right: 8px;
}

.rating-stars i {
    color: #fbbf24;
    font-size: 14px;
}

.rating-stars i.empty {
    color: #e5e7eb;
}

.rating-label {
    font-size: 14px;
    color: #374151;
}

/* 已选筛选标签 */
.active-filters-section {
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.active-filters-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.clear-all-filters {
    font-size: 13px;
    color: #d42323;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.clear-all-filters:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.active-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    gap: 6px;
}

.active-filter-tag .remove {
    color: #d42323;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: transform 0.2s;
}

.active-filter-tag .remove:hover {
    transform: scale(1.2);
}

/* 弹窗底部 */
.filter-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    gap: 12px;
}

.filter-modal-footer button {
    flex: 1;
    height: 44px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-filter {
    background: #f3f4f6;
    color: #374151;
}

.btn-reset-filter:hover {
    background: #e5e7eb;
}

.btn-apply-filter {
    background: linear-gradient(135deg, #d42323, #b31e1e);
    color: #fff;
    box-shadow: 0 4px 12px rgba(212, 35, 35, 0.2);
}

.btn-apply-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 35, 35, 0.3);
}

/* 结果统计 */
.filter-results-count {
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 16px;
}

.filter-results-count .count {
    font-size: 18px;
    font-weight: 600;
    color: #d42323;
}

.filter-results-count .text {
    font-size: 14px;
    color: #6b7280;
}

/* 加载状态 */
.filter-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.filter-loading.active {
    display: flex;
}

.filter-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #d42323;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========== 移动端响应式设计 ========== */
@media (max-width: 768px) {
    /* 移动端从底部弹出 */
    .filter-modal {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 85vh;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
    }
    
    .filter-modal-overlay.show .filter-modal {
        transform: translateY(0);
    }
    
    /* 添加拖动指示器 */
    .filter-modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
    }
    
    .filter-modal-header {
        padding-top: 24px;
    }
    
    .filter-modal-body {
        padding: 16px;
        max-height: calc(85vh - 140px);
    }
    
    .filter-group {
        padding: 14px;
    }
    
    .price-range-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .price-range-separator {
        display: none;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .radio-option {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .filter-modal-title {
        font-size: 18px;
    }
    
    .filter-group-title {
        font-size: 14px;
    }
    
    .filter-modal-footer {
        padding: 12px 16px;
    }
    
    .filter-modal-footer button {
        height: 40px;
        font-size: 14px;
    }
}

/* ========== 动画定义 ========== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* 辅助类 */
.filter-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 20px 0;
}

.filter-helper-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

/* 品牌搜索框 */
.brand-search-box {
    position: relative;
    margin-bottom: 12px;
}

.brand-search-input {
    width: 100%;
    height: 38px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0 36px 0 12px;
    font-size: 14px;
    background: #fff;
}

.brand-search-input:focus {
    outline: none;
    border-color: #d42323;
}

.brand-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
}

.brand-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
}

.brand-list::-webkit-scrollbar {
    width: 6px;
}

.brand-list::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.brand-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.brand-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
