"use client";

import { usePathname } from "next/navigation";
import Link from "next/link";
import { Activity, Brain, Clock } from "lucide-react";

const TABS = [
  { href: "/", label: "Pulse", icon: Activity, color: "#f59e0b" },
  { href: "/memory", label: "Memory", icon: Brain, color: "#38bdf8" },
  { href: "/history", label: "History", icon: Clock, color: "#22c55e" },
] as const;

export function BottomNav() {
  const pathname = usePathname();

  return (
    <nav
      className="fixed bottom-0 left-0 right-0 z-50 border-t border-white/[0.06]"
      style={{
        background: "rgba(10,10,15,0.92)",
        backdropFilter: "blur(20px)",
        WebkitBackdropFilter: "blur(20px)",
        paddingBottom: "var(--safe-bottom)",
      }}
    >
      <div className="flex justify-around items-center h-16 max-w-lg mx-auto">
        {TABS.map(({ href, label, icon: Icon, color }) => {
          const active =
            href === "/" ? pathname === "/" : pathname.startsWith(href);
          return (
            <Link
              key={href}
              href={href}
              className="flex flex-col items-center gap-1 px-6 py-2 transition-opacity"
              style={{ opacity: active ? 1 : 0.4 }}
            >
              <Icon size={22} style={{ color: active ? color : "#a1a1aa" }} />
              <span
                className="text-[10px] font-medium"
                style={{ color: active ? color : "#a1a1aa" }}
              >
                {label}
              </span>
            </Link>
          );
        })}
      </div>
    </nav>
  );
}
