document.getElementById("contact-form").addEventListener("submit", function (e) {
    e.preventDefault();

    // Get form values
    const name = document.getElementById("name").value;
    const email = document.getElementById("email").value;
    const message = document.getElementById("message").value;

    // Prepare parameters for EmailJS
    const params = {
        from_name: name,
        from_email: email,
        message: message,
    };

    // Send email using EmailJS
    emailjs.send("service_auuixzl", "template_9w001tg", params)
        .then(response => {
            document.getElementById("response-message").textContent =
                "Your message has been sent successfully!";
            document.getElementById("response-message").classList.remove("hidden");
            document.getElementById("contact-form").reset();
        })
        .catch(error => {
            document.getElementById("response-message").textContent =
                "There was an error sending your message. Please try again.";
            document.getElementById("response-message").classList.remove("hidden");
        });
});