<?php $__env->startSection('title', 'Dashboard'); ?>
<?php $__env->startSection('page-title', 'Dashboard'); ?>

<?php $__env->startSection('content'); ?>
<div class="space-y-6">
    <?php if(($panelUnreadNotificationCount ?? 0) > 0): ?>
        <div class="admin-panel-card border border-amber-200 bg-amber-50/90 p-4">
            <div class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
                <div class="flex items-start gap-3">
                    <span class="inline-flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-2xl bg-amber-100 text-amber-600">
                        <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V4a2 2 0 10-4 0v1.341C7.67 6.165 6 8.389 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0a3 3 0 11-6 0m6 0H9"/>
                        </svg>
                    </span>
                    <div>
                        <p class="text-sm font-semibold text-amber-900">You have <?php echo e($panelUnreadNotificationCount); ?> unread notification<?php echo e($panelUnreadNotificationCount > 1 ? 's' : ''); ?></p>
                        <p class="mt-1 text-sm text-amber-700">New lead, blog review, and workflow updates are waiting for your attention.</p>
                    </div>
                </div>
                <a href="<?php echo e(route('notifications.index')); ?>" class="inline-flex items-center justify-center rounded-full bg-gray-900 px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-black">
                    View All Notifications
                </a>
            </div>
        </div>
    <?php endif; ?>

    <div class="admin-panel-card p-6 text-white" style="background: linear-gradient(135deg, var(--admin-primary), var(--admin-sidebar));">
        <h2 class="text-2xl font-bold">Welcome back, <?php echo e($user->name); ?></h2>
        <p class="text-sm mt-1" style="color: color-mix(in srgb, #ffffff 84%, var(--admin-primary));">
            Centralized control for content, leads, team, and operations.
        </p>
    </div>

    <div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4">
        <?php
            $stats = [
                ['label' => 'Total Leads', 'value' => $total_leads, 'icon' => 'L'],
                ['label' => 'Countries', 'value' => $total_countries, 'icon' => 'C'],
                ['label' => 'Leads Today', 'value' => $new_leads_today, 'icon' => 'T'],
                ['label' => 'Team Members', 'value' => $team_members, 'icon' => 'M'],
            ];
        ?>
        <?php $__currentLoopData = $stats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="admin-panel-card p-5">
                <div class="flex items-center justify-between">
                    <span class="text-sm text-gray-500"><?php echo e($stat['label']); ?></span>
                    <span class="inline-flex items-center justify-center w-8 h-8 rounded-lg text-xs font-bold text-white" style="background: var(--admin-primary);"><?php echo e($stat['icon']); ?></span>
                </div>
                <p class="text-3xl font-black text-gray-900 mt-3"><?php echo e($stat['value']); ?></p>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>

    <div class="admin-panel-card p-6">
        <h3 class="text-base font-semibold text-gray-800 mb-4">Quick Actions</h3>
        <div class="grid grid-cols-2 md:grid-cols-4 gap-3">
            <a href="<?php echo e(route('admin.countries.create')); ?>" class="rounded-lg border border-gray-200 px-4 py-3 text-sm font-semibold hover:bg-gray-50">Add Country</a>
            <a href="<?php echo e(route('admin.events.create')); ?>" class="rounded-lg border border-gray-200 px-4 py-3 text-sm font-semibold hover:bg-gray-50">Add Event</a>
            <a href="<?php echo e(route('admin.leads.index')); ?>" class="rounded-lg border border-gray-200 px-4 py-3 text-sm font-semibold hover:bg-gray-50">Manage Leads</a>
            <a href="<?php echo e(route('admin.settings.general.edit')); ?>" class="rounded-lg border border-gray-200 px-4 py-3 text-sm font-semibold hover:bg-gray-50">General Settings</a>
        </div>
    </div>

    <div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
        <div class="admin-panel-card p-6">
            <div class="flex items-center justify-between mb-4">
                <h3 class="text-base font-semibold text-gray-800">Notifications</h3>
                <span class="text-xs text-gray-500">Unread: <?php echo e($unread_notifications); ?></span>
            </div>

            <?php if($notifications->isEmpty()): ?>
                <p class="text-sm text-gray-400">No notifications yet.</p>
            <?php else: ?>
                <div class="space-y-3">
                    <?php $__currentLoopData = $notifications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $notification): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="rounded-lg border <?php echo e($notification->read_at ? 'border-gray-100 bg-gray-50' : 'border-blue-200 bg-blue-50/40'); ?> p-3">
                            <p class="text-sm font-semibold text-gray-800"><?php echo e($notification->title); ?></p>
                            <p class="text-sm text-gray-600 mt-1"><?php echo e($notification->message); ?></p>
                            <p class="text-xs text-gray-400 mt-1"><?php echo e($notification->created_at->diffForHumans()); ?></p>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            <?php endif; ?>
        </div>

        <div class="admin-panel-card p-6">
            <h3 class="text-base font-semibold text-gray-800 mb-4">Activity Logs</h3>
            <?php if($activity_logs->isEmpty()): ?>
                <p class="text-sm text-gray-400">No logs yet.</p>
            <?php else: ?>
                <div class="space-y-3">
                    <?php $__currentLoopData = $activity_logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $badge = match($log->email_status) {
                                'sent' => 'bg-green-100 text-green-700',
                                'simulated' => 'bg-cyan-100 text-cyan-700',
                                'partial' => 'bg-yellow-100 text-yellow-700',
                                'failed' => 'bg-red-100 text-red-700',
                                default => 'bg-gray-100 text-gray-600',
                            };
                        ?>
                        <div class="rounded-lg border border-gray-100 p-3">
                            <p class="text-sm font-semibold text-gray-800"><?php echo e($log->message); ?></p>
                            <p class="text-xs text-gray-500 mt-1"><?php echo e($log->created_at->format('d M Y, h:i A')); ?></p>
                            <span class="inline-flex items-center mt-2 px-2.5 py-1 rounded-full text-xs font-semibold <?php echo e($badge); ?>">Email: <?php echo e(ucfirst($log->email_status)); ?></span>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\gps-migration\resources\views\admin\dashboard.blade.php ENDPATH**/ ?>