import React from 'react';
import {
  BrowserRouter as Router,
  Routes,
  Route,
  useLocation,
} from 'react-router-dom';
import Navbar from './components/Navbar';
import Footer from './components/Footer';

import CursorEffect from './components/CursorEffect';

import Home from './pages/Home';
import AboutUs from './pages/AboutUs';
import Products from './pages/Products';
import LinerBags from './pages/LinerBags';

import Description from './pages/LinerBags/Description';
import Technologies from './pages/LinerBags/Technologies';
import HowItWorks from './pages/LinerBags/HowItWorks';
import Effect from './pages/LinerBags/Effect';

import SanjayaFreshKeeperBio from './pages/LinerBags/SanjayaFreshKeeperBio';
import Career from './pages/Career';
import Blog from './pages/Blog';
import Export from './pages/Export';
import Leadership from './pages/Leadership';
import ContactUs from './pages/ContactUs';
import Certificates from './pages/certificate';
import TestReports from './pages/TestReports';

import IntendedUse from './pages/IntendedUse';
import TermsOfWebsite from './pages/TermsOfWebsite';
import TermsOfSale from './pages/TermsOfSale';
// import PrivacyPolicy from './pages/PrivacyPolicy';
import ProductDetailPage from './pages/ProductDetailPage.jsx';
import ManagementTeam from './pages/ManagementTeam';
import Careers from './pages/Careers';

function AppContent() {
  const location = useLocation();
  const isHomePage = location.pathname === '/';

  return (
    <>
      <CursorEffect />
      <Navbar />

      <main className={`container ${!isHomePage ? 'page-content' : ''}`}>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/about-us" element={<AboutUs />} />
          <Route path="/products" element={<Products />} />
          <Route path="/liner-bags" element={<LinerBags />} />

          <Route
            path="/liner-bags/sanjaya-fresh-keeper/description"
            element={<Description />}
          />
          <Route
            path="/liner-bags/sanjaya-fresh-keeper/technologies"
            element={<Technologies />}
          />
          <Route
            path="/liner-bags/sanjaya-fresh-keeper/how-it-works"
            element={<HowItWorks />}
          />
          <Route
            path="/liner-bags/sanjaya-fresh-keeper/effect"
            element={<Effect />}
          />
          <Route
            path="/liner-bags/sanjaya-fresh-keeper-bio"
            element={<SanjayaFreshKeeperBio />}
          />
          <Route path="/career" element={<Career />} />
          <Route path="/blog" element={<Blog />} />
          <Route path="/export" element={<Export />} />
          <Route path="/leadership" element={<Leadership />} />
          <Route path="/contact-us" element={<ContactUs />} />
          <Route path="/certificate" element={<Certificates />} />
          <Route path="/test-reports" element={<TestReports />} />
          <Route path="/intended-use" element={<IntendedUse />} />
          <Route path="/website-terms" element={<TermsOfWebsite />} />
          <Route path="/terms-of-sale" element={<TermsOfSale />} />
          {/* <Route path="/privacy-policy" element={<PrivacyPolicy />} /> */}
          <Route path="/product/:productName" element={<ProductDetailPage />} />
          <Route path="/management-team" element={<ManagementTeam />} />
          <Route path="/careers" element={<Careers />} />
        </Routes>
      </main>

      <Footer className={isHomePage ? 'hero-footer' : ''} />
    </>
  );
}

export default function App() {
  return (
    <Router>
      <AppContent />
    </Router>
  );
}
