import { getDictionary } from "@/lib/dictionaries";
import ContactForm from "@/components/sections/ContactForm";
import { localeAlternates } from "@/lib/seo";
import type { Metadata } from "next";

export async function generateMetadata({
  params,
}: {
  params: Promise<{ locale: string }>;
}): Promise<Metadata> {
  const { locale } = await params;
  const isSR = locale === "sr";
  return {
    title: isSR ? "Kontakt" : "Contact",
    description: isSR
      ? "Kontaktirajte me za vaš sljedeći projekat."
      : "Get in touch about your next project.",
    alternates: localeAlternates(locale, "/contact"),
  };
}

export default async function ContactPage({
  params,
}: {
  params: Promise<{ locale: string }>;
}) {
  const { locale } = await params;
  const dict = getDictionary(locale);
  const t = dict.contactPage;

  return (
    <>
      {/* Hero */}
      <section className="relative isolate flex min-h-[40svh] items-center overflow-hidden pt-32">
        <div className="pointer-events-none absolute inset-0 grid-bg [mask-image:radial-gradient(ellipse_at_center,#000_30%,transparent_70%)] opacity-30" />

        <div className="relative mx-auto w-full max-w-7xl px-6 lg:px-8">
          <div className="mx-auto max-w-3xl text-center">
            <span className="mb-6 inline-flex items-center gap-2 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-3.5 py-1.5 font-mono text-xs tracking-tight text-emerald-300 backdrop-blur-md">
              <span className="relative flex h-1.5 w-1.5">
                <span className="absolute inset-0 animate-ping rounded-full bg-emerald-400 opacity-75" />
                <span className="relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-400" />
              </span>
              {t.badge}
            </span>

            <h1 className="font-display text-display-xl font-medium tracking-tight">
              <span className="text-gradient-fade">{t.title}</span>
              <br />
              <span className="text-gradient-purple">{t.titleAccent}</span>
            </h1>

            <p className="mx-auto mt-6 max-w-2xl text-base leading-relaxed text-text-secondary sm:text-lg">
              {t.subtitle}
            </p>
          </div>
        </div>
      </section>

      {/* Form section */}
      <section className="relative w-full pb-24 pt-12 sm:pb-32">
        <div className="relative mx-auto w-full max-w-7xl px-6 lg:px-8">
          <ContactForm dict={dict} />
        </div>
      </section>
    </>
  );
}
