<!-- Restaurant Admin Dashboard Content -->
<div class="space-y-6">

    <!-- Welcome Banner -->
    <div class="rounded-2xl p-6 flex items-center justify-between" style="background: linear-gradient(135deg, #064e3b, #0d2137);">
        <div>
            <h2 class="text-2xl font-bold text-white mb-1">Welcome back, <?php echo htmlspecialchars($_SESSION['name']); ?> 🍽️</h2>
            <p style="color:#6ee7b7">Here's today's restaurant performance at a glance.</p>
        </div>
        <a href="/pos" class="flex-shrink-0 flex items-center gap-2 font-bold px-5 py-3 rounded-xl transition shadow-lg" style="background:linear-gradient(135deg,#10b981,#059669); color:white">
            <i class="fas fa-cash-register"></i> Open POS
        </a>
    </div>

    <!-- Stats -->
    <div class="grid grid-cols-2 lg:grid-cols-4 gap-4">
        <?php
        $cards = [
            ['label'=>"Today's Revenue",'value'=>$currency.number_format($stats['today_revenue'],2),'icon'=>'fa-dollar-sign','color'=>'#10b981','bg'=>'rgba(16,185,129,0.15)'],
            ['label'=>"Today's Orders",'value'=>number_format($stats['today_orders']),'icon'=>'fa-receipt','color'=>'#3b82f6','bg'=>'rgba(59,130,246,0.15)'],
            ['label'=>'Active Tables','value'=>number_format($stats['occupied_tables']),'icon'=>'fa-chair','color'=>'#f59e0b','bg'=>'rgba(245,158,11,0.15)'],
            ['label'=>'Staff Online','value'=>number_format($stats['active_sessions']),'icon'=>'fa-user-clock','color'=>'#a78bfa','bg'=>'rgba(167,139,250,0.15)'],
        ];
        foreach($cards as $card): ?>
        <div class="rounded-2xl p-5" style="background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08)">
            <div class="flex justify-between items-start mb-4">
                <p class="text-slate-400 text-sm font-medium"><?php echo $card['label']; ?></p>
                <div class="w-10 h-10 rounded-xl flex items-center justify-center" style="background:<?php echo $card['bg']; ?>">
                    <i class="fas <?php echo $card['icon']; ?>" style="color:<?php echo $card['color']; ?>"></i>
                </div>
            </div>
            <p class="text-3xl font-bold text-white"><?php echo $card['value']; ?></p>
        </div>
        <?php endforeach; ?>
    </div>

    <!-- Quick Actions -->
    <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
        <?php
        $actions = [
            ['icon'=>'fa-layer-group','label'=>'Floors & Tables','url'=>'/admin/floors','color'=>'#8b5cf6'],
            ['icon'=>'fa-hamburger','label'=>'Add Product','url'=>'/admin/products/create','color'=>'#10b981'],
            ['icon'=>'fa-users-cog','label'=>'Manage Staff','url'=>'/admin/staff','color'=>'#3b82f6'],
            ['icon'=>'fa-qrcode','label'=>'QR Codes','url'=>'/admin/qr','color'=>'#f59e0b'],
        ];
        foreach($actions as $a): ?>
        <a href="<?php echo $a['url']; ?>" class="rounded-2xl p-5 text-center hover:scale-105 transition-transform cursor-pointer" style="background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08)">
            <div class="w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3" style="background:<?php echo $a['color']; ?>22">
                <i class="fas <?php echo $a['icon']; ?> text-xl" style="color:<?php echo $a['color']; ?>"></i>
            </div>
            <p class="text-white text-sm font-medium"><?php echo $a['label']; ?></p>
        </a>
        <?php endforeach; ?>
    </div>

    <!-- Recent Orders -->
    <div class="rounded-2xl overflow-hidden" style="background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08)">
        <div class="px-6 py-4 border-b border-white/5">
            <h3 class="font-semibold text-white">Today's Recent Orders</h3>
        </div>
        <div class="overflow-x-auto">
            <table class="w-full text-sm">
                <thead><tr class="border-b border-white/5">
                    <th class="text-left px-6 py-3 text-slate-500 font-medium">Order#</th>
                    <th class="text-left px-6 py-3 text-slate-500 font-medium">Table/Type</th>
                    <th class="text-left px-6 py-3 text-slate-500 font-medium">Total</th>
                    <th class="text-left px-6 py-3 text-slate-500 font-medium">Payment</th>
                    <th class="text-left px-6 py-3 text-slate-500 font-medium">Time</th>
                </tr></thead>
                <tbody>
                    <?php if(empty($recent_orders)): ?>
                    <tr><td colspan="5" class="px-6 py-8 text-center text-slate-500">No orders today yet.</td></tr>
                    <?php endif; ?>
                    <?php foreach($recent_orders as $o): ?>
                    <tr class="border-b border-white/5 hover:bg-white/5 transition">
                        <td class="px-6 py-4 font-mono text-slate-300">#<?php echo $o['id']; ?></td>
                        <td class="px-6 py-4 text-slate-300"><?php echo $o['table_name'] ? 'Table '.$o['table_name'] : ucfirst($o['order_type']); ?></td>
                        <td class="px-6 py-4 font-semibold text-white"><?php echo $currency; ?><?php echo number_format($o['total'],2); ?></td>
                        <td class="px-6 py-4">
                            <?php $paid = $o['payment_status']==='paid'; ?>
                            <span class="px-2 py-1 rounded-full text-xs font-semibold" style="background:<?php echo $paid?'rgba(16,185,129,0.15)':'rgba(245,158,11,0.15)'; ?>; color:<?php echo $paid?'#6ee7b7':'#fcd34d'; ?>">
                                <?php echo ucfirst($o['payment_status']); ?>
                            </span>
                        </td>
                        <td class="px-6 py-4 text-slate-500"><?php echo date('h:i A', strtotime($o['created_at'])); ?></td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
