<?php $__env->startSection('title', 'Admin Dashboard - LPTA Portal'); ?>

<?php $__env->startSection('content'); ?>
<div class="dashboard-header" style="margin-bottom: 24px;">
    <h1 style="font-family: 'Oswald', sans-serif; color: var(--primary); font-size: 2rem;">Dashboard</h1>
    <p style="color: var(--text-muted);">Welcome to the LPTA Admin Control Center</p>
</div>

<!-- Stat Cards -->
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 32px;">
    <div class="admin-card" style="margin-bottom: 0;">
        <div class="admin-card-body" style="display: flex; align-items: center; justify-content: space-between;">
            <div>
                <span style="display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px;">Registered Members</span>
                <strong style="font-family: 'Oswald', sans-serif; font-size: 2.5rem; color: var(--primary); line-height: 1.2;"><?php echo e($stats['total_members'] ?? 0); ?></strong>
            </div>
            <div style="width: 56px; height: 56px; border-radius: 50%; background-color: rgba(30,58,138,0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;">
                <i class="fas fa-users"></i>
            </div>
        </div>
    </div>
    
    <div class="admin-card" style="margin-bottom: 0;">
        <div class="admin-card-body" style="display: flex; align-items: center; justify-content: space-between;">
            <div>
                <span style="display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px;">Pending Approval</span>
                <strong style="font-family: 'Oswald', sans-serif; font-size: 2.5rem; color: var(--secondary); line-height: 1.2;"><?php echo e($stats['pending_members'] ?? 0); ?></strong>
            </div>
            <div style="width: 56px; height: 56px; border-radius: 50%; background-color: rgba(239,68,68,0.1); color: var(--secondary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;">
                <i class="fas fa-user-clock"></i>
            </div>
        </div>
    </div>

    <div class="admin-card" style="margin-bottom: 0;">
        <div class="admin-card-body" style="display: flex; align-items: center; justify-content: space-between;">
            <div>
                <span style="display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px;">Active Coaches</span>
                <strong style="font-family: 'Oswald', sans-serif; font-size: 2.5rem; color: var(--primary); line-height: 1.2;"><?php echo e($stats['total_coaches'] ?? 0); ?></strong>
            </div>
            <div style="width: 56px; height: 56px; border-radius: 50%; background-color: rgba(30,58,138,0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;">
                <i class="fas fa-dumbbell"></i>
            </div>
        </div>
    </div>

    <div class="admin-card" style="margin-bottom: 0;">
        <div class="admin-card-body" style="display: flex; align-items: center; justify-content: space-between;">
            <div>
                <span style="display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px;">Active Referees</span>
                <strong style="font-family: 'Oswald', sans-serif; font-size: 2.5rem; color: var(--primary); line-height: 1.2;"><?php echo e($stats['total_referees'] ?? 0); ?></strong>
            </div>
            <div style="width: 56px; height: 56px; border-radius: 50%; background-color: rgba(30,58,138,0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;">
                <i class="fas fa-gavel"></i>
            </div>
        </div>
    </div>
</div>

<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 24px;">
    <!-- Recent Registrations -->
    <div class="admin-card">
        <div class="admin-card-header">
            <span class="admin-card-title"><i class="fas fa-user-plus" style="color:var(--primary); margin-right:8px;"></i> Recent Registrations</span>
            <a href="<?php echo e(route('admin.members.index')); ?>" class="btn btn-outline btn-sm">View All</a>
        </div>
        <div class="admin-card-body" style="padding: 0;">
            <?php if(isset($recentMembers) && $recentMembers->count() > 0): ?>
            <div class="table-responsive">
                <table class="admin-table">
                    <thead>
                        <tr>
                            <th>Member</th>
                            <th>ID & Belt</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $recentMembers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td>
                                <div style="display: flex; align-items: center; gap: 12px;">
                                    <div style="width: 40px; height: 40px; border-radius: 50%; background-color: var(--bg-color); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700;">
                                        <?php echo e(substr($m->first_name, 0, 1)); ?>

                                    </div>
                                    <span style="font-weight: 600;"><?php echo e($m->full_name); ?></span>
                                </div>
                            </td>
                            <td>
                                <div><?php echo e($m->member_id); ?></div>
                                <small style="color: var(--text-muted);"><?php echo e($m->belt_rank); ?></small>
                            </td>
                            <td>
                                <?php if($m->status === 'pending'): ?>
                                    <span class="badge badge-warning">Pending</span>
                                <?php else: ?>
                                    <span class="badge badge-success">Active</span>
                                <?php endif; ?>
                            </td>
                            <td>
                                <div style="display:flex; gap:8px;">
                                    <?php if($m->status === 'pending'): ?>
                                        <form action="<?php echo e(route('admin.members.approve', $m->id)); ?>" method="POST">
                                            <?php echo csrf_field(); ?>
                                            <button type="submit" class="btn btn-sm" style="background-color:#10b981; color:white;"><i class="fas fa-check"></i> Approve</button>
                                        </form>
                                    <?php endif; ?>
                                    <a href="<?php echo e(route('admin.members.show', $m->id)); ?>" class="btn btn-outline btn-sm"><i class="fas fa-eye"></i> View</a>
                                </div>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            <?php else: ?>
            <div style="padding: 30px; text-align: center; color: var(--text-muted);">
                <i class="fas fa-users" style="font-size: 2rem; margin-bottom: 10px; opacity: 0.5;"></i>
                <p>No recent registrations.</p>
            </div>
            <?php endif; ?>
        </div>
    </div>

    <!-- Activity Logs -->
    <div class="admin-card">
        <div class="admin-card-header">
            <span class="admin-card-title"><i class="fas fa-history" style="color:var(--primary); margin-right:8px;"></i> Recent Activity</span>
            <a href="<?php echo e(route('admin.logs')); ?>" class="btn btn-outline btn-sm">All Logs</a>
        </div>
        <div class="admin-card-body" style="padding: 0;">
            <?php if(isset($recentLogs) && $recentLogs->count() > 0): ?>
            <div style="display: flex; flex-direction: column;">
                <?php $__currentLoopData = $recentLogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div style="padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 4px;">
                    <div style="display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted);">
                        <strong><?php echo e($log->user->name ?? 'System/Guest'); ?></strong>
                        <span><?php echo e($log->created_at->diffForHumans()); ?></span>
                    </div>
                    <span style="font-size: 0.85rem; font-weight: 600; color: var(--primary); text-transform: uppercase;"><?php echo e(str_replace('_', ' ', $log->action)); ?></span>
                    <p style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.4;"><?php echo e($log->details); ?></p>
                </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
            <?php else: ?>
            <div style="padding: 30px; text-align: center; color: var(--text-muted);">
                <i class="fas fa-clipboard-list" style="font-size: 2rem; margin-bottom: 10px; opacity: 0.5;"></i>
                <p>No recent activity.</p>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

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