<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>لوحة تحكم الأنشطة الرياضية<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>

<div style="display:grid;grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));gap:15px;margin-bottom:20px;">

    <!-- Active Disciplines -->
    <a href="/sa/disciplines" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #8B5CF6;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#EDE9FE;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="activity" style="width:22px;height:22px;color:#8B5CF6;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['active_disciplines'] ?></div>
                <div style="font-size:13px;color:#6B7280;">الأنشطة الرياضية</div>
            </div>
        </div>
    </a>

    <!-- Active Facilities + Units -->
    <a href="/sa/facilities" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #3B82F6;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#DBEAFE;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="building" style="width:22px;height:22px;color:#3B82F6;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['active_facilities'] ?> <span style="font-size:14px;color:#6B7280;font-weight:400;">(<?= (int) $stats['active_units'] ?> وحدة)</span></div>
                <div style="font-size:13px;color:#6B7280;">المرافق النشطة</div>
            </div>
        </div>
    </a>

    <!-- Active Coaches -->
    <a href="/sa/coaches" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #059669;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#ECFDF5;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="user-check" style="width:22px;height:22px;color:#059669;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['active_coaches'] ?></div>
                <div style="font-size:13px;color:#6B7280;">المدربين النشطين</div>
            </div>
        </div>
    </a>

    <!-- Total Players -->
    <a href="/sa/players" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #F59E0B;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#FEF3C7;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="users" style="width:22px;height:22px;color:#F59E0B;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['total_players'] ?></div>
                <div style="font-size:13px;color:#6B7280;">اللاعبين المسجلين</div>
            </div>
        </div>
    </a>

    <!-- Active Groups -->
    <a href="/sa/groups" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #EC4899;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#FCE7F3;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="layers" style="width:22px;height:22px;color:#EC4899;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['active_groups'] ?> <span style="font-size:14px;color:#6B7280;font-weight:400;">(<?= (int) $stats['enrolled_players'] ?> مسجل)</span></div>
                <div style="font-size:13px;color:#6B7280;">المجموعات النشطة</div>
            </div>
        </div>
    </a>

    <!-- Today's Bookings -->
    <a href="/sa/mirror" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #06B6D4;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#CFFAFE;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="calendar" style="width:22px;height:22px;color:#06B6D4;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['today_bookings'] ?></div>
                <div style="font-size:13px;color:#6B7280;">حجوزات اليوم</div>
            </div>
        </div>
    </a>

    <!-- Pending Medical -->
    <a href="/sa/players" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #F97316;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#FFEDD5;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="heart-pulse" style="width:22px;height:22px;color:#F97316;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['pending_medical'] ?></div>
                <div style="font-size:13px;color:#6B7280;">بانتظار موافقة طبية</div>
            </div>
        </div>
    </a>

    <!-- Overdue Subscriptions -->
    <a href="/sa/subscriptions?payment_status=overdue" class="card" style="padding:20px;text-decoration:none;color:inherit;border-right:4px solid #DC2626;">
        <div style="display:flex;align-items:center;gap:12px;">
            <div style="width:44px;height:44px;background:#FEE2E2;border-radius:10px;display:flex;align-items:center;justify-content:center;">
                <i data-lucide="alert-triangle" style="width:22px;height:22px;color:#DC2626;"></i>
            </div>
            <div>
                <div style="font-size:24px;font-weight:700;color:#1A1A2E;"><?= (int) $stats['overdue_subscriptions'] ?></div>
                <div style="font-size:13px;color:#6B7280;">اشتراكات متأخرة</div>
            </div>
        </div>
    </a>

</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    if (typeof lucide !== 'undefined') { lucide.createIcons(); }
});
</script>
<?php $__template->endSection(); ?>
