import "@fortawesome/fontawesome-free/css/all.min.css"; // local via npm (no CDN)

import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";

import "./styles/base.css";
import "./styles/layout.css";
import "./styles/topbar.css";
import "./styles/map.css";
import "./styles/posts.css";
import "./styles/theme.css";
import "./styles/auth-modal.css";
import "./styles/auth-toast.css";
import "./styles/filters.css";
import "./styles/mapMarkers.css";
import "./styles/maps.css"; // ✅ pour la barre de recherche (taille + couleurs)

import { AuthProvider } from "./auth/AuthContext.jsx";

// Import pour PWA install
import { promptInstall } from './pwaInstall';

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <AuthProvider>
      <App />
    </AuthProvider>
  </React.StrictMode>
);

// Enregistre le service worker pour PWA
if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {
    navigator.serviceWorker.register('/service-worker.js')
      .then(reg => console.log('Service Worker registered'))
      .catch(err => console.error('Service Worker failed:', err));
  });
}