/* 保持原有样式不变 */
.sort-controls {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.sort-btn:hover {
    background: #f8fafc;
}

.sort-btn.active {
    background: #1f2937;
    color: white;
    border-color: #1f2937;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.view-toggle-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.view-toggle-btn.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.view-toggle-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn:hover:not(.active) {
    color: #475569;
}

.price-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 200px;
}

.price-input-group input {
    border: none;
    outline: none;
    background: transparent;
    width: 60px;
    text-align: center;
    font-size: 14px;
}

.price-input-group input::placeholder {
    color: #94a3b8;
    font-size: 12px;
}

.price-input-group .currency {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.price-input-group .separator {
    color: #94a3b8;
    font-weight: 500;
}

.quick-price-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-price-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.quick-price-btn.active {
    background: #1f2937;
    border-color: #1f2937;
    color: white;
}

/* 筛选下拉框样式 */
.filter-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.filter-select:hover {
    border-color: #cbd5e1;
}

.filter-select:focus {
    outline: none;
    border-color: #94a3b8;
}

/* 高级筛选面板 */
.advanced-filters {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-section-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-checkbox {
    display: none;
}

.filter-checkbox + label {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-checkbox:checked + label {
    background: #1f2937;
    border-color: #1f2937;
    color: white;
}

/* 筛选标签 */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
}

.filter-tag {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
}

.filter-tag-remove {
    margin-left: 6px;
    color: #94a3b8;
    cursor: pointer;
}

.filter-tag-remove:hover {
    color: #ef4444;
}

.product-card {
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    border-radius: 0.75rem;
    overflow: hidden; 
}

.product-card > div {
    border-radius: inherit;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.product-card.selected {
    border-radius: 0.75rem;
    border: 2px solid #3b82f6;
    transform: translateY(-4px);
    z-index: 20;
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.25),
        inset 0 -1px 0 #3b82f6;
    margin-bottom: -2px;
    padding-bottom: 2px;
}

.product-card.selected::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #3b82f6;
    border-bottom-left-radius: 0.7rem;
    border-bottom-right-radius: 0.7rem;
    z-index: 1;
}

.dark .product-card.selected {
    border-color: #60a5fa;
    box-shadow: 
        0 4px 12px rgba(96, 165, 250, 0.3),
        inset 0 -1px 0 #60a5fa;
}

.dark .product-card.selected::after {
    background-color: #60a5fa;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 13px;
}

.product-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    padding: 16px 12px;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.product-table th:first-child {
    text-align: left;
    min-width: 200px;
}

.product-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
}

.product-table td:first-child {
    text-align: left;
    max-width: 200px;
    white-space: normal;
}

.product-table tbody tr:hover {
    background: #f8fafc;
}

.product-table .product-name {
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}

.product-table .price-cell {
    font-weight: 600;
    color: #dc2626;
    min-width: 80px;
}

.product-table .original-price {
    font-size: 11px;
    color: #6b7280;
    text-decoration: line-through;
    display: block;
    margin-top: 2px;
}

.product-table .config-cell {
    font-size: 12px;
    color: #4b5563;
    min-width: 60px;
}

.product-table .action-btn {
    background: #3b82f6;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.product-table .action-btn:hover {
    background: #2563eb;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow-y: auto;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

.sortable::after {
    content: '↕';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    font-size: 12px;
}

.sortable:hover::after {
    opacity: 0.7;
}

.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #3b82f6;
}

.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #3b82f6;
}

/* 高级筛选按钮 */
.advanced-filter-toggle {
    margin-top: 0.5rem;
    background: transparent;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Dark mode styles */
.dark .view-toggle {
    background: #374151;
}

.dark .view-toggle-btn {
    color: #9ca3af;
}

.dark .view-toggle-btn.active {
    background: #1f2937;
    color: #f9fafb;
}

.dark .price-input-group {
    background: #1f2937;
    border-color: #4b5563;
}

.dark .price-input-group input {
    color: #f9fafb;
}

.dark .price-input-group .currency {
    color: #d1d5db;
}

.dark .quick-price-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

.dark .quick-price-btn:hover {
    background: #4b5563;
    color: #f9fafb;
}

.dark .filter-select {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d1d5db' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.dark .product-table {
    background: #1f2937;
}

.dark .product-table th {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

.dark .product-table td {
    border-color: #374151;
}

.dark .product-table tbody tr:hover {
    background: #374151;
}

.dark .product-table .product-name {
    color: #f9fafb;
}

.dark .product-table .config-cell {
    color: #d1d5db;
}

.dark .table-container {
    border-color: #4b5563;
}

.dark .active-filters {
    background: #374151;
}

.dark .filter-tag {
    background: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}  

/* 响应式调整 */
@media (max-width: 1024px) {
    .desktop-only {
        display: none !important;
    }
    
    .filter-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .advanced-filters {
        display: none;
    }
    
    /* 移动端下拉选择框每2个一排 */
    .filter-controls > div.grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }
    
    .filter-controls .relative.flex-1,
    .filter-controls .price-input-group {
        width: 100%;
    }
    
    /* 确保移动端只显示卡片视图 */
    .product-table,
    .table-container {
        display: none !important;
    }
    
    #productGrid {
        display: grid !important;
    }
}

/* 针对更小的屏幕进一步优化 */
@media (max-width: 640px) {
    /* 保持小屏幕下也是2个一排 */
    .filter-controls > div.grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-controls .relative.flex-1,
    .filter-controls .price-input-group {
        grid-column: span 2;
    }
    
    .filter-controls select {
        grid-column: span 1;
    }
    
    .sort-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .sort-btn {
        text-align: center;
        margin-bottom: 4px;
    }
}


/* 自定义下拉选项样式 */
    #regionFilter option {
        padding: 8px 12px;
        background-color: white;
        color: #333;
        border: none;
        transition: background-color 0.2s ease;
    }

    /* 深色模式下的选项样式 */
    @media (prefers-color-scheme: dark) {
        #regionFilter option {
            background-color: #1a1a1a;
            color: #e5e7eb;
        }
    }

    /* 选项悬停效果 */
    #regionFilter option:hover {
        background-color: #f3f4f6;
    }

    @media (prefers-color-scheme: dark) {
        #regionFilter option:hover {
            background-color: #2d2d2d;
        }
    }

    /* 选中状态样式 */
    #regionFilter option:checked {
        background-color: #e5e7eb;
        font-weight: 500;
    }

    @media (prefers-color-scheme: dark) {
        #regionFilter option:checked {
            background-color: #374151;
        }
    }