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