/**
 * Enhanced Admin Notice JavaScript
 * Handles the enhanced admin notice interactions
 */

jQuery(document).ready(function($) {
    // Handle dismiss functionality for admin notices
    $('.mgadin-notice .btnend').on('click', function(e) {
        e.preventDefault();
        
        // Fade out the notice
        $(this).closest('.mgadin-notice').fadeOut(300, function() {
            // Use existing dismiss method
            var currentUrl = window.location.href;
            var separator = currentUrl.indexOf('?') > -1 ? '&' : '?';
            window.location.href = currentUrl + separator + 'xbnotice=1';
        });
    });
    
    // Handle WordPress default notice dismiss
    $('.mgadin-notice.is-dismissible .notice-dismiss').on('click', function(e) {
        e.preventDefault();
        
        // Fade out the notice
        $(this).closest('.mgadin-notice').fadeOut(300, function() {
            // Use existing dismiss method
            var currentUrl = window.location.href;
            var separator = currentUrl.indexOf('?') > -1 ? '&' : '?';
            window.location.href = currentUrl + separator + 'xbnotice=1';
        });
    });
    
    // Add hover effects for buttons
    $('.ai-blog-enhanced-notice .button').hover(
        function() {
            $(this).addClass('button-hover');
        },
        function() {
            $(this).removeClass('button-hover');
        }
    );
    
    // Add smooth animations for notice elements
    $('.ai-blog-enhanced-notice').addClass('ai-blog-notice-loaded');
});
