#cpf-filter-container {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
}

#cpf-filter-container h3,
#cpf-filter-container h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

.cpf-filter-group {
    margin-bottom: 25px;
}

/* --- Price Range Slider (Unchanged) --- */
.price_slider_wrapper { position: relative; width: 100%; }
#price_slider { margin: 10px 5px 10px 5px; }
#price_slider .ui-slider-handle { height: 1.2em; width: 1.2em; border-radius: 50%; background: #247de8; border: 2px solid #fff; box-shadow: 0 0 5px rgba(0,0,0,0.2); cursor: pointer; top: -0.5em; }
#price_slider .ui-slider-range { background: #247de8; }
.price_slider_amount .price_label { font-size: 1em; font-weight: bold; margin-bottom: 15px; }
.price_slider_amount .price_inputs { display: flex; justify-content: space-between;gap: 10px }
.price_slider_amount .price_inputs input { min-width: 50%; padding: 5px 8px; font-size: 0.9em; }
.clear { clear: both; }

/* Category List - CUSTOM CHECKBOXES */
.cpf-category-list { list-style: none; margin: 0; padding: 10px; max-height: 300px; overflow-y: auto; border: 1px solid #e0e0e0; }
.cpf-category-list li { margin-bottom: 8px; }

/* Hide the default checkbox */
.cpf-category-list input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.cpf-category-list label {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    font-size: 14px;
}
.cpf-category-list label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #aaa;
    background: #fff;
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
/* This is the checkmark, created with borders */
.cpf-category-list label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease;
}
/* Show the checkmark when the SIBLING input is checked */
.cpf-category-list input[type="checkbox"]:checked + label::before {
    background: #247de8;
    border-color: #247de8;
}
.cpf-category-list input[type="checkbox"]:checked + label::after {
    opacity: 1;
}

/* --- Star Rating Radio Buttons - CUSTOM RADIO BUTTONS --- */
.cpf-rating-filter .cpf-rating-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* Hide the default radio button */
.cpf-rating-filter input[type="radio"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cpf-rating-filter label {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    min-height: 20px;
}

/* Create the custom radio button circle */
.cpf-rating-filter label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #aaa;
    border-radius: 50%;
    background: #fff;
    transition: all 0.2s ease;
}

/* Create the inner checked circle */
.cpf-rating-filter label::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #247de8;
    opacity: 0;
    transition: all 0.2s ease;
}

/* Change style when checked (with higher specificity) */
#cpf-filter-container .cpf-rating-filter input[type="radio"]:checked + label::before {
    border-color: #247de8;
}

/* Show the inner dot when checked (with higher specificity) */
#cpf-filter-container .cpf-rating-filter input[type="radio"]:checked + label::after {
    opacity: 1;
}

/* Add a focus style for accessibility */
#cpf-filter-container .cpf-rating-filter input[type="radio"]:focus + label::before {
    box-shadow: 0 0 0 2px rgba(36, 125, 232, 0.6);
}

/* Star styles (Unchanged) */
.cpf-rating-filter .star-rating-label { font-size: 1.3em; color: #ffd700; letter-spacing: 2px; }
.cpf-rating-filter .star-rating-label .star-empty { color: #ccc; }

/* Add these styles to the end of your assets/css/style.css file */

/* --- Filter Buttons Container --- */
.cpf-filter-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px; /* Adds space between buttons */
}

/* --- Main "Apply Filters" Button --- */
.cpf-button {
    background-color: #ee2b3b;
    color: #fff;
    border: none;
    padding: 5px 15px 8px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    flex-grow: 1;
    transition: background-color 0.2s ease;
    line-height: 1.8rem;
}

.cpf-button:hover {
    background-color: #1a6ac4;
}

/* --- "Reset" Link --- */
.cpf-button-reset {
    color: #555;
    font-size: 0.9em;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 5px;
}

.cpf-button-reset:hover {
    color: #c00;
}



/*
 * ===================================================================
 *  DEFINITIVE Collapsible Filter Styles (Mobile-First)
 * ===================================================================
 */

/* --- Default Mobile Styles --- */

#cpf-filter-container .cpf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hide the "Filter Products" title on mobile */
#cpf-filter-container .cpf-header h3 {
    display: none;
}

/* Show and style the toggle button on mobile */
.cpf-mobile-toggle {
    display: flex;
    width: 100%;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    align-items: center;
    gap: 8px;
}

.cpf-toggle-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #333;
    transition: transform 0.3s ease;
}

/* Hide the content by default on mobile */
.cpf-content-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

/* Show the content when the filter is open */
#cpf-filter-container.filter-open .cpf-content-wrapper {
    max-height: 2000px;
    padding-top: 20px; /* Add space between button and content when open */
}

/* Flip the icon when open */
#cpf-filter-container.filter-open .cpf-toggle-icon {
    transform: rotate(180deg);
}


/* --- Desktop Styles (screens 768px and wider) --- */
@media (min-width: 768px) {

    /* Forcefully hide the mobile toggle button on desktop */
    .cpf-mobile-toggle {
        display: none !important;
    }

    /* Show the "Filter Products" title on desktop */
    #cpf-filter-container .cpf-header h3 {
        display: block;
    }

    /* Ensure the filter content is always visible on desktop */
    .cpf-content-wrapper {
        max-height: none;
        overflow: visible;
        padding-top: 0;
    }

    /* Adjust header margin for desktop layout */
    #cpf-filter-container .cpf-header {
        margin-bottom: 20px;
    }
}