jQuery(document).ready(function ($) {
    $('.filter-btn').on('click', function () {
        var category = $(this).data('category');

        $('.filter-btn').removeClass('active');
        $(this).addClass('active');

        $.ajax({
            url: ajax_filter.ajax_url,
            type: 'POST',
            data: {
                action: 'filter_featured_products',
                category: category,
                limit: 4
            },
            beforeSend: function () {
                $('#featured-products-list').html('<p>Loading...</p>');
            },
            success: function (response) {
                $('#featured-products-list').html(response);
            }
        });
    });
});
