jQuery(document).ready(function($) {
    // Initialize Ninja Forms Badge
    $('.nf-form-cont').each(function() {
        var formContainer = $(this);
        var formId = formContainer.attr('id') || 'ninja_form_' + Math.random();
        
        // Check if this form is protected
        var isProtected = false;
        if (typeof formshieldNinjaFormsData !== 'undefined' && formshieldNinjaFormsData.protectedForms) {
            isProtected = formshieldNinjaFormsData.protectedForms.indexOf(formId) !== -1;
        }
        
        if (isProtected) {
            // Add badge after the form
            var badgeHtml = formshieldNinjaFormsData.badge;
            if (badgeHtml) {
                formContainer.after(badgeHtml);
            }
        }
    });
});
