import type React from "react"
import type { Metadata } from "next"
import { Inter } from "next/font/google"
import "./globals.css"
import { Toaster } from "react-hot-toast"
import { AuthProvider } from "@/context/auth-context"
import { Navbar } from "@/components/ui/navbar"
import { ThemeProvider } from "@/components/theme-provider"
import { AccountStatusGuard } from "@/components/account-status-guard"

const inter = Inter({ subsets: ["latin"] })

export const metadata: Metadata = {
  title: "OpenLearnX - Comprehensive Learning Dashboard",
  description: "AI-powered adaptive learning with blockchain integration, real-time analytics, and professional progress tracking.",
  keywords: "learning, coding, blockchain, AI, analytics, professional development",
  generator: 'OpenLearnX v2.0'
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body className={inter.className}>
        <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
          <AuthProvider>
            <div className="min-h-screen bg-background text-foreground">
              <Navbar />
              <AccountStatusGuard />
              <main className="transition-all duration-300">{children}</main>
              <Toaster 
                position="top-right" 
                toastOptions={{
                  duration: 4000,
                  style: {
                    background: 'rgba(17, 24, 39, 0.95)',
                    color: '#fff',
                    backdropFilter: 'blur(16px)',
                    border: '1px solid rgba(75, 85, 99, 0.3)',
                  },
                }}
              />
            </div>
          </AuthProvider>
        </ThemeProvider>
      </body>
    </html>
  )
}
