'use client'

import React, { useState } from 'react'
import { Sidebar, MobileSidebar, useSidebarActiveItem } from '@/components/layout/sidebar'
import { Header } from '@/components/layout/header'

export default function AdminLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const [mobileOpen, setMobileOpen] = useState(false)
  const activeItem = useSidebarActiveItem()

  return (
    <div className="min-h-screen bg-[#f5f6fa]">
      {/* Desktop Sidebar */}
      <Sidebar
        role="admin"
        activeItem={activeItem}
        userName="Admin"
      />

      {/* Mobile Sidebar */}
      <MobileSidebar
        role="admin"
        activeItem={activeItem}
        userName="Admin"
        open={mobileOpen}
        onOpenChange={setMobileOpen}
      />

      {/* Main Content Area */}
      <div className="lg:pl-[260px]">
        <Header
          title="Admin Panel"
          userName="Admin"
          onMenuClick={() => setMobileOpen(true)}
        />
        <main className="p-4 lg:p-6">
          {children}
        </main>
      </div>
    </div>
  )
}
