import type { Metadata } from 'next';
import './globals.css';

export const metadata: Metadata = {
  title: 'Convert UI - File Conversion in Your Browser',
  description: 'Convert videos, images, and documents directly in your browser using WebAssembly. No uploads, complete privacy.',
  keywords: ['file conversion', 'video converter', 'image converter', 'document converter', 'ffmpeg', 'imagemagick', 'pandoc', 'wasm'],
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en" suppressHydrationWarning>
      <head>
        <script
          dangerouslySetInnerHTML={{
            __html: `
              (function() {
                try {
                  const theme = localStorage.getItem('theme');
                  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
                  const shouldBeDark = theme === 'dark' || (!theme && prefersDark);
                  if (shouldBeDark) {
                    document.documentElement.classList.add('dark');
                  }
                } catch (e) {}
              })();
            `,
          }}
        />
      </head>
      <body className="min-h-screen antialiased">
        {children}
      </body>
    </html>
  );
}
