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

<div class="container py-4" style="max-width:520px">

    <h4 class="fw-bold mb-3">🔐 Ganti Password</h4>
    <p class="text-muted small">
        Demi keamanan akun, gunakan password yang kuat dan mudah diingat.
    </p>

    <?php if (session()->getFlashdata('error')): ?>
        <div class="alert alert-danger small">
            <?= is_array(session('error')) ? implode('<br>', session('error')) : session('error') ?>
        </div>
    <?php endif ?>

    <?php if (session()->getFlashdata('success')): ?>
        <div class="alert alert-success small">
            <?= session('success') ?>
        </div>
    <?php endif ?>

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

        <div class="mb-3">
            <label class="form-label">Password Lama</label>
            <input type="password" name="password_lama" class="form-control" required>
        </div>

        <div class="mb-3">
            <label class="form-label">Password Baru</label>
            <input type="password" name="password_baru" class="form-control" required>
            <div class="form-text">Minimal 8 karakter</div>
        </div>

        <div class="mb-3">
            <label class="form-label">Konfirmasi Password Baru</label>
            <input type="password" name="konfirmasi" class="form-control" required>
        </div>

        <div class="d-flex justify-content-between">
            <a href="<?= site_url('ppdb/dashboard') ?>" class="btn btn-light">
                ← Kembali
            </a>
            <button class="btn btn-primary px-4">
                Simpan Password
            </button>
        </div>
    </form>

</div>

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