/ Apply closing animations
            modal.style.animation = 'slideOutToRight 0.3s ease-out forwards';
            overlay.style.animation = 'fadeOut 0.3s ease-out forwards';

            // Wait for animation to complete before hiding
            setTimeout(() => {
                modal.style.display = 'none';
                overlay.style.display = 'none';
                document.body.style.overflow = 'auto'; // Restore scrolling
            }, 300); // Match animation duration
        }
    };


    f