"use client"

import { usePathname } from "next/navigation"
import { MobileNav } from "@/components/layout/mobile-nav"

/**
 * 应用外壳：C 端为移动端（窄屏 + 底部导航），管理后台 /admin 为纯 PC（全宽、无底部导航）
 */
export function AppShell({ children }: { children: React.ReactNode }) {
  const pathname = usePathname()
  const isAdmin = pathname?.startsWith("/admin")

  if (isAdmin) {
    return <>{children}</>
  }

  return (
    <>
      <main className="mx-auto w-full max-w-md min-h-screen bg-background relative shadow-2xl overflow-x-hidden overflow-y-auto pb-20">
        {children}
      </main>
      <MobileNav />
    </>
  )
}
