"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";

const LINKS = [
  { href: "/admin", label: "Dashboard" },
  { href: "/admin/pins", label: "Result PINs" },
  { href: "/admin/news", label: "News" },
];

export default function AdminLayout({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
  return (
    <div className="mx-auto max-w-7xl px-4 py-10 grid lg:grid-cols-[220px_1fr] gap-8">
      <aside className="space-y-1">
        <h2 className="font-bold text-[var(--brand-blue)] mb-4">Admin Dashboard</h2>
        {LINKS.map((l) => (
          <Link
            key={l.href}
            href={l.href}
            className={`block rounded-md px-3 py-2 text-sm font-medium ${
              pathname === l.href ? "bg-[var(--brand-magenta)] text-white" : "hover:bg-[var(--brand-bg-light)]"
            }`}
          >
            {l.label}
          </Link>
        ))}
      </aside>
      <div>{children}</div>
    </div>
  );
}
