// App.tsx
import { Navigation } from "./components/Navigation";
import { Footer } from "./components/Footer";
import { CookieConsent } from "./components/CookieConsent";
import { AppRouter } from "./src/Router";
import { useLocation } from "react-router-dom";
import { useEffect } from "react";

// Smooth scroll to top function
const scrollToTop = () => {
  window.scrollTo({ top: 0, behavior: 'smooth' });
};

function App() {
  const location = useLocation();

  // Scroll to top on route change
  useEffect(() => {
    scrollToTop();
  }, [location.pathname]);

  return (
    <div className="min-h-screen bg-background">
      <Navigation />
      <main>
        <AppRouter />
      </main>
      <Footer />
      <CookieConsent />
    </div>
  );
}

export default App;