import Link from "next/link";
import { AUTH_ROUTES } from "@/features/auth/constants";
import FormMessage from "@/components/form-message";
import SignupForm from "@/features/auth/components/signup-form";
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";

export default async function SignupPage({
  searchParams,
}: {
  searchParams: Promise<{ message: string }>;
}) {
  const { message } = await searchParams;

  return (
    <div className="relative z-10 w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-700">
      {/* 메시지 알림 */}
      <FormMessage message={message} />

      <Card className="border-white/20 bg-white/70 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-gray-900/70">
        <CardHeader className="space-y-3 text-center">
          <div className="mx-auto mb-2 flex h-16 w-16 items-center justify-center rounded-2xl bg-linear-to-br from-gray-800 to-black shadow-lg dark:from-white dark:to-gray-200">
            <span className="text-4xl">🚀</span>
          </div>
          <CardTitle className="text-3xl font-bold tracking-tight">
            회원가입
          </CardTitle>
          <CardDescription className="text-base">
            몇 가지 정보만 입력하면 바로 시작할 수 있습니다.
          </CardDescription>
        </CardHeader>

        {/* ========== 폼 영역 ========== */}
        <CardContent className="space-y-6">
          <SignupForm />

          {/* ========== 로그인 링크 ========== */}
          <p className="text-center text-sm text-gray-600 dark:text-gray-400">
            이미 계정이 있으신가요?{" "}
            <Link
              href={AUTH_ROUTES.LOGIN}
              className="font-semibold text-gray-900 transition-colors hover:text-black dark:text-gray-100 dark:hover:text-white"
            >
              로그인 하러 가기
            </Link>
          </p>
        </CardContent>
      </Card>
    </div>
  );
}
