<?= $this->extend('ppdb/layout') ?>
<?= $this->section('content') ?>

<div class="container py-4">

    <h4 class="fw-bold mb-2">📘 Profil Calon Siswa</h4>
    <p class="text-muted small mb-4">
        Lengkapi data dengan benar sesuai dokumen resmi (Akta / KK)
    </p>

    <form action="<?= site_url('ppdb/profil/save') ?>" method="post">
        <?= csrf_field() ?>

        <!-- =====================
             A. DATA SISWA
        ====================== -->
        <div class="card mb-4 shadow-sm border-0">
            <div class="card-header fw-bold bg-light">
                A. Data Siswa
            </div>

            <div class="card-body row g-3">

                <div class="col-md-6">
                    <label class="form-label">Nama Lengkap</label>
                    <input type="text"
                           name="nama_siswa"
                           class="form-control"
                           value="<?= esc($siswa['nama_siswa'] ?? '') ?>"
                           required>
                </div>

                <div class="col-md-6">
                    <label class="form-label">NIK</label>
                    <input type="text"
                           name="nik"
                           class="form-control"
                           maxlength="16"
                           value="<?= esc($siswa['nik'] ?? '') ?>">
                </div>

                <div class="col-md-4">
                    <label class="form-label">Tempat Lahir</label>
                    <input type="text"
                           name="tempat_lahir"
                           class="form-control"
                           value="<?= esc($siswa['tempat_lahir'] ?? '') ?>">
                </div>

                <div class="col-md-4">
                    <label class="form-label">Tanggal Lahir</label>
                    <input type="date"
                           name="tgl_lahir"
                           class="form-control"
                           value="<?= esc($siswa['tgl_lahir'] ?? '') ?>">
                </div>

                <div class="col-md-4">
                    <label class="form-label">Jenis Kelamin</label>
                    <select name="jenis_kelamin" class="form-select">
                        <option value="">-- Pilih --</option>
                        <option value="L" <?= ($siswa['jenis_kelamin'] ?? '') === 'L' ? 'selected' : '' ?>>
                            Laki-laki
                        </option>
                        <option value="P" <?= ($siswa['jenis_kelamin'] ?? '') === 'P' ? 'selected' : '' ?>>
                            Perempuan
                        </option>
                    </select>
                </div>

                <div class="col-12">
                    <label class="form-label">Alamat Lengkap</label>
                    <textarea name="alamat"
                              class="form-control"
                              rows="3"><?= esc($siswa['alamat'] ?? '') ?></textarea>
                </div>

            </div>
        </div>

        <!-- =====================
             B. DATA ORANG TUA
        ====================== -->
        <div class="card shadow-sm border-0">
            <div class="card-header fw-bold bg-light">
                B. Data Orang Tua / Wali
            </div>

            <div class="card-body row g-3">

                <div class="col-md-6">
                    <label class="form-label">Nama Ayah</label>
                    <input type="text"
                           name="nama_ayah"
                           class="form-control"
                           value="<?= esc($siswa['nama_ayah'] ?? '') ?>">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Nama Ibu</label>
                    <input type="text"
                           name="nama_ibu"
                           class="form-control"
                           value="<?= esc($siswa['nama_ibu'] ?? '') ?>">
                </div>

                <div class="col-md-6">
                    <label class="form-label">No. HP Orang Tua / Wali</label>
                    <input type="text"
                           name="no_hp_ortu"
                           class="form-control"
                           value="<?= esc($siswa['no_hp_ortu'] ?? '') ?>">
                </div>

            </div>
        </div>

        <!-- =====================
             SUBMIT
        ====================== -->
        <div class="text-end mt-4">
            <button class="btn btn-primary px-4">
                💾 Simpan & Lanjutkan
            </button>
        </div>

    </form>

</div>

<?= $this->endSection() ?>
