jQuery(document).ready(function($) {
    // Add badges to Gravity Forms
    $('.gform_wrapper').each(function() {
        var formContainer = $(this);
        var formId = formContainer.attr('id') || 'gravity_form_' + Math.random();
        
        // Check if this form is protected
        var isProtected = false;
        if (typeof formshieldGravityData !== 'undefined' && formshieldGravityData.protectedForms) {
            isProtected = formshieldGravityData.protectedForms.indexOf(formId) !== -1;
        }
        
        if (isProtected) {
            // Add badge after the form
            var badgeHtml = formshieldGravityData.badge;
            if (badgeHtml) {
                formContainer.after(badgeHtml);
            }
        }
    });
});
