jQuery(document).ready(function($) {
        $(document).on('change', '.sifency-toggle-checkbox', function() {
        var $checkbox = $(this);
        var isChecked = $checkbox.is(':checked');
        
        var $widget = $checkbox.closest('.elementor-widget');
        
        var $container = $checkbox.closest('.sifency-toggle-container');
        if(isChecked) {
            $container.find('.text-monthly').removeClass('active');
            $container.find('.text-yearly').addClass('active');
        } else {
            $container.find('.text-yearly').removeClass('active');
            $container.find('.text-monthly').addClass('active');
        }

        $widget.find('.sifency-price-wrap').each(function() {
            var $wrap = $(this);
            var $amount = $wrap.find('.sifency-price-amount');
            var $period = $wrap.find('.sifency-price-period');
            
            var priceA  = $wrap.attr('data-price-a');
            var periodA = $wrap.attr('data-period-a');
            var priceB  = $wrap.attr('data-price-b');
            var periodB = $wrap.attr('data-period-b');
            
            $wrap.addClass('sifency-switching');
            
            setTimeout(function() {
                if (isChecked) {
                    $amount.html(priceB);
                    $period.html(periodB);
                } else {
                    $amount.html(priceA);
                    $period.html(periodA);
                }
                $wrap.removeClass('sifency-switching');
            }, 200);
        });
    });
});