"use client";

import { useLogin } from "@/hooks/useLogin";
import { LoginHeader } from "@/components/auth/LoginHeader";
import { LoginForm } from "@/components/auth/LoginForm";
import { LoginFooter } from "@/components/auth/LoginFooter";

/**
 * 로그인 페이지 컴포넌트
 * 비즈니스 로직은 useLogin 훅에서 처리하고, UI 컴포넌트들을 조합하여 구성
 */
export default function LoginPage() {
  const {
    formData,
    isLoading,
    error,
    showPassword,
    isPopMode,
    handleInputChange,
    handleLogin,
    togglePasswordVisibility,
    togglePopMode,
  } = useLogin();

  return (
    <div className="flex min-h-screen items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100 p-4">
      <div className="w-full max-w-md space-y-8">
        <LoginHeader />

        <LoginForm
          formData={formData}
          isLoading={isLoading}
          error={error}
          showPassword={showPassword}
          isPopMode={isPopMode}
          onInputChange={handleInputChange}
          onSubmit={handleLogin}
          onTogglePassword={togglePasswordVisibility}
          onTogglePop={togglePopMode}
        />

        <LoginFooter />
      </div>
    </div>
  );
}
