"use client";

import { usePathname } from "next/navigation";
import Header from "@/components/Header";
import Footer from "@/components/Footer";
import CookieConsent from "@/components/CookieConsent";

export default function LayoutClient({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();

  // Ne pas afficher Header/Footer dans l'espace admin et employé
  const isAdminRoute = pathname?.startsWith("/admin");
  const isEmployeRoute = pathname?.startsWith("/employe");
  const isHomePage = pathname === "/";

  if (isAdminRoute || isEmployeRoute) {
    return <>{children}</>;
  }

  return (
    <>
      <Header />
      <main className={isHomePage ? "flex-1" : "flex-1 container mx-auto px-4 py-6 sm:px-6 lg:px-8"}>
        {children}
      </main>
      <Footer />
      <CookieConsent />
    </>
  );
}
