"use client";
import { useState } from "react";
import Link from "next/link";
import { Menu, Lock, Search } from "lucide-react";
import { Input } from "../ui/input";
import Image from "next/image";

const Navbar = () => {
  const [isOpen, setIsOpen] = useState(false);
  const toggleMenu = () => setIsOpen(!isOpen);

  return (
    <nav className="w-full bg-[#002B5A]">
      {/* Top Bar */}
      <div className=" max-w-7xl mx-auto text-white py-3 px-4 flex flex-col md:flex-row justify-between items-center gap-y-2">
        {/* Logo */}
        <div className="flex flex-row items-center gap-4">
          <div className="flex items-center gap-4">
            <Image
              src="/arah-negeri.png"
              alt="Logo"
              width={130}
              height={92}
              className="w-[130px] h-[92px]"
            />
          </div>

          {/* Search Box */}
          <div className="flex-grow w-full px-4 max-w-xl mx-auto">
            <div className="relative w-full max-w-md">
              <Input
                type="text"
                placeholder="Search..."
                className="pr-10 bg-white text-black rounded-sm w-full"
              />
              <Search className="absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500" />
            </div>
          </div>
        </div>

        {/* Date & Login */}
        <div className="flex items-center gap-4 text-sm whitespace-nowrap">
          <span className="text-[#B2C0CD]">Kamis, Maret 27, 2025</span>
          <div className="flex items-center gap-1 font-bold">
            <Lock className="w-4 h-4" />
            <Link href="/auth" className="font-medium hover:underline">
              Login
            </Link>
          </div>
        </div>
      </div>

      {/* Bottom Navigation */}
      <div className="bg-[#001c47] text-white px-4 py-2">
        <div className="flex items-center justify-between max-w-7xl mx-auto">
          {/* Kiri: Burger + Menu */}
          <div className="flex items-center gap-6">
            {/* Burger button (mobile only) */}
            <button onClick={toggleMenu} className="text-white ">
              <Menu className="h-6 w-6" />
            </button>

            {/* Nav Menu (hidden on mobile) */}
            <div className="hidden md:flex gap-6 font-semibold text-sm">
              <Link href="/" className="text-yellow-400">
                BERANDA
              </Link>
              <Link
                href="/category/citizen-news"
                className="hover:text-yellow-400"
              >
                BERITA WARGA
              </Link>
              <Link
                href="/category/development"
                className="hover:text-yellow-400"
              >
                PEMBANGUNAN
              </Link>
              <Link href="/category/health" className="hover:text-yellow-400">
                KESEHATAN
              </Link>
            </div>
          </div>

          {/* Kanan: Sosmed */}
          <div className="flex gap-4 text-white text-lg">
            <Link href="#" className="text-white">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="20"
                height="20"
                viewBox="0 0 24 24"
              >
                <path
                  fill="currentColor"
                  d="M7.91 20.889c8.302 0 12.845-6.885 12.845-12.845c0-.193 0-.387-.009-.58A9.2 9.2 0 0 0 23 5.121a9.2 9.2 0 0 1-2.597.713a4.54 4.54 0 0 0 1.99-2.5a9 9 0 0 1-2.87 1.091A4.5 4.5 0 0 0 16.23 3a4.52 4.52 0 0 0-4.516 4.516c0 .352.044.696.114 1.03a12.82 12.82 0 0 1-9.305-4.718a4.526 4.526 0 0 0 1.4 6.03a4.6 4.6 0 0 1-2.043-.563v.061a4.524 4.524 0 0 0 3.62 4.428a4.4 4.4 0 0 1-1.189.159q-.435 0-.845-.08a4.51 4.51 0 0 0 4.217 3.135a9.05 9.05 0 0 1-5.608 1.936A9 9 0 0 1 1 18.873a12.84 12.84 0 0 0 6.91 2.016"
                />
              </svg>
            </Link>
            <Link href="#" className="text-white">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="20"
                height="20"
                viewBox="0 0 24 24"
              >
                <path
                  fill="currentColor"
                  // fill-rule="evenodd"
                  d="M22.54 6.42a2.77 2.77 0 0 0-1.945-1.957C18.88 4 12 4 12 4s-6.88 0-8.595.463A2.77 2.77 0 0 0 1.46 6.42C1 8.148 1 11.75 1 11.75s0 3.602.46 5.33a2.77 2.77 0 0 0 1.945 1.958C5.121 19.5 12 19.5 12 19.5s6.88 0 8.595-.462a2.77 2.77 0 0 0 1.945-1.958c.46-1.726.46-5.33.46-5.33s0-3.602-.46-5.33M9.75 8.479v6.542l5.75-3.271z"
                  // clip-rule="evenodd"
                />
              </svg>
            </Link>
            <Link href="#" className="text-white">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="20"
                height="20"
                viewBox="0 0 24 24"
              >
                <path
                  fill="currentColor"
                  d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4z"
                />
              </svg>
            </Link>
            <Link href="#" className="text-white">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="20"
                height="20"
                viewBox="0 0 24 24"
              >
                <path
                  fill="currentColor"
                  d="M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4zm9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8A1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5a5 5 0 0 1-5 5a5 5 0 0 1-5-5a5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3"
                />
              </svg>
            </Link>
            <Link href="#" className="text-white">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="20"
                height="20"
                viewBox="0 0 24 24"
              >
                <path
                  fill="currentColor"
                  // fill-rule="evenodd"
                  d="M23.45 5.948c.166-.546 0-.948-.795-.948H20.03c-.668 0-.976.347-1.143.73c0 0-1.335 3.196-3.226 5.272c-.612.602-.89.793-1.224.793c-.167 0-.418-.191-.418-.738V5.948c0-.656-.184-.948-.74-.948H9.151c-.417 0-.668.304-.668.593c0 .621.946.765 1.043 2.513v3.798c0 .833-.153.984-.487.984c-.89 0-3.055-3.211-4.34-6.885C4.45 5.288 4.198 5 3.527 5H.9c-.75 0-.9.347-.9.73c0 .682.89 4.07 4.145 8.551C6.315 17.341 9.37 19 12.153 19c1.669 0 1.875-.368 1.875-1.003v-2.313c0-.737.158-.884.687-.884c.39 0 1.057.192 2.615 1.667C19.11 18.216 19.403 19 20.405 19h2.625c.75 0 1.126-.368.91-1.096c-.238-.724-1.088-1.775-2.215-3.022c-.612-.71-1.53-1.475-1.809-1.858c-.389-.491-.278-.71 0-1.147c0 0 3.2-4.426 3.533-5.929"
                  // clip-rule="evenodd"
                />
              </svg>
            </Link>
          </div>
        </div>
      </div>
    </nav>
  );
};

export default Navbar;
