import React from 'react';
import ReactDOM from 'react-dom/client';
import { Toaster } from 'react-hot-toast';
import App from './App.jsx';

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <Toaster
      position="top-right"
      toastOptions={{
        duration: 3000,
        style: { fontFamily: 'Inter, sans-serif', fontSize: '14px' },
        success: { iconTheme: { primary: '#1dc4e9', secondary: '#fff' } },
        error: { iconTheme: { primary: '#ff5370', secondary: '#fff' } },
      }}
    />
    <App />
  </React.StrictMode>
);

// Activate Feather Icons after every React DOM update
if (typeof window !== 'undefined' && window.feather) {
  const observer = new MutationObserver(() => {
    try { window.feather.replace(); } catch {}
  });
  observer.observe(document.getElementById('root'), { subtree: true, childList: true });
}
