import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from './App';
import { Toaster } from './components/ui/sonner';
import { AuthProvider } from './hooks/useAuth';
import { ThemeProvider } from './contexts/ThemeContext';
import { MotionPreferenceProvider } from './contexts/MotionPreferenceContext';
import 'sonner/dist/styles.css';
import './index.css';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <ThemeProvider>
      <MotionPreferenceProvider>
        <BrowserRouter>
          <AuthProvider>
            <App />
          </AuthProvider>

          {/* Global shadcn/Sonner toast system */}
          <Toaster />
        </BrowserRouter>
      </MotionPreferenceProvider>
    </ThemeProvider>
  </React.StrictMode>
);
