<?php $pageTitle = 'Create User'; ?>
<div class="mb-3"><a href="<?= base_url('admin/users') ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back</a></div>
<div class="card-cix">
    <div class="card-cix-header"><h5 class="mb-0"><i class="fas fa-user-plus text-orange me-2"></i> New User</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><?= $error ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('admin/user-create') ?>">
        <?= csrf_field() ?>
        <div class="row g-3">
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">First Name *</label><input type="text" name="first_name" class="form-control-cix" required></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Last Name *</label><input type="text" name="last_name" class="form-control-cix" required></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Email *</label><input type="email" name="email" class="form-control-cix" required></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Phone</label><input type="text" name="phone" class="form-control-cix"></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Role *</label><select name="role_id" class="form-control-cix" required><?php foreach ($roles as $r): ?><option value="<?= $r['id'] ?>"><?= e($r['name']) ?></option><?php endforeach; ?></select></div></div>
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Password *</label><input type="password" name="password" class="form-control-cix" required></div></div>
        </div>
        <button type="submit" class="btn-cix btn-cix-accent mt-3"><i class="fas fa-save"></i> Create User</button>
    </form>
</div>
