/* Container styles */
body.woocommerce.archive .bsc-filters-container,
body.woocommerce-page.archive .bsc-filters-container {
    position: relative !important;
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
    margin-bottom: 20px !important;
}

/* Toggle Button */
body.woocommerce.archive .bsc-filter-toggle,
body.woocommerce-page.archive .bsc-filter-toggle {
    background: transparent !important;
    color: #333 !important;
    border: none !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    margin-left: auto !important;
    position: relative !important;
    z-index: 100 !important;
    transition: opacity 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Hover effect */
body.woocommerce.archive .bsc-filter-toggle:hover,
body.woocommerce-page.archive .bsc-filter-toggle:hover {
    opacity: 0.7 !important;
}

/* Sidebar */
.bsc-filter-sidebar {
    position: fixed;
    top: 0;
    right: -35vw;
    background: #fff;
    padding: 20px;
    border-left: 1px solid #eee;
    height: 100vh;
    width: 35vw;
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    overflow-y: auto;
}

.bsc-filter-sidebar.active {
    right: 0;
}

/* Header styles */
.bsc-filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.bsc-filter-sidebar-header h3 {
    font-size: 1.2em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.bsc-close-filters {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    color: #333;
}

/* Filter Group styles */
.bsc-filter-group {
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); /* Subtle separator */
    padding-bottom: 8px;
}

.bsc-filter-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 16px;
    cursor: pointer;
    gap: 6px;
    padding: 4px 0;
}

.bsc-filter-header h4 {
    font-size: 0.875em;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
    color: #1a1a1a;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Caret styling */
.bsc-filter-toggle-icon {
    content: "∨";
    color: #1a1a1a; /* Match text color */
    font-size: 0.7em; /* Smaller size for refinement */
    transition: transform 0.2s ease;
    position: relative;
    top: 0px;
    margin-left: 2px;
    font-weight: 300;
    opacity: 0.8; /* Subtle transparency */
}

/* Rotate caret when expanded */
.bsc-filter-group.active .bsc-filter-toggle-icon {
    transform: rotate(180deg);
}

/* Filter Options styles */
.bsc-filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.bsc-filter-group.active .bsc-filter-options {
    max-height: 500px;
    margin-bottom: 16px;
}

/* Filter option labels */
.bsc-filter-label {
    font-size: 0.875em;
    font-weight: 400;
    color: #1a1a1a;
    transition: color 0.2s ease;
    letter-spacing: 0.02em;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.bsc-filter-option:hover .bsc-filter-label {
    opacity: 0.7;
}

/* Checkbox styles */
.bsc-filter-option {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.9em;
    color: #333;
    transition: color 0.2s ease;
}

.bsc-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Remove the visible checkbox */
.bsc-checkmark {
    display: none;
}

/* Add checkmark when checked */
.bsc-filter-option input:checked ~ .bsc-filter-label::after {
    content: "✓";
    margin-left: 8px;
    font-size: 14px;
    color: #333;
}

/* Overlay */
.bsc-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bsc-filter-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Ensure sidebar is above overlay */
.bsc-filter-sidebar {
    z-index: 1000;
}

/* Prevent body scroll when sidebar is open */
body.filter-sidebar-open {
    overflow: hidden;
    padding-right: 15px; /* Prevent layout shift when scrollbar disappears */
}

/* Product Grid Fixes */
.products.columns-4 {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    max-width: 1200px !important; /* Add max-width for better control */
    margin: 0 auto !important; /* Center the grid */
}

.products li.product {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Product Count and Pagination Styles */
.woocommerce-result-count {
    margin: 0 0 20px !important;
    padding: 0 !important;
    color: #666 !important;
    font-size: 0.9em !important;
}

.ct-pagination {
    margin-top: 40px !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
}

.ct-pagination .page-numbers {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 35px !important;
    height: 35px !important;
    padding: 0 5px !important;
    border: 1px solid #ddd !important;
    color: #666 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.ct-pagination .page-numbers.current {
    background-color: #333 !important;
    color: #fff !important;
    border-color: #333 !important;
}

.ct-pagination .page-numbers:hover:not(.current) {
    background-color: #f5f5f5 !important;
    border-color: #999 !important;
    color: #333 !important;
}

.ct-pagination .dots {
    border: none !important;
}

/* Responsive Grid - Updated breakpoints */
@media (max-width: 1200px) {
    .products.columns-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

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

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

.bsc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.bsc-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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