const clicks = document.getElementById("click");

clicks.addEventListener("click", () => {
    document.body.classList.toggle("dark-mode");

    if(document.body.classList.contains("dark-mode")){
        clicks.textContent = "☀️ Light Mode";
    } else {
        clicks.textContent = "🌙 Dark Mode";
    }
});

const menuBtn = document.getElementById("menu-btn");
const navMenu = document.querySelector(".Navlist");

menuBtn.addEventListener("click", () => {
    navMenu.classList.toggle("active");

    menuBtn.classList.toggle("fa-bars");
    menuBtn.classList.toggle("fa-times");
});


const contactForm = document.getElementById("contact");
const Psg = document.getElementById("Psg");
const Meni = document.getElementById("Meni");
const emai = document.getElementById("emai");
const textPlace = document.getElementById("textPlace");

contactForm.addEventListener("submit", function (e) {
    e.preventDefault();

    let name = document.getElementById("name").value.trim();
    let email = document.getElementById("email").value.trim();
    let message = document.getElementById("message").value.trim();

    // Clear previous messages
    Psg.textContent = "";
    emai.textContent = "";
    textPlace.textContent = "";
    Meni.textContent = "";

    if (name === "" || email === "" || message === "") {
        Meni.textContent = "Please fill in all fields.";
        Meni.style.color = "red";
        return;
    }

    if (name.length < 8) {
        Psg.textContent = "Name must be at least 8 characters.";
        Psg.style.color = "red";
        return;
    }

    if (email.length < 13) {
        emai.textContent = "Email must be at least 13 characters.";
        emai.style.color = "red";
        return;
    }

    if (message.length < 20) {
        textPlace.textContent = "Message must be at least 20 characters.";
        textPlace.style.color = "red";
        return;
    }

    Meni.textContent = "Message Sent Successfully!";
    Meni.style.color = "lightgreen";

    contactForm.reset();
});