import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { getOptionalSession } from "@/app/lib/dal";
import LoginForm from "./LoginForm";

export const metadata: Metadata = {
  title: "Admin Login",
};

export default async function AdminLoginPage() {
  const session = await getOptionalSession();
  if (session) {
    redirect("/admin");
  }

  return (
    <div className="min-h-screen bg-[#f4f7ff] flex items-center justify-center p-4">
      <div className="w-full max-w-md rounded-3xl border border-[#d9e2f7] bg-white p-6 sm:p-8 shadow-[0_16px_40px_rgba(31,63,184,0.08)]">
        <p className="text-xs font-semibold uppercase tracking-[0.18em] text-[#1f3fb8]">
          Vido International Home School
        </p>
        <div className="mt-6">
          <LoginForm />
        </div>
      </div>
    </div>
  );
}
