<!-- Page Title -->
<div class="d-flex justify-content-between align-items-center mb-4">
    <h3 class="mb-0" style="color: var(--sidebar-bg);">
        <i class="bi bi-person-plus me-2"></i>Tambah Admin Baru
    </h3>
    <a href="<?php echo base_url('admin/admins'); ?>" class="btn btn-secondary">
        <i class="bi bi-arrow-left me-2"></i>Kembali
    </a>
</div>

<!-- Add Form -->
<div class="row">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">Form Tambah Admin</h5>
            </div>
            <div class="card-body">
                <form action="<?php echo site_url('admin/proses_tambah_admin'); ?>" method="POST">
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="username" class="form-label">Username *</label>
                            <input type="text" class="form-control" id="username" name="username" required
                                maxlength="50" value="<?php echo set_value('username'); ?>">
                            <?php echo form_error('username', '<small class="text-danger">', '</small>'); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="password" class="form-label">Password *</label>
                            <input type="password" class="form-control" id="password" name="password" required
                                minlength="6">
                            <?php echo form_error('password', '<small class="text-danger">', '</small>'); ?>
                        </div>
                    </div>

                    <div class="mb-3">
                        <label for="nama_lengkap" class="form-label">Nama Lengkap *</label>
                        <input type="text" class="form-control" id="nama_lengkap" name="nama_lengkap" required
                            maxlength="100" value="<?php echo set_value('nama_lengkap'); ?>">
                        <?php echo form_error('nama_lengkap', '<small class="text-danger">', '</small>'); ?>
                    </div>

                    <div class="mb-3">
                        <label for="email" class="form-label">Email *</label>
                        <input type="email" class="form-control" id="email" name="email" required maxlength="100"
                            value="<?php echo set_value('email'); ?>">
                        <?php echo form_error('email', '<small class="text-danger">', '</small>'); ?>
                    </div>

                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="level" class="form-label">Level *</label>
                            <select class="form-select" id="level" name="level" required>
                                <option value="admin" <?php echo set_select('level', 'admin'); ?>>Administrator</option>
                                <option value="operator" <?php echo set_select('level', 'operator'); ?>>Operator
                                </option>
                            </select>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="is_active" class="form-label">Status *</label>
                            <select class="form-select" id="is_active" name="is_active" required>
                                <option value="1" <?php echo set_select('is_active', '1'); ?>>Aktif</option>
                                <option value="0" <?php echo set_select('is_active', '0'); ?>>Nonaktif</option>
                            </select>
                        </div>
                    </div>

                    <div class="d-flex justify-content-between mt-4">
                        <a href="<?php echo base_url('admin/admins'); ?>" class="btn btn-secondary">
                            <i class="bi bi-x-circle me-2"></i>Batal
                        </a>
                        <button type="submit" class="btn btn-primary">
                            <i class="bi bi-save me-2"></i>Simpan Admin
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-4">
        <!-- Information Card -->
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0"><i class="bi bi-info-circle me-2"></i>Informasi</h5>
            </div>
            <div class="card-body">
                <h6>Ketentuan:</h6>
                <ul class="small">
                    <li>Username harus unik</li>
                    <li>Password minimal 6 karakter</li>
                    <li>Email harus valid</li>
                    <li>Level Administrator memiliki akses penuh</li>
                    <li>Level Operator memiliki akses terbatas</li>
                </ul>

                <hr>

                <h6>Password Guidelines:</h6>
                <ul class="small">
                    <li>Gunakan kombinasi huruf besar dan kecil</li>
                    <li>Sertakan angka dan karakter spesial</li>
                    <li>Minimal 8 karakter untuk keamanan optimal</li>
                    <li>Jangan gunakan password yang mudah ditebak</li>
                </ul>
            </div>
        </div>
    </div>
</div>