import { getTranslations } from "next-intl/server";
import { Link } from "@/i18n/navigation";
import { restaurant } from "@/content/restaurant";
import { dayHoursLabel } from "@/lib/hours";

export async function Footer() {
  const t = await getTranslations("footer");
  const tVisit = await getTranslations("visit");

  return (
    <footer className="border-t border-brass/15 bg-ink px-6 py-16 text-sm text-ivory-dim">
      <div className="mx-auto grid max-w-6xl gap-10 md:grid-cols-3">
        <div>
          <p className="font-serif text-2xl italic text-ivory">La Tavola Italiana</p>
          <p className="mt-3">{restaurant.address.street}</p>
          <p>{restaurant.address.postalCode} {restaurant.address.city}, {restaurant.address.country}</p>
          <p className="mt-3">
            <a href={`tel:${restaurant.phone.replace(/\s/g, "")}`} className="hover:text-ivory">{restaurant.phone}</a>
          </p>
          <p>
            <a href={`mailto:${restaurant.email}`} className="hover:text-ivory">{restaurant.email}</a>
          </p>
        </div>

        <div>
          <p className="eyebrow text-brass">{tVisit("hours")}</p>
          <ul className="mt-3 space-y-1.5">
            {restaurant.hours.map((h) => (
              <li key={h.day} className="flex flex-col gap-0.5 lg:flex-row lg:justify-between lg:gap-6">
                <span className="capitalize">{h.day}</span>
                <span className="whitespace-nowrap tabular-nums">{dayHoursLabel(h)}</span>
              </li>
            ))}
          </ul>
        </div>

        <div>
          <p className="eyebrow text-brass">{t("legal")}</p>
          <ul className="mt-3 space-y-1">
            <li><Link href="/privacy" className="hover:text-ivory">{t("privacy")}</Link></li>
            <li><Link href="/cookies" className="hover:text-ivory">{t("cookies")}</Link></li>
            <li><Link href="/terms" className="hover:text-ivory">{t("terms")}</Link></li>
          </ul>
          <p className="mt-4 text-ivory-dim/70">{t("vat")}: {restaurant.vatNumber}</p>
          <p className="text-ivory-dim/70">{restaurant.legalName}</p>
        </div>
      </div>

      <p className="mx-auto mt-12 max-w-6xl border-t border-ivory/10 pt-6 text-xs text-ivory-dim/60">
        © {new Date().getFullYear()} La Tavola Italiana. {t("rights")}
      </p>
    </footer>
  );
}
