import type { Metadata } from "next";
import Script from "next/script";

import "./globals.css";
import { SiteFrame } from "@/components/site-frame";

export const metadata: Metadata = {
  title: "Operativita di sala",
  description: "Cabina di regia per prenotazioni, tavoli, piantina e WhatsApp del locale"
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="it" suppressHydrationWarning>
      <body className="font-body text-ink">
        <Script id="powerup-theme-init" strategy="beforeInteractive">
          {`
            (function () {
              try {
                var theme = localStorage.getItem("powerup.ui.theme") === "light" ? "light" : "dark";
                document.documentElement.setAttribute("data-theme", theme);
                document.documentElement.style.colorScheme = theme;
              } catch (error) {
                document.documentElement.setAttribute("data-theme", "dark");
                document.documentElement.style.colorScheme = "dark";
              }
            })();
          `}
        </Script>
        <SiteFrame>{children}</SiteFrame>
      </body>
    </html>
  );
}
