import { LoginForm } from "@/features/auth/login-form";
import { verifySession } from "@/core/security/session";
import { redirect } from "@/i18n/routing";
import { getLocale } from "next-intl/server";

export default async function LoginPage() {
  const session = await verifySession();
  const locale = await getLocale();

  // If already logged in, redirect to dashboard
  if (session) {
    redirect({ href: "/admin/dashboard", locale });
  }

  return (
    <div className="min-h-screen flex items-center justify-center relative p-6 bg-muted/30">
      <div className="absolute inset-0 grid-pattern opacity-20" />
      
      <div className="relative z-10 w-full">
        <LoginForm />
      </div>
    </div>
  );
}
