import Link from "next/link";
import { LoginForm } from "./login-form";

export default async function LoginPage({
  searchParams,
}: {
  searchParams: Promise<{ redirect?: string; email?: string; password?: string }>;
}) {
  const { redirect, email, password } = await searchParams;
  return (
    <div className="reveal space-y-8" style={{ animationDelay: "80ms" }}>
      <div className="space-y-3">
        <span className="eyebrow text-brand-orange">Welcome back</span>
        <h2 className="font-display text-4xl font-light tracking-tight text-foreground">
          Sign in
        </h2>
        <p className="text-sm leading-relaxed text-muted-foreground">
          Continue guiding students to their dream destinations.
        </p>
      </div>

      <LoginForm redirectTo={redirect ?? "/dashboard"} defaultEmail={email} defaultPassword={password} />

      <div className="flex items-center justify-between border-t border-border/60 pt-5 text-sm">
        <Link
          href="/forgot-password"
          className="font-medium text-brand-blue transition-colors hover:text-brand-orange"
        >
          Forgot password?
        </Link>
        <Link
          href="/welcome"
          className="text-muted-foreground transition-colors hover:text-foreground"
        >
          About EduAdvise →
        </Link>
      </div>
    </div>
  );
}
