import type { Metadata } from "next";
import { Inter, Merriweather } from "next/font/google";
import "./globals.css";
import { OfflineIndicator } from "../components/features/common";
import { InstallPrompt } from "../components/features/pwa/install-prompt";
import { ThemeProvider } from "@/components/theme-provider";

const inter = Inter({
  variable: "--font-inter",
  subsets: ["latin"],
});

const merriweather = Merriweather({
  variable: "--font-merriweather",
  subsets: ["latin"],
  weight: ["300", "400", "700", "900"],
  display: "swap",
});

export const metadata: Metadata = {
  title: "Test01 - Local-First Venting",
  description: "Transform your struggles into personal branding content with AI-powered journaling",
  // Story 3.4: PWA metadata
  manifest: "/manifest.webmanifest", // Next.js 14+ convention
  themeColor: "#64748B",
  appleWebApp: {
    capable: true,
    statusBarStyle: "default",
    title: "Test01",
  },
  icons: {
    icon: [
      { url: "/icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
      { url: "/icons/icon-512x512.png", sizes: "512x512", type: "image/png" },
    ],
    apple: [
      { url: "/icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
    ],
  },
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body
        className={`${inter.variable} ${merriweather.variable} font-sans antialiased`}
      >
        <ThemeProvider
          attribute="class"
          defaultTheme="system"
          enableSystem
          disableTransitionOnChange
        >
          {children}
          <OfflineIndicator />
          <InstallPrompt />
        </ThemeProvider>
      </body>
    </html>
  );
}
