import { useLocation } from 'react-router-dom'
import Header from './Header'
import Footer from './Footer'
import { useAuth } from '../context/AuthContext'

export default function Layout({ children }) {
  const { user } = useAuth()
  const { pathname } = useLocation()
  const darkGate = pathname === '/login' || (pathname === '/dashboard' && !user)

  return (
    <div className={`min-h-screen text-brand-900 ${darkGate ? 'bg-black' : 'bg-[#fcfbf8]'}`}>
      <Header />
      <main>{children}</main>
      {!darkGate && <Footer />}
    </div>
  )
}
