"use client";

import Link from "next/link";
import { CalendarClock, Flame, Utensils } from "lucide-react";
import { usePathname } from "next/navigation";
import { siteConfig } from "@/config/site";
import { BookingTrigger } from "./booking-modal";

export function MobileActionBar() {
  const pathname = usePathname();
  if (pathname.startsWith("/checkout") || pathname.startsWith("/payment")) return null;

  return (
    <nav className="fixed inset-x-0 bottom-0 z-40 border-t border-white/10 bg-kiln-black/94 px-3 pb-[calc(8px+env(safe-area-inset-bottom))] pt-2 backdrop-blur md:hidden" aria-label="Быстрые действия">
      <div className="grid grid-cols-3 gap-2">
        <Link href="/menu" className="button button-secondary min-h-12 flex-col gap-1 px-2 py-2 text-xs">
          <Utensils size={18} />
          Меню
        </Link>
        {siteConfig.features.bookingEnabled ? (
          <BookingTrigger className="button button-primary min-h-12 flex-col gap-1 px-2 py-2 text-xs">
            <CalendarClock size={18} />
            Бронь
          </BookingTrigger>
        ) : null}
        {siteConfig.features.deliveryEnabled ? (
          <Link href="/delivery" className="button button-secondary min-h-12 flex-col gap-1 px-2 py-2 text-xs">
            <Flame size={18} />
            Доставка
          </Link>
        ) : null}
      </div>
    </nav>
  );
}
