import {StrictMode} from 'react';
// --- Main Entry Point ---
// Bootstraps the React application and mounts it to the DOM.
import {createRoot} from 'react-dom/client';
import App from './App.tsx';
import './index.css';

// Override window.alert and window.confirm to prevent iframe blocking issues
window.alert = (message) => {
  console.log('ALERT:', message);
  // Create a simple toast notification
  const toast = document.createElement('div');
  toast.textContent = message;
  toast.style.position = 'fixed';
  toast.style.bottom = '20px';
  toast.style.right = '20px';
  toast.style.backgroundColor = '#333';
  toast.style.color = '#fff';
  toast.style.padding = '12px 24px';
  toast.style.borderRadius = '8px';
  toast.style.zIndex = '9999';
  toast.style.boxShadow = '0 4px 6px rgba(0,0,0,0.1)';
  toast.style.fontFamily = 'Inter, sans-serif';
  toast.style.fontSize = '14px';
  toast.style.transition = 'opacity 0.3s ease-in-out';
  document.body.appendChild(toast);
  
  setTimeout(() => {
    toast.style.opacity = '0';
    setTimeout(() => document.body.removeChild(toast), 300);
  }, 3000);
};

window.confirm = (message) => {
  console.log('CONFIRM (auto-accepted):', message);
  // In an iframe, synchronous confirm is blocked. We auto-accept for now.
  // A proper fix would require refactoring all confirm() calls to be asynchronous.
  return true;
};

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <App />
  </StrictMode>,
);
