import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { App } from './App'
import { I18nProvider, type Locale } from './i18n'
import './styles.css'

// Default to the browser's Arabic preference; backend-configured locale can override later.
const initial: Locale = navigator.language?.startsWith('ar') ? 'ar' : 'en'

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <I18nProvider initial={initial}>
      <App />
    </I18nProvider>
  </StrictMode>,
)
