<?php
if (!function_exists('mj_v281_feature_grid')) {
function mj_v281_feature_grid(array $items): void {
    echo '<div class="row g-3">';
    foreach ($items as $it) {
        $icon = e($it[0] ?? 'bi-check-circle');
        $title = e($it[1] ?? 'Feature');
        $desc = e($it[2] ?? 'Ready');
        echo '<div class="col-md-6 col-xl-4"><div class="mj-account-tile h-100"><i class="bi '.$icon.'"></i><h5 class="fw-bold mt-3">'.$title.'</h5><p class="text-muted mb-0">'.$desc.'</p></div></div>';
    }
    echo '</div>';
}
}
if (!function_exists('mj_v281_tabs')) {
function mj_v281_tabs(array $tabs, string $active, string $base): void {
    echo '<div class="mj-tabs mb-4">';
    foreach ($tabs as $key=>$label) {
        $cls = $key === $active ? 'active' : '';
        echo '<a class="'.$cls.'" href="'.e(base_url($base.'?tab='.$key)).'">'.e($label).'</a>';
    }
    echo '</div>';
}
}
if (!function_exists('mj_v281_badge')) {
function mj_v281_badge(string $status): string {
    $map=['active'=>'success','approved'=>'success','paid'=>'success','open'=>'primary','pending'=>'warning','pending_payment'=>'info','payment_uploaded'=>'info','draft'=>'secondary','closed'=>'secondary','rejected'=>'danger','failed'=>'danger','overdue'=>'danger','urgent'=>'danger','normal'=>'info','low'=>'secondary'];
    $class = $map[strtolower($status)] ?? 'secondary';
    return '<span class="badge text-bg-'.$class.'">'.e(ucwords(str_replace('_',' ',$status))).'</span>';
}
}
if (!function_exists('mj_v281_empty')) {
function mj_v281_empty(string $title, string $message, string $icon='bi-inbox'): void {
    echo '<div class="mj-empty-state"><i class="bi '.e($icon).'"></i><h5>'.e($title).'</h5><p>'.e($message).'</p></div>';
}
}
