```javascript
import { Outlet } from 'react-router-dom'
import Navbar from './Navbar'
import Sidebar from './Sidebar'
import { useAuth } from '../hooks/useAuth'
import MobileNav from './MobileNav'

export default function Layout() {
  const { user } = useAuth()

  return (
    <div className="min-h-screen flex flex-col">
      <Navbar />
      <div className="flex flex-1">
        {user && <Sidebar />}
        <main className="flex-1 p-4 md:p-6">
          <Outlet />
        </main>
        {user && (
          <div className="hidden lg:block w-72 p-4 border-l dark:border-gray-800">
            <div className="sticky top-20">
              {/* Trending topics or other sidebar content */}
            </div>
          </div>
        )}
      </div>
      {user && <MobileNav />}
    </div>
  )
}
```