/**
 * 应用外壳组件 — 统一页面布局结构
 * 包含 PageHeader 区域 + 内容区域，配合 SidebarNav 和 TopNav 使用
 */
import { ReactNode } from 'react'
import clsx from 'clsx'

interface AppShellProps {
  children: ReactNode
  className?: string
}

/**
 * 应用外壳 — 限制内容最大宽度，统一内边距
 */
export function AppShell({ children, className }: AppShellProps) {
  return (
    <div className={clsx('w-full max-w-content mx-auto px-4 md:px-6', className)}>
      {children}
    </div>
  )
}

interface PageHeaderProps {
  title: string
  description?: string
  actions?: ReactNode
  status?: ReactNode
  className?: string
}

/**
 * 页面头部 — 统一标题、说明、状态和操作按钮区域
 */
export function PageHeader({ title, description, actions, status, className }: PageHeaderProps) {
  return (
    <div className={clsx('flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4', className)}>
      <div className="min-w-0 flex-1">
        <div className="flex items-center gap-2">
          <h1 className="text-xl font-semibold text-ink-900 truncate">{title}</h1>
          {status}
        </div>
        {description && (
          <p className="text-sm text-ink-600 mt-0.5">{description}</p>
        )}
      </div>
      {actions && (
        <div className="flex items-center gap-2 shrink-0">
          {actions}
        </div>
      )}
    </div>
  )
}
