import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
import { Navbar } from "@/components/Navbar";
import { AdminTabs } from "@/components/AdminTabs";
import Link from "next/link";

export default async function AdminPage() {
  const session = await auth();
  if (!session) redirect("/login");

  return (
    <>
      <Navbar />

      <div className="border-b border-border bg-card py-4 sm:py-6">
        <div className="max-w-5xl mx-auto px-3 sm:px-6">
          <h1 className="text-xl sm:text-2xl font-bold tracking-tight">Admin Panel</h1>
          <p className="text-sm text-muted-foreground mt-1">
            Manage your Minecraft server
          </p>
        </div>
      </div>

      <main id="main" className="max-w-5xl mx-auto px-3 py-4 sm:p-6 w-full overflow-x-hidden">
        <AdminTabs />

        <div className="text-center mt-6">
          <Link
            href="/"
            className="text-sm text-muted-foreground hover:text-foreground transition"
          >
            Back to dashboard
          </Link>
        </div>
      </main>
    </>
  );
}
