const searchInput = document.getElementById("searchInput");
const helpCards = document.querySelectorAll(".help-card");
const noResultMsg = document.getElementById("noResult");

searchInput.addEventListener("input", (e) => {
  const query = e.target.value.toLowerCase().trim();
  let hasMatches = false;

  helpCards.forEach((card) => {
    const content = card.textContent.toLowerCase();

    if (content.includes(query)) {
      card.style.display = "flex";
      hasMatches = true;
    } else {
      card.style.display = "none";
    }
  });

  if (hasMatches) {
    noResultMsg.classList.add("hidden");
  } else {
    noResultMsg.classList.remove("hidden");
  }
});
