/* Enhanced Sidebar Filter Styling for Priceless Theme */

/* Fixed Sidebar Width */
#listSidebar {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    flex: 0 0 300px !important;
}

/* Sidebar Container Improvements */
.company-sidebar-styling {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Sidebar Title Styling */
.sidebar-title {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.sidebar-title .row .col-auto {
    font-size: 0.9rem;
}

/* Category Filter Specific Styles */
#categoryFacetFilters {
    padding: 0.5rem 0;
}

#categoryFacetFilters li.category-filter-item {
    margin-bottom: 0.25rem;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

#categoryFacetFilters li.category-filter-item:hover:not(.active-category) {
    background-color: #f8f9fa !important;
    border-left-color: var(--theme-primary) !important;
}

#categoryFacetFilters li.active-category {
    background-color: #f8f9fa !important;
    color: var(--theme-primary) !important;
}

#categoryFacetFilters li.active-category a {
    color: var(--theme-primary) !important;
}

#categoryFacetFilters li.active-category .nav-arrow {
    color: var(--theme-primary) !important;
}

#categoryFacetFilters .nav-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

#categoryFacetFilters li:hover .nav-arrow {
    transform: translateX(2px);
}

/* Improved child category indentation */
#categoryFacetFilters ul ul {
    position: relative;
    margin-left: 1rem;
    border-left: 2px solid #e9ecef;
    padding-left: 1rem;
}

#categoryFacetFilters ul ul:before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--theme-primary), transparent);
}

/* Brand and Attribute Filter Improvements */
#brandFacetFilters,
#otherFacetFilters {
    padding: 0.5rem 0;
    max-height: 300px;
    overflow-y: auto;
}

/* Brand Facet Specific Improvements */
#brandFacetFilters .custom-control {
    display: flex;
    align-items: center;
    min-height: auto;
    padding-left: 0;
}

#brandFacetFilters .custom-control-label {
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    margin-bottom: 0;
    white-space: nowrap;
}

#brandFacetFilters .custom-control-label span {
    white-space: normal;
    word-break: break-word;
}

#brandFacetFilters li {
    margin-bottom: 0.25rem;
}

#brandFacetFilters .flt-count {
    white-space: nowrap;
}

/* Custom scrollbar for filter sections */
#brandFacetFilters::-webkit-scrollbar,
#otherFacetFilters::-webkit-scrollbar {
    width: 6px;
}

#brandFacetFilters::-webkit-scrollbar-track,
#otherFacetFilters::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#brandFacetFilters::-webkit-scrollbar-thumb,
#otherFacetFilters::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
    border-radius: 3px;
}

#brandFacetFilters::-webkit-scrollbar-thumb:hover,
#otherFacetFilters::-webkit-scrollbar-thumb:hover {
    background: #2c5530;
}

/* Filter Count Badges */
.flt-count {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

/* Custom Checkbox Improvements */
#otherFacetFilters .custom-control {
    display: flex;
    align-items: center;
    min-height: auto;
}

#otherFacetFilters .custom-control-label {
    display: inline-block;
    white-space: nowrap;
    padding-left: 0.25rem;
}

.custom-control-input:checked ~ .custom-control-label:before {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.custom-control-input:focus ~ .custom-control-label:before {
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb), 0.25);
}

/* Toolbar Styling Fixes */
.product-list-toolbar {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1rem;
}

.product-list-toolbar .row {
    align-items: center;
}

.product-list-toolbar .sort-by-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.product-list-toolbar .filter-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.product-list-toolbar .filter-select:focus {
    border-color: var(--theme-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb), 0.25);
}

.product-list-toolbar .list-detail small {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Additional Category Styling Fixes */
#categoryFacetFilters .d-flex {
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

#categoryFacetFilters .flex-grow-1 {
    flex-grow: 1;
    min-width: 0; /* Prevent text overflow issues */
}

#categoryFacetFilters .nav-arrow {
    flex-shrink: 0; /* Prevent chevron from shrinking */
    margin-left: 8px;
}

/* Ensure proper text color contrast */
#categoryFacetFilters li.active-category .badge {
    background-color: var(--theme-primary) !important;
    color: white !important;
}

/* Child category styling */
#categoryFacetFilters .subCategoryLink {
    transition: all 0.2s ease;
}

#categoryFacetFilters .subCategoryLink:hover {
    background-color: rgba(255,255,255,0.1) !important;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .company-sidebar-styling {
        margin: 0 10px;
        border-radius: 6px;
    }
    
    #categoryFacetFilters li,
    #brandFacetFilters li,
    #otherFacetFilters li {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* On mobile, sidebar should be full width */
    #listSidebar {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        flex: 1 !important;
    }
}

/* Filter section spacing */
.mb-2.company-sidebar-styling + .mb-2.company-sidebar-styling {
    margin-top: 1rem !important;
}

/* Clear button styling */
#catFiltTitle small[onclick],
#brandFiltTitle small[onclick],
#otherFiltTitle small[onclick] {
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

#catFiltTitle small[onclick]:hover,
#brandFiltTitle small[onclick]:hover,
#otherFiltTitle small[onclick]:hover {
    color: #2c5530 !important;
}

/* Loading state for filters */
.filters.loading {
    opacity: 0.6;
    pointer-events: none;
}

.filters.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--theme-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Search Sidebar Specific Styles */
#searchListSidebar {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    flex: 0 0 300px !important;
}

#searchCategoryFacetFilters,
#searchBrandFacetFilters {
    padding: 0.5rem 0;
}

#searchCategoryFacetFilters li.category-filter-item {
    margin-bottom: 0.25rem;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

#searchCategoryFacetFilters li.category-filter-item:hover {
    background-color: #f8f9fa !important;
    border-left: 3px solid var(--theme-primary);
}

#searchBrandFacetFilters .custom-control {
    display: flex;
    align-items: center;
    min-height: auto;
    padding-left: 0;
}

#searchBrandFacetFilters .custom-control-label {
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    margin-bottom: 0;
}

#searchBrandFacetFilters li {
    margin-bottom: 0.25rem;
}

/* Mobile filter toggle for search */
@media (max-width: 768px) {
    #searchListSidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1050;
        background: white;
        transition: left 0.3s ease;
        overflow-y: auto;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    #searchListSidebar.filters-open {
        left: 0;
    }

    #searchListSidebar .mobile-filter-close {
        display: block !important;
        padding: 1rem;
        background: var(--theme-primary);
        color: white;
        cursor: pointer;
        font-weight: 600;
        text-align: right;
    }
}

@media (min-width: 769px) {
    #searchListSidebar {
        position: relative;
        left: auto;
    }

    #searchListSidebar .mobile-filter-close {
        display: none !important;
    }
} 