import { useEffect } from "react";
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
import Navbar from "./components/Navbar";
import Footer from "./components/Footer";
import Home from "./pages/Home";
import About from "./pages/About";
import Contact from "./pages/Contact";
import ServicesInspection from "./pages/ServicesInspection";
import ServicesConventional from "./pages/ServicesConventional";
import ServicesAdvanced from "./pages/ServicesAdvanced";
import ServicesAssetIntegrity from "./pages/ServicesAssetIntegrity";
import ServicesManpower from "./pages/ServicesManpower";
import Industries from "./pages/Industries";
import Projects from "./pages/Projects";
import Gallery from "./pages/Gallery";
import NotFound from "./pages/NotFound";
function ScrollToTop() {
  const { pathname } = useLocation();
  useEffect(() => {
    window.scrollTo({ top: 0, behavior: "instant" });
  }, [pathname]);
  return null;
}
export default function App() {
  return <BrowserRouter>
      <ScrollToTop />
      <div className="flex flex-col min-h-screen bg-slate-50 font-sans antialiased text-slate-950">
        <Navbar />
        <main className="grow">
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="/about" element={<About />} />
            <Route path="/contact" element={<Contact />} />
            
            {
    /* Service sub-divisions */
  }
            <Route path="/services/inspection" element={<ServicesInspection />} />
            <Route path="/services/conventional-ndt" element={<ServicesConventional />} />
            <Route path="/services/advanced-ndt" element={<ServicesAdvanced />} />
            <Route path="/services/asset-integrity" element={<ServicesAssetIntegrity />} />
            <Route path="/services/manpower" element={<ServicesManpower />} />
            
            {
    /* Extra core links */
  }
            <Route path="/industries" element={<Industries />} />
            <Route path="/projects" element={<Projects />} />
            <Route path="/gallery" element={<Gallery />} />
            
            {
    /* Fallback 404 */
  }
            <Route path="*" element={<NotFound />} />
          </Routes>
        </main>
        <Footer />
      </div>
    </BrowserRouter>;
}
