upText.innerHTML = null;
                chatMessages.innerHTML = null;

                conversationContext.value = null;

                const chatForm = document.getElementById('chatForm');
                chatForm.reset();
            }, 300); // 300ms matches animation duration
         }

    function openModal() {
        const overlay = document.getElementById('overlay');
        const modal = document.getElementById('popupModal');

        // Reset animations before displaying
        modal.style.