import { auth } from '@/lib/auth'

export default async function AdminDashboardPage() {
  const session = await auth()

  return (
    <div className="space-y-8 p-6 md:p-10 max-w-7xl mx-auto min-h-screen">
      <div className="flex flex-col gap-2">
        <h2 className="text-3xl font-bold tracking-tight text-foreground uppercase">Teras Yönetim Paneli</h2>
        <p className="text-muted-foreground text-lg">
          Hoş geldiniz, {session?.user?.name || session?.user?.email}. İşte restoranınızın genel görünümü.
        </p>
      </div>

      <div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
        {/* Placeholder Stat Cards */}
        {[
          { name: 'Bugünkü Rezervasyonlar', stat: '24', trend: '+4 dünden' },
          { name: 'Aktif Masalar', stat: '12 / 30', trend: '%40 Doluluk' },
          { name: 'Aylık Ziyaretçi', stat: '1,452', trend: '+%12 geçen aya göre' },
          { name: 'Stok: Dry Aged Et', stat: '45 porsiyon', trend: 'Kritik seviyeye yakın' },
        ].map((item) => (
          <div
            key={item.name}
            className="rounded-lg bg-card border border-border/50 p-6 shadow-sm hover:border-primary/30 transition-colors"
          >
            <dt className="truncate text-sm font-medium text-muted-foreground uppercase tracking-wider">{item.name}</dt>
            <dd className="mt-2 text-4xl font-bold tracking-tight text-primary">
              {item.stat}
            </dd>
            <p className="mt-2 text-xs text-muted-foreground">{item.trend}</p>
          </div>
        ))}
      </div>

      <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
        <div className="rounded-lg bg-card border border-border/50 shadow-sm">
          <div className="p-6 border-b border-border/50">
            <h3 className="text-lg font-bold text-foreground uppercase tracking-wider">Son Rezervasyon Talepleri</h3>
          </div>
          <div className="p-6">
            <div className="space-y-4">
              {[
                { name: 'Ahmet Yılmaz', time: 'Bu akşam 20:00', size: '4 Kişi', status: 'Onay Bekliyor' },
                { name: 'Ayşe Demir', time: 'Yarın 19:30', size: '2 Kişi', status: 'Onaylandı' },
                { name: 'Mehmet Kaya', time: '18 Haziran 21:00', size: '6 Kişi', status: 'Onaylandı' },
              ].map((req, i) => (
                <div key={i} className="flex justify-between items-center p-4 bg-background rounded border border-border/30">
                  <div>
                    <p className="font-bold text-foreground">{req.name}</p>
                    <p className="text-sm text-muted-foreground">{req.time} • {req.size}</p>
                  </div>
                  <span className={`text-xs px-2 py-1 rounded-full uppercase tracking-wider font-bold ${req.status === 'Onay Bekliyor' ? 'bg-secondary/20 text-secondary' : 'bg-green-500/20 text-green-500'}`}>
                    {req.status}
                  </span>
                </div>
              ))}
            </div>
          </div>
        </div>

        <div className="rounded-lg bg-card border border-border/50 shadow-sm">
          <div className="p-6 border-b border-border/50">
            <h3 className="text-lg font-bold text-foreground uppercase tracking-wider">Sistem & İletişim Bildirimleri</h3>
          </div>
          <div className="p-6">
            <div className="space-y-4">
              <div className="p-4 bg-background rounded border border-border/30">
                <p className="text-sm text-foreground"><strong>Yeni Mesaj:</strong> Müşteri memnuniyet anketi hakkında (Zeynep Ç.)</p>
                <p className="text-xs text-muted-foreground mt-1">2 saat önce</p>
              </div>
              <div className="p-4 bg-background rounded border border-border/30">
                <p className="text-sm text-foreground"><strong>Sistem Uyarı:</strong> Veritabanı yedeği başarıyla alındı.</p>
                <p className="text-xs text-muted-foreground mt-1">Dün 03:00</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
