
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';

console.log("Nexus: Bootstraping application...");

const rootElement = document.getElementById('root');
if (!rootElement) {
  console.error("Nexus Error: Root element not found.");
} else {
  try {
    const root = ReactDOM.createRoot(rootElement);
    root.render(
      <React.StrictMode>
        <App />
      </React.StrictMode>
    );

    // Esconde o loader quando o React assume o controle
    const loader = document.getElementById('loader-fallback');
    if (loader) {
      loader.classList.add('hidden');
      console.log("Nexus: System ready.");
    }
  } catch (err) {
    console.error("Nexus Error during mount:", err);
    const loader = document.getElementById('loader-fallback');
    if (loader) loader.classList.add('hidden');
  }
}
