import { redirect } from "next/navigation";
import { isAdminUiEnabled } from "@/lib/server/admin-auth";
import { PublicPageHeader, PublicSurface } from "@/components/public-surface";

export default function SignInPage() {
  if (!isAdminUiEnabled()) {
    redirect("/");
  }

  return (
    <div className="px-4 py-8 md:py-12">
      <div className="mx-auto flex min-h-[calc(100dvh-7rem)] max-w-3xl items-start justify-center md:items-center">
        <div className="w-full max-w-xl space-y-8">
          <PublicPageHeader
            align="center"
            eyebrow="Customer Flow"
            title="Admin Sign-In"
            description="This area is reserved for Rocky Mountain Vending admins."
          />

          <PublicSurface className="p-6 text-center md:p-8">
            <h2 className="text-2xl font-semibold">Admin sign-in is not configured</h2>
            <p className="mt-3 text-sm text-muted-foreground">
              Enable the admin UI and connect an auth provider before using this area.
            </p>
          </PublicSurface>
        </div>
      </div>
    </div>
  );
}
