/* Category Page Container - Sidebar + Products */
.category-page-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Filter Sidebar */
.filter-sidebar {
    width: 280px;
    min-width: 280px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;
    position: sticky;
    /* top: 80px; */
    flex-shrink: 0;
    overflow-y: visible;
    overflow-x: hidden;
    box-sizing: border-box;
}


.filter-header {
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 16px;
}

.filter-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #212121;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Group */
.filter-group {
    margin-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 16px;
}

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

.filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.filter-group-header span {
    font-size: 14px;
    font-weight: 600;
    color: #212121;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-group-header .toggle-icon {
    font-size: 12px;
    color: #878787;
    transition: transform 0.2s;
}

.filter-group-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.filter-group-content {
    padding-left: 4px;
}

.filter-group-content.collapsed {
    display: none;
}

/* Filter Search */
.filter-search {
    margin-bottom: 12px;
}

.filter-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.filter-search input:focus {
    border-color: #0a4409;
}

/* Filter Options */
.filter-options {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
}

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

.filter-checkbox span {
    font-size: 14px;
    color: #212121;
    flex: 1;
}

.filter-checkbox:hover span {
    color: #0a4409;
}

.view-all-link {
    display: block;
    font-size: 13px;
    color: #0a4409;
    text-decoration: none;
    margin-top: 8px;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Price Range */
.price-range {
    padding: 8px 0;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.price-inputs input {
    flex: 1;
    min-width: 0;
    width: 0;
    padding: 6px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.price-inputs span {
    flex-shrink: 0;
    padding: 0 2px;
}

.price-inputs input:focus {
    border-color: #0a4409;
}


.price-slider-container {
    margin-top: 12px;
}

.price-slider-container input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.price-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #24db65;
    cursor: pointer;
}

.price-slider-container input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #24db65;
    cursor: pointer;
    border: none;
}

/* Filter Actions */
.filter-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.clear-filters-btn {
    width: 100%;
    padding: 10px;
    background: #24db65;
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-filters-btn:hover {
    background: #1a5fc7;
}

/* Products Content Area */
.products-content-area {
    flex: 1;
    min-width: 0;
    width: 0;
    /* Force flex to respect available space */
    overflow-x: hidden;
    box-sizing: border-box;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.products-header .section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #212121;
}

.products-sort select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23212121' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.products-sort select:focus {
    border-color: #0a4409;
}

/* Loading Spinner - Full Width */
.loading-spinner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: white;
    border-radius: 4px;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #24db65;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    font-size: 14px;
    color: #878787;
    margin: 0;
}

/* Ensure products grid shows 4 columns on category page */
.products-section .products-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.products-section .product-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.products-section .product-card img,
.products-section .product-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    object-fit: contain;
}

/* Responsive */
@media (max-width: 1200px) {
    .category-page-container {
        flex-direction: column;
    }

    .filter-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }

    .products-section .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .products-section .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .products-section .products-grid {
        grid-template-columns: 1fr !important;
    }
}


/* Nested Filter Structure */
.category-filter-item-wrapper {
    width: 100%;
}

.category-header-row {
    border-radius: 4px;
    padding: 4px 8px !important;
    margin: 2px 0;
    transition: background-color 0.2s;
}

.category-header-row:hover {
    background-color: #f5f5f5;
}

.toggle-children {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.toggle-children:hover {
    color: #24db65 !important;
}

.category-children-container {
    transition: all 0.3s ease-in-out;
}

.level-0>.category-header-row span {
    font-weight: 500;
    color: #212121;
}

.level-1>.category-header-row span {
    color: #4a4a4a;
    font-size: 13px;
}

.level-2>.category-header-row span {
    color: #666;
    font-size: 12px;
}

.filter-checkbox:hover span {
    color: #24db65 !important;
}