function toggleSelect(element) {
  // Single selection logic
  const allOptions = document.querySelectorAll(".option-card-figma");
  const errorMsg = document.getElementById("purpose-error");

  allOptions.forEach((opt) => opt.classList.remove("selected"));

  element.classList.add("selected");

  if (errorMsg) {
    errorMsg.style.display = "none";
    errorMsg.classList.add("hidden");
  }
}

document.addEventListener("DOMContentLoaded", () => {
  const continueBtn = document.getElementById("continueBtn");
  const errorMsg = document.getElementById("purpose-error");

  if (continueBtn) {
    continueBtn.addEventListener("click", () => {
      const isSelected = document.querySelector(".option-card-figma.selected");

      if (!isSelected) {
        errorMsg.style.display = "block";
        errorMsg.classList.remove("hidden");
      } else {
        window.location.href = "./home-page.html";
      }
    });
  }
});
