                <?php if(count($monthlyTrends) > 0): ?>
                <div class="chart-container">
                    <div class="chart-title">
                        <i class="fas fa-chart-line"></i>
                        Monthly Enrollment Trends
                    </div>
                    <div class="trend-chart">
                        <?php 
                        $enrollmentCounts = array_column($monthlyTrends, 'enrollments');
                        $maxEnrollments = !empty($enrollmentCounts) ? max($enrollmentCounts) : 1;
                        foreach($monthlyTrends as $trend): 
                            $height = $maxEnrollments > 0 ? ($trend['enrollments'] / $maxEnrollments) * 100 : 20;
                            $barHeight = $height >= 15 ? $height : 15;
                        ?>
                        <div class="trend-column">
                            <div class="trend-count"><?= $trend['enrollments']; ?></div>
                            <div class="trend-bar-container">
                                <div class="trend-bar" style="height: <?= $barHeight; ?>%"></div>
                            </div>
                            <div class="trend-label"><?= date('M Y', strtotime($trend['month'] . '-01')); ?></div>
                        </div>
                        <?php endforeach; ?>
                    </div>
                    <div class="chart-summary">
                        <?php 
                        $enrollmentCounts = array_column($monthlyTrends, 'enrollments');
                        $totalEnrollments = !empty($enrollmentCounts) ? array_sum($enrollmentCounts) : 0;
                        $avgEnrollments = count($monthlyTrends) > 0 ? $totalEnrollments / count($monthlyTrends) : 0;
                        ?>
                        <span>Total: <span class="chart-total"><?= number_format($totalEnrollments); ?></span></span>
                        <span>Average: <span class="chart-total"><?= number_format($avgEnrollments, 1); ?></span></span>
                        <span>Peak: <span class="chart-total"><?= number_format($maxEnrollments); ?></span></span>
                    </div>
                </div>
                <?php endif; ?>