        themeToggle.classList.remove("rotate-180");
        }, 300);
      });

      // Listen for OS theme changes
      window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
        if (!localStorage.theme) {
          // Only auto-switch if user hasn't set a preference
          setTheme(e.matches);
        }
      });

      // Form submission
      document.getElementById("loginForm").addEventListener("submit", async function (e) {
        e.preventDefault();

        c