import Link from "next/link";
import { getCurrentUser } from "@/lib/auth";
import { NavbarMenu } from "./NavbarMenu";

export async function Navbar() {
  const user = await getCurrentUser();

  return (
    <nav className="sticky top-0 z-50 backdrop-blur-md bg-white/80 border-b-2 border-border">
      <div className="max-w-[1080px] mx-auto px-4 sm:px-6 h-14 sm:h-16 flex items-center justify-between">
        <Link href="/" className="flex items-center gap-2 sm:gap-3">
          <div className="w-8 h-8 sm:w-9 sm:h-9 rounded-xl bg-accent flex items-center justify-center shadow-card">
            <span className="text-accent-on font-bold text-xs sm:text-sm">OL</span>
          </div>
          <span className="font-display text-base sm:text-lg font-bold text-fg">Order Loop</span>
        </Link>

        {user && <NavbarMenu email={user.email} />}
      </div>
    </nav>
  );
}
