/* 筛选页面样式 - 黑色主题 + 移动端优化 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    color: #e2e8f0;
    overflow-x: hidden;
}

.filter-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

/* 头部导航 */
.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #2d3748;
    border-bottom: 1px solid #4a5568;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.back-btn:hover {
    background: #4a5568;
    border-color: #667eea;
}

.back-btn:active {
    transform: scale(0.98);
}

.back-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.filter-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f7fafc;
}

.reset-btn {
    padding: 8px 16px;
    background: #e53e3e;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.reset-btn:hover {
    background: #c53030;
}

.reset-btn:active {
    transform: scale(0.98);
}

/* 筛选内容 */
.filter-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.filter-section {
    margin-bottom: 32px;
    background: #2d3748;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #4a5568;
}

.filter-section:last-child {
    margin-bottom: 100px; /* 为底部操作栏留空间 */
}

.filter-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #f7fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

.filter-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #cbd5e0;
}

/* 快速筛选预设 */
.preset-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.preset-btn {
    padding: 16px 12px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    border-color: #667eea;
    background: #2d3748;
}

.preset-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.preset-btn:active {
    transform: scale(0.98);
}

/* 范围选择器 */
.range-selector select {
    width: 100%;
    padding: 14px 16px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.range-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.range-selector option {
    background: #1a202c;
    color: #e2e8f0;
    padding: 8px;
}

/* 滑块控件 */
.slider-container {
    position: relative;
    margin-top: 8px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #4a5568;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 3px solid #1a202c;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 3px solid #1a202c;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #a0aec0;
}

/* 复选框组 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    min-height: 48px;
}

.checkbox-item.compact {
    padding: 10px;
    min-height: 40px;
    font-size: 0.85rem;
}

.checkbox-item:hover {
    border-color: #667eea;
    background: #2d3748;
}

.checkbox-text {
    white-space: nowrap;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #4a5568;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 仓位网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.position-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    text-align: center;
}

.position-btn:hover {
    border-color: #667eea;
    background: #2d3748;
}

.position-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.position-btn:active {
    transform: scale(0.98);
}

.position-icon {
    font-size: 1.5rem;
}

.position-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.position-range {
    font-size: 0.7rem;
    color: #a0aec0;
}

.position-btn.active .position-label,
.position-btn.active .position-range {
    color: white;
}

/* 风险选择器 */
.risk-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.risk-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 64px;
}

.risk-item.compact {
    padding: 12px;
    min-height: 48px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
}

.risk-item:hover {
    border-color: #667eea;
    background: #2d3748;
}

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

.risk-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid #4a5568;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.risk-item input[type="radio"]:checked + .risk-indicator {
    border-color: #667eea;
}

.risk-item input[type="radio"]:checked + .risk-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
}

.risk-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.risk-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
}

.risk-desc {
    font-size: 0.8rem;
    color: #a0aec0;
}

.risk-item.low:hover .risk-indicator {
    border-color: #68d391;
}

.risk-item.low input[type="radio"]:checked + .risk-indicator {
    border-color: #68d391;
}

.risk-item.low input[type="radio"]:checked + .risk-indicator::after {
    background: #68d391;
}

.risk-item.medium:hover .risk-indicator {
    border-color: #f6ad55;
}

.risk-item.medium input[type="radio"]:checked + .risk-indicator {
    border-color: #f6ad55;
}

.risk-item.medium input[type="radio"]:checked + .risk-indicator::after {
    background: #f6ad55;
}

.risk-item.high:hover .risk-indicator {
    border-color: #fc8181;
}

.risk-item.high input[type="radio"]:checked + .risk-indicator {
    border-color: #fc8181;
}

.risk-item.high input[type="radio"]:checked + .risk-indicator::after {
    background: #fc8181;
}

/* 排序列表 */
.sort-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sort-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.sort-item:hover {
    border-color: #667eea;
    background: #2d3748;
}

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

.sort-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid #4a5568;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sort-item input[type="radio"]:checked + .sort-indicator {
    border-color: #667eea;
}

.sort-item input[type="radio"]:checked + .sort-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
}

.sort-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.sort-icon {
    font-size: 1.1rem;
}

.sort-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
}

/* 排序网格 - 保留用于向后兼容 */
.sort-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.sort-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: #1a202c;
    border: 2px solid #4a5568;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    text-align: center;
    position: relative;
}

.sort-btn:hover {
    border-color: #667eea;
    background: #2d3748;
}

.sort-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.sort-btn:active {
    transform: scale(0.98);
}

.sort-btn .sort-icon {
    font-size: 1.2rem;
}

.sort-btn .sort-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sort-direction {
    font-size: 1rem;
    font-weight: bold;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #a0aec0;
}

.sort-btn.active .sort-label,
.sort-btn.active .sort-direction {
    color: white;
}

/* 底部操作栏 */
.filter-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2d3748;
    border-top: 1px solid #4a5568;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.results-preview {
    text-align: center;
    font-size: 0.9rem;
    color: #cbd5e0;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.cancel-btn,
.apply-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.cancel-btn {
    background: #4a5568;
    color: #e2e8f0;
}

.cancel-btn:hover {
    background: #718096;
}

.apply-btn {
    background: #667eea;
    color: white;
}

.apply-btn:hover {
    background: #5a67d8;
}

.cancel-btn:active,
.apply-btn:active {
    transform: scale(0.98);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .filter-container {
        max-width: 100%;
    }
    
    .filter-header {
        padding: 12px 16px;
    }
    
    .filter-header h1 {
        font-size: 1.1rem;
    }
    
    .filter-content {
        padding: 16px;
    }
    
    .filter-section {
        padding: 16px;
        margin-bottom: 24px;
    }
    
    .preset-filters {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .preset-btn {
        padding: 12px 8px;
        min-height: 48px;
        font-size: 0.8rem;
    }
    
    .position-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }
    
    .position-btn {
        padding: 12px 6px;
        min-height: 70px;
    }
    
    .position-icon {
        font-size: 1.3rem;
    }
    
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .risk-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .risk-item.compact {
        padding: 10px;
        min-height: 44px;
    }
    
    .checkbox-item.compact {
        padding: 8px;
        min-height: 40px;
        font-size: 0.8rem;
    }
    
    .sort-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .sort-btn {
        padding: 12px 6px;
        min-height: 70px;
    }
    
    .sort-btn .sort-icon {
        font-size: 1.1rem;
    }
    
    .risk-item {
        padding: 12px;
        min-height: 56px;
    }
    
    .checkbox-item {
        padding: 10px;
        min-height: 44px;
    }
    
    .filter-footer {
        padding: 12px 16px;
    }
    
    .action-buttons {
        gap: 10px;
    }
    
    .cancel-btn,
    .apply-btn {
        padding: 12px 16px;
        min-height: 44px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .filter-header {
        padding: 10px 12px;
    }
    
    .back-btn,
    .reset-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .filter-header h1 {
        font-size: 1rem;
    }
    
    .filter-content {
        padding: 12px;
    }
    
    .filter-section {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .filter-section h3 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .preset-filters {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .risk-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .checkbox-item.compact {
        padding: 6px;
        min-height: 36px;
        font-size: 0.75rem;
    }
    
    .risk-item.compact {
        padding: 8px;
        min-height: 40px;
    }
    
    .risk-item.compact .risk-label {
        font-size: 0.8rem;
    }
    
    .sort-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .checkbox-group {
        gap: 8px;
    }
    
    .risk-selector {
        gap: 8px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2d3748;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .preset-btn:hover,
    .position-btn:hover,
    .sort-btn:hover,
    .risk-item:hover,
    .checkbox-item:hover {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .preset-btn:active,
    .position-btn:active,
    .sort-btn:active {
        transform: scale(0.95);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}