import type { Metadata } from "next";
import "./globals.css";
import { AuthProvider } from "@/lib/AuthContext";
import BottomNav from "@/components/BottomNav";
import PWARegister from "@/components/PWARegister";

export const viewport = {
  width: "device-width",
  initialScale: 1,
  viewportFit: "cover",
  themeColor: "#0a0a0f",
};

export const metadata: Metadata = {
  title: "Falah — Islamic Lifestyle",
  description: "Nur AI coaching, Halal marketplace, community & wallet",
  appleWebApp: { capable: true, statusBarStyle: "black-translucent" },
  manifest: "/mobile/manifest.json",
  icons: {
    icon: [
      { url: "/mobile/icons/icon-48x48.png", sizes: "48x48", type: "image/png" },
      { url: "/mobile/icons/icon-72x72.png", sizes: "72x72", type: "image/png" },
      { url: "/mobile/icons/icon-96x96.png", sizes: "96x96", type: "image/png" },
      { url: "/mobile/icons/icon-128x128.png", sizes: "128x128", type: "image/png" },
      { url: "/mobile/icons/icon-144x144.png", sizes: "144x144", type: "image/png" },
      { url: "/mobile/icons/icon-152x152.png", sizes: "152x152", type: "image/png" },
      { url: "/mobile/icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
      { url: "/mobile/icons/icon-384x384.png", sizes: "384x384", type: "image/png" },
      { url: "/mobile/icons/icon-512x512.png", sizes: "512x512", type: "image/png" },
    ],
    apple: [
      { url: "/mobile/apple-touch-icon.png", sizes: "152x152", type: "image/png" },
    ],
    shortcut: [{ url: "/mobile/icons/icon-48x48.png", type: "image/png" }],
  },
  other: {
    "apple-mobile-web-app-title": "Falah",
  },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en" className="dark">
      <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=1, user-scalable=no" />
        <meta name="theme-color" content="#0a0a0f" />
        <meta name="mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
        <meta name="application-name" content="Falah" />
        <link rel="manifest" href="/mobile/manifest.json" />
      </head>
      <body>
        <PWARegister />
        <AuthProvider>
          <div className="mobile-container relative min-h-dvh">
            <main className="pb-4">{children}</main>
          </div>
          <BottomNav />
        </AuthProvider>
      </body>
    </html>
  );
}
