import Link from "next/link";
import { MessageCircle } from "lucide-react";
import { localizedPath, type Locale } from "@alterra/shared";
import { whatsappUrl } from "@/lib/i18n";
import type { LayoutCopy } from "@/lib/site";

/** Every page ends here: private consultation first, WhatsApp second. */
export default function ClosingCta({ lang, copy, whatsappText }: { lang: Locale; copy: LayoutCopy; whatsappText?: string }) {
  const c = copy.cta;
  return (
    <section className="bg-forest text-cream">
      <div className="mx-auto flex max-w-7xl flex-col gap-10 px-5 py-20 md:px-8 md:py-28 lg:flex-row lg:items-end lg:justify-between">
        <div className="max-w-2xl">
          <p className="eyebrow text-gold-light">{c.eyebrow}</p>
          <h2 className="mt-5 font-serif text-4xl leading-[1.08] md:text-6xl">{c.title}</h2>
          <p className="mt-5 max-w-lg text-cream/70">{c.text}</p>
        </div>
        <div className="flex shrink-0 flex-col gap-4 whitespace-nowrap sm:flex-row lg:flex-col">
          <Link
            href={localizedPath(lang, "/contact")}
            className="bg-cream px-8 py-4 text-center text-[0.78rem] tracking-[0.16em] uppercase text-ink transition hover:bg-gold-light"
          >
            {c.primary}
          </Link>
          <a
            href={whatsappUrl(whatsappText)}
            target="_blank"
            rel="noopener"
            className="flex items-center justify-center gap-2 border border-cream/40 px-8 py-4 text-[0.78rem] tracking-[0.16em] uppercase transition hover:border-gold-light hover:text-gold-light"
          >
            <MessageCircle size={16} strokeWidth={1.5} /> {c.whatsapp}
          </a>
        </div>
      </div>
    </section>
  );
}
