import Link from "next/link";
import BrandLogo from "@/components/brand-logo";
import ResetPasswordForm from "./reset-password-form";

export default async function ResetPasswordPage({
  searchParams,
}: {
  searchParams: Promise<{ token?: string }>;
}) {
  const { token } = await searchParams;

  return (
    <div className="min-h-screen flex flex-col items-center justify-center bg-bg px-4 py-12">
      <Link href="/" className="mb-8 inline-flex" aria-label="VibePass Tickets — home">
        <BrandLogo size="md" showTagline />
      </Link>

      <div className="w-full max-w-sm rounded-2xl border border-line bg-panel p-8 shadow-2xl shadow-black/40">
        <h1 className="text-xl font-semibold text-ink mb-1">Choose a new password</h1>
        {token ? (
          <ResetPasswordForm token={token} />
        ) : (
          <>
            <p className="text-sm text-muted mb-6">This reset link is incomplete. Request a new one.</p>
            <Link href="/forgot-password" className="text-sm text-brand-green-h hover:underline">
              Request a new link
            </Link>
          </>
        )}
      </div>
    </div>
  );
}
