:root {
    --primary-color: #1e3c72;
    --secondary-color: #2a5298;
    --light-blue: #f5f8ff;
    --border-color: #e0e0e0;
    --text-color: #333;
    --spacing-unit: 1rem;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8f9fa;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-unit);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

h2 {
    font-size: 1rem;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 1rem;
}

/* Search Box */
.search-box {
    position: relative;
    max-width: 600px;
    margin: 2rem auto;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.search-box button {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.search-box button:hover {
    color: var(--primary-color);
}

.search-box button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

/* Filter Grid Styles */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin: 2rem 0;
    padding: 2rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-grid .filter-column {
    background: none;
    border: none;
}

.filter-grid h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.filter-grid .filter-list {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    padding-right: 0.5rem;
}

.filter-grid .filter-list::-webkit-scrollbar {
    width: 4px;
}

.filter-grid .filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.filter-grid .filter-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

/* Checkbox Filter Styles */
.filter-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    position: relative;
}

.filter-checkbox {
    position: absolute;
    opacity: 0;
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    z-index: 1;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.filter-label {
    padding: 6px 8px 6px 28px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    width: 100%;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-label::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background-color: white;
    transition: all 0.2s ease;
}

.filter-checkbox:checked + .filter-label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-checkbox:checked + .filter-label::after {
    content: '✓';
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 10px;
}

.filter-label:hover {
    background-color: var(--light-blue);
}

.filter-checkbox:checked + .filter-label {
    background-color: var(--light-blue);
    color: var(--primary-color);
    font-weight: 500;
}

/* Loading Placeholder */
.loading-placeholder {
    padding: 1rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Main Layout */
.main-area {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

/* Sidebar Filter Styles */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
}

.filter-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    padding: 0 1.5rem;
}

.filter-section .filter-list {
    padding: 0 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.filter-section .filter-list::-webkit-scrollbar {
    width: 4px;
}

.filter-section .filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.filter-section .filter-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
}

/* Results Section */
.results-section {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light-blue);
    border-radius: 8px;
}

.results-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.results-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.threshold-slider-container {
    position: relative;
    width: 200px;
}

.threshold-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.threshold-labels span {
    font-size: 0.8rem;
    color: var(--text-color);
    transition: all 0.2s ease;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.product-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.product-image-container {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background: #f8f9fa;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-image.active {
    opacity: 1;
}

/* Variant Image Styles */
.variant-images {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
}

.variant-image-btn {
    width: 24px;
    height: 24px;
    border: 2px solid white;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: #fff;
}

.variant-image-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.variant-image-btn.active {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    font-size: 1.2rem;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #fff5f5;
    border-radius: 8px;
    margin: 2rem 0;
}

.error-message p {
    margin: 0.5rem 0;
}

/* Toggle Button Styles */
.toggle-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Price Button Styles */
.price-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.price-btn:hover,
.price-btn.active {
    background: var(--light-blue);
    border-color: var(--primary-color);
}

/* Pagination */
.results-footer {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button:not(:disabled):hover {
    background: var(--light-blue);
    border-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-area {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }

    .results-controls {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Product Meta Styles */
.product-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-color-light);
}

.product-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rush-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rush-label {
    color: var(--primary-color);
    font-weight: 500;
}

.rush-option {
    background-color: var(--light-blue);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Filter Group Styles */
.filter-group-header {
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    color: var(--primary-color);
    font-size: 0.95em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.filter-subgroup-header {
    font-weight: 500;
    margin: 0.5rem 0;
    padding-left: 0.5rem;
    font-size: 0.9em;
    color: var(--text-color);
}

/* Filter Group Styles */
.filter-group-header {
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    color: var(--primary-color);
    font-size: 0.95em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.filter-subgroup-header {
    font-weight: 500;
    margin: 0.5rem 0;
    font-size: 0.9em;
    color: var(--text-color);
}

.filter-subgroup-items {
    padding-left: 1rem;
}

/* Add spacing between groups */
.filter-group-header:not(:first-child) {
    margin-top: 1.5rem;
}
