document.addEventListener("DOMContentLoaded", () => {
    const tabs = document.querySelectorAll(".auth-tab");
    const panelLogin = document.getElementById("authPanelLogin");
    const panelRegister = document.getElementById("authPanelRegister");

    if (!tabs.length || !panelLogin || !panelRegister) return;

    tabs.forEach(tab => {
        tab.addEventListener("click", () => {
            const target = tab.getAttribute("data-tab"); // "login" oder "register"

            // Tab-Styles
            tabs.forEach(t => {
                t.classList.remove("bg-brand-primary", "text-brand-bg");
                t.classList.add("hover:text-brand-primary");
            });
            tab.classList.add("bg-brand-primary", "text-brand-bg");
            tab.classList.remove("hover:text-brand-primary");

            // Panels
            if (target === "login") {
                panelLogin.classList.remove("hidden");
                panelRegister.classList.add("hidden");
            } else {
                panelRegister.classList.remove("hidden");
                panelLogin.classList.add("hidden");
            }
        });
    });
});
