<?php
$db = Database::getInstance();
$active = (int) $db->fetchColumn("SELECT COUNT(*) FROM facilities WHERE status = 'active' AND is_active = 1");
$maintenance = (int) $db->fetchColumn("SELECT COUNT(*) FROM facilities WHERE status = 'under_maintenance'");
$closed = (int) $db->fetchColumn("SELECT COUNT(*) FROM facilities WHERE status = 'closed'");
?>
<div class="card h-100">
    <div class="card-header bg-transparent"><h6 class="mb-0"><i class="fas fa-building me-1 text-success"></i> <?= lang('facilities.facility_status_title') ?></h6></div>
    <div class="card-body">
        <div class="d-flex justify-content-around text-center">
            <div><h4 class="text-success mb-0"><?= $active ?></h4><small class="text-muted">Active</small></div>
            <div><h4 class="text-warning mb-0"><?= $maintenance ?></h4><small class="text-muted">Maintenance</small></div>
            <div><h4 class="text-danger mb-0"><?= $closed ?></h4><small class="text-muted">Closed</small></div>
        </div>
    </div>
    <div class="card-footer bg-transparent border-0 pt-0"><a href="/facilities" class="small text-primary">Manage facilities →</a></div>
</div>