import { e as createComponent, l as renderHead, k as renderComponent, r as renderTemplate } from '../../chunks/astro/server_DePCulMI.mjs';
import 'piccolore';
/* empty css                                     */
import { jsx, jsxs } from 'react/jsx-runtime';
import { useState } from 'react';
import { A as AuthProvider, u as useAuth } from '../../chunks/AdminAuth_CWvmd3cU.mjs';
export { renderers } from '../../renderers.mjs';

function LoginFormInner() {
  const { login } = useAuth();
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [error, setError] = useState("");
  const [loading, setLoading] = useState(false);
  const handleSubmit = async (e) => {
    e.preventDefault();
    setError("");
    setLoading(true);
    const ok = await login(email, password);
    setLoading(false);
    if (ok) window.location.href = "/admin";
    else setError("Ongeldige inloggegevens");
  };
  return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-[#0A0A0A] flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-sm", children: [
    /* @__PURE__ */ jsxs("div", { className: "text-center mb-8", children: [
      /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-[#F5F5F5] mb-1", children: "🔒 SneakerPicks" }),
      /* @__PURE__ */ jsx("p", { className: "text-sm text-[#999]", children: "Admin Panel" })
    ] }),
    /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "bg-[#141414] border border-[#333] rounded-xl p-6 space-y-4", children: [
      error && /* @__PURE__ */ jsx("div", { className: "bg-[#FF3B3B]/10 text-[#FF3B3B] text-sm px-4 py-2 rounded-lg", children: error }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("label", { className: "block text-sm text-[#999] mb-1.5", children: "Email / Username" }),
        /* @__PURE__ */ jsx(
          "input",
          {
            type: "text",
            value: email,
            onChange: (e) => setEmail(e.target.value),
            className: "w-full bg-[#0A0A0A] border border-[#333] rounded-lg px-4 py-2.5 text-[#F5F5F5] focus:outline-none focus:border-[#00FF6A] transition-colors",
            placeholder: "admin",
            autoFocus: true
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("label", { className: "block text-sm text-[#999] mb-1.5", children: "Password" }),
        /* @__PURE__ */ jsx(
          "input",
          {
            type: "password",
            value: password,
            onChange: (e) => setPassword(e.target.value),
            className: "w-full bg-[#0A0A0A] border border-[#333] rounded-lg px-4 py-2.5 text-[#F5F5F5] focus:outline-none focus:border-[#00FF6A] transition-colors",
            placeholder: "••••••••"
          }
        )
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          type: "submit",
          disabled: loading,
          className: "w-full bg-[#00FF6A] text-[#0A0A0A] font-semibold py-2.5 rounded-lg hover:bg-[#00CC55] transition-colors disabled:opacity-50",
          children: loading ? "Bezig..." : "Inloggen"
        }
      )
    ] })
  ] }) });
}
function LoginForm() {
  return /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(LoginFormInner, {}) });
}

const $$Login = createComponent(($$result, $$props, $$slots) => {
  return renderTemplate`<html lang="nl" class="dark"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Login — SneakerPicks Admin</title>${renderHead()}</head> <body class="min-h-screen bg-[#0A0A0A] text-[#F5F5F5]"> ${renderComponent($$result, "LoginForm", LoginForm, { "client:load": true, "client:component-hydration": "load", "client:component-path": "C:/Users/Roel/clawd/sneakerpicks/src/components/admin/LoginForm", "client:component-export": "default" })} </body></html>`;
}, "C:/Users/Roel/clawd/sneakerpicks/src/pages/admin/login.astro", void 0);

const $$file = "C:/Users/Roel/clawd/sneakerpicks/src/pages/admin/login.astro";
const $$url = "/admin/login";

const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  default: $$Login,
  file: $$file,
  url: $$url
}, Symbol.toStringTag, { value: 'Module' }));

const page = () => _page;

export { page };
