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

<?php $__env->startSection('content'); ?>


<div class="grid grid-cols-1 sm:grid-cols-3 gap-5 mb-6">

    
    <div class="bg-gradient-to-br from-green-500 to-green-600 rounded-2xl p-5 text-white shadow-md flex items-center gap-4">
        <div class="text-4xl">🟢</div>
        <div>
            <div class="text-3xl font-black"><?php echo e($stats['active_now']); ?></div>
            <div class="text-sm font-semibold opacity-90">Online Right Now</div>
            <div class="text-xs opacity-75 mt-0.5">Active in last 5 minutes</div>
        </div>
    </div>

    
    <div class="bg-gradient-to-br from-blue-500 to-blue-600 rounded-2xl p-5 text-white shadow-md flex items-center gap-4">
        <div class="text-4xl">📱</div>
        <div>
            <div class="text-3xl font-black"><?php echo e($stats['active_today']); ?></div>
            <div class="text-sm font-semibold opacity-90">Active Today</div>
            <div class="text-xs opacity-75 mt-0.5">Last 24 hours</div>
        </div>
    </div>

    
    <div class="bg-gradient-to-br from-purple-500 to-purple-600 rounded-2xl p-5 text-white shadow-md flex items-center gap-4">
        <div class="text-4xl">👥</div>
        <div>
            <div class="text-3xl font-black"><?php echo e($stats['total_users']); ?></div>
            <div class="text-sm font-semibold opacity-90">Total Fans</div>
            <div class="text-xs opacity-75 mt-0.5">Registered users</div>
        </div>
    </div>
</div>


<div class="grid grid-cols-2 lg:grid-cols-4 gap-5 mb-8">
    <?php
        $cards = [
            ['label'=>'Total Matches',     'value'=>$stats['total_matches'],     'icon'=>'⚽', 'color'=>'bg-green-50  text-green-700  border-green-200'],
            ['label'=>'Live Now',          'value'=>$stats['live_matches'],      'icon'=>'🔴', 'color'=>'bg-red-50    text-red-700    border-red-200'],
            ['label'=>'Predictions Made',  'value'=>$stats['total_predictions'], 'icon'=>'🎯', 'color'=>'bg-purple-50 text-purple-700 border-purple-200'],
            ['label'=>'Active Polls',      'value'=>$stats['active_polls'],      'icon'=>'📊', 'color'=>'bg-yellow-50 text-yellow-700 border-yellow-200'],
            ['label'=>'Published News',    'value'=>$stats['total_news'],        'icon'=>'📰', 'color'=>'bg-pink-50   text-pink-700   border-pink-200'],
            ['label'=>'Upcoming Matches',  'value'=>$stats['upcoming_matches'],  'icon'=>'📅', 'color'=>'bg-indigo-50 text-indigo-700 border-indigo-200'],
            ['label'=>'Total Polls',       'value'=>$stats['total_polls'],       'icon'=>'🗳️', 'color'=>'bg-orange-50 text-orange-700 border-orange-200'],
        ];
    ?>

    <?php $__currentLoopData = $cards; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $card): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="bg-white rounded-2xl border <?php echo e($card['color']); ?> p-5 flex items-center gap-4 shadow-sm">
            <div class="text-3xl"><?php echo e($card['icon']); ?></div>
            <div>
                <div class="text-2xl font-black <?php echo e(explode(' ', $card['color'])[1]); ?>"><?php echo e($card['value']); ?></div>
                <div class="text-xs font-medium text-gray-500 mt-0.5"><?php echo e($card['label']); ?></div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">

    
    <?php if($liveMatches->count()): ?>
    <div class="bg-white rounded-2xl border border-red-200 shadow-sm overflow-hidden">
        <div class="px-6 py-4 border-b border-red-100 flex items-center justify-between bg-red-50">
            <h3 class="font-bold text-red-700 flex items-center gap-2">
                <span class="animate-pulse">🔴</span> Live Matches
            </h3>
        </div>
        <div class="divide-y divide-gray-100">
            <?php $__currentLoopData = $liveMatches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $match): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="px-6 py-4 flex items-center justify-between">
                <div class="text-sm font-semibold text-gray-800">
                    <?php echo e($match->homeTeam->name); ?> vs <?php echo e($match->awayTeam->name); ?>

                </div>
                <a href="<?php echo e(route('admin.matches.edit', $match->id)); ?>"
                   class="text-xs bg-red-100 text-red-700 px-3 py-1 rounded-full font-semibold hover:bg-red-200 transition-colors">
                    Update Score →
                </a>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
    <?php endif; ?>

    
    <div class="bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden">
        <div class="px-6 py-4 border-b border-gray-100 flex items-center justify-between">
            <h3 class="font-bold text-gray-800">📅 Next Matches</h3>
            <a href="<?php echo e(route('admin.matches.create')); ?>"
               class="text-xs bg-wc-green text-white px-3 py-1.5 rounded-full font-semibold hover:bg-wc-green-dark transition-colors">
                + Add Match
            </a>
        </div>
        <div class="divide-y divide-gray-100">
            <?php $__empty_1 = true; $__currentLoopData = $upcomingMatches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $match): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="px-6 py-4 flex items-center justify-between">
                <div>
                    <div class="text-sm font-semibold text-gray-800">
                        <?php echo e($match->homeTeam->name); ?> vs <?php echo e($match->awayTeam->name); ?>

                    </div>
                    <div class="text-xs text-gray-400 mt-0.5">
                        <?php echo e($match->match_datetime_admin->format('D, d M • H:i')); ?>

                    </div>
                </div>
                <a href="<?php echo e(route('admin.matches.edit', $match->id)); ?>"
                   class="text-xs text-wc-green font-semibold hover:underline">Edit</a>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="px-6 py-8 text-center text-gray-400 text-sm">
                No upcoming matches yet.
                <a href="<?php echo e(route('admin.matches.create')); ?>" class="text-wc-green font-semibold hover:underline">Add one →</a>
            </div>
            <?php endif; ?>
        </div>
    </div>

    
    <div class="bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden">
        <div class="px-6 py-4 border-b border-gray-100 flex items-center justify-between">
            <h3 class="font-bold text-gray-800">👥 Recent Users</h3>
            <a href="<?php echo e(route('admin.users.index')); ?>"
               class="text-xs text-wc-green font-semibold hover:underline">View all →</a>
        </div>
        <div class="divide-y divide-gray-100">
            <?php $__currentLoopData = $recentUsers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="px-6 py-3 flex items-center gap-4">
                <div class="w-8 h-8 rounded-full bg-wc-green/10 flex items-center justify-center
                            text-wc-green font-bold text-sm flex-shrink-0">
                    <?php echo e(strtoupper(substr($user->name, 0, 1))); ?>

                </div>
                <div class="flex-1 min-w-0">
                    <div class="text-sm font-semibold text-gray-800 truncate"><?php echo e($user->name); ?></div>
                    <div class="text-xs text-gray-400 truncate"><?php echo e($user->email); ?></div>
                </div>
                <div class="text-right flex-shrink-0">
                    <div class="text-sm font-bold text-wc-green"><?php echo e($user->total_points); ?> pts</div>
                    <div class="text-xs text-gray-400"><?php echo e($user->favoriteTeam?->code ?? '—'); ?></div>
                </div>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>

    
    <div class="bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden">
        <div class="px-6 py-4 border-b border-gray-100">
            <h3 class="font-bold text-gray-800">⚡ Quick Actions</h3>
        </div>
        <div class="p-6 grid grid-cols-2 gap-3">
            <?php
                $actions = [
                    ['href' => route('admin.matches.create'), 'icon' => '⚽', 'label' => 'Add Match',    'color' => 'bg-green-50  text-green-700  hover:bg-green-100'],
                    ['href' => route('admin.polls.create'),   'icon' => '📊', 'label' => 'Create Poll',   'color' => 'bg-yellow-50 text-yellow-700 hover:bg-yellow-100'],
                    ['href' => route('admin.news.create'),    'icon' => '📰', 'label' => 'Post News',     'color' => 'bg-blue-50   text-blue-700   hover:bg-blue-100'],
                    ['href' => route('admin.users.index'),    'icon' => '👥', 'label' => 'Manage Users',  'color' => 'bg-purple-50 text-purple-700 hover:bg-purple-100'],
                ];
            ?>
            <?php $__currentLoopData = $actions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $action): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <a href="<?php echo e($action['href']); ?>"
                   class="flex flex-col items-center gap-2 p-4 rounded-xl <?php echo e($action['color']); ?> transition-colors font-semibold text-sm text-center">
                    <span class="text-2xl"><?php echo e($action['icon']); ?></span>
                    <?php echo e($action['label']); ?>

                </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </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\MatchDay\resources\views/admin/dashboard.blade.php ENDPATH**/ ?>