/* Main Wrapper */
.apf-main-wrapper {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

.apf-sidebar {
    flex: 0 0 280px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.apf-content {
    flex: 1;
}

.apf-filter-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.apf-filter-section h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.apf-checkbox-label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.apf-checkbox-label input {
    margin-right: 8px;
}

/* ========== PRICE RANGE SLIDER - FIXED ========== */
.apf-price-filter {
    padding: 10px 0;
}

.apf-price-sliders {
    position: relative;
    height: 30px;
    margin: 20px 0 30px;
}

/* Style both range inputs */
#apf-price-min,
#apf-price-max {
    position: absolute;
    top: 12px;
    left: 0;
    width: 100%;
    height: 4px;
    margin: 0;
    padding: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

/* Track styling */
#apf-price-min::-webkit-slider-runnable-track,
#apf-price-max::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    pointer-events: none;
}

#apf-price-min::-moz-range-track,
#apf-price-max::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
}

/* Thumb (handle) styling - this is what you click */
#apf-price-min::-webkit-slider-thumb,
#apf-price-max::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    margin-top: -7px;
    position: relative;
    z-index: 2;
}

#apf-price-min::-moz-range-thumb,
#apf-price-max::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Hover effect */
#apf-price-min::-webkit-slider-thumb:hover,
#apf-price-max::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #0056b3;
}

/* Focus styles */
#apf-price-min:focus,
#apf-price-max:focus {
    outline: none;
}

/* Layer the sliders - min on top, max below */
#apf-price-min {
    z-index: 3;
}

#apf-price-max {
    z-index: 2;
}

/* Background track line */
.apf-price-sliders::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    z-index: 1;
}

/* Colored range between min and max handles */
.apf-price-sliders::after {
    content: '';
    position: absolute;
    top: 12px;
    height: 4px;
    background: #007bff;
    border-radius: 2px;
    z-index: 1;
    pointer-events: none;
}

/* Price display - side by side */
.apf-price-display {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 15px;
}

.apf-price-display span {
    flex: 1;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

.apf-price-display span:first-child {
    color: #28a745;
}

.apf-price-display span:last-child {
    color: #dc3545;
}

/* ========== END PRICE RANGE SLIDER ========== */

.apf-reset-btn {
    width: 100%;
    padding: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.apf-reset-btn:hover {
    background: #c82333;
}

.apf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 15px;
}

.apf-sorting-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.apf-view-toggle {
    display: flex;
    gap: 10px;
}

.apf-view-btn {
    padding: 6px 15px;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 4px;
}

.apf-view-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.apf-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.apf-products-grid.list-view {
    display: flex;
    flex-direction: column;
}

.apf-products-grid.list-view .apf-product-item {
    display: flex;
    align-items: center;
    gap: 20px;
}

.apf-products-grid.list-view .apf-product-item img {
    width: 150px;
}

.apf-product-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: transform 0.2s;
}

.apf-product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.apf-product-item img {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.apf-product-item h3 {
    font-size: 16px;
    margin: 10px 0;
}

.apf-product-item .price {
    color: #28a745;
    font-weight: bold;
    display: block;
    margin: 10px 0;
}

.apf-add-to-cart {
    display: inline-block;
    padding: 8px 15px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.apf-add-to-cart:hover {
    background: #0056b3;
    color: white;
}

.apf-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.apf-page-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 4px;
}

.apf-page-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.apf-loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #666;
}

/* Subcategories styling */
.apf-subcategories {
    margin-left: 25px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.apf-subcategory {
    font-size: 13px;
    color: #666;
}

/* Badge styles */
span.apf-badge.apf-badge-new {
    display: block;
    border: 1px solid #14870e;
    padding: 3px 12px;
    font-weight: 500;
    font-size: 10px;
    border-radius: 5px;
    position: absolute;
    color: #14870e;
}

/* Rating stars */
.apf-product-item .star-rating {
    float: none;
    display: block;
    margin: 10px auto;
    text-align: center;
    position: relative;
    width: 80px;
}

.apf-product-item .star-rating:before {
    text-align: center;
    left: 0;
    right: 0;
    margin: 0 auto;
}

.apf-product-item .star-rating span {
    text-align: center;
    left: 0;
    right: 0;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .apf-main-wrapper {
        flex-direction: column;
    }
    
    .apf-sidebar {
        position: static;
        flex: auto;
    }
    
    .apf-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .apf-toolbar-right {
        justify-content: space-between;
    }
    
    .apf-price-display {
        flex-direction: column;
        gap: 8px;
    }
}