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

<div class="registration-form container mt-5 mb-5 text-center">
    <?php if (session()->getFlashdata('error')): ?>
        <div class="alert alert-danger text-center">
            <?= esc(session()->getFlashdata('error')) ?>
        </div>
    <?php endif; ?>

    <!-- Form -->
    <form method="post" action="/processForgotPassword" class="text-start" style="max-width: 600px; margin: 0 auto;">
        <?= csrf_field() ?>
        <div class="text-center mb-4">
            <a href="<?= base_url('/') ?>">
                <img src="<?= base_url('assets/images/alrahma_logo.png') ?>" alt=""
                    style="width: 120px; height: 120px; border-radius: 50%; object-fit: cover;">
            </a>
        </div>

        <h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Reset Your Password</h3>

        <div class="centered-paragraph mb-4 text-center">
            <p>Please enter the email address you used to register with us.</p>
            <p>We'll send you a link to reset your password.</p>
        </div>

        <div class="form-group mb-3">
            <label for="email"></label>
            <input type="email"
                   class="form-control item"
                   id="email"
                   name="email"
                   maxlength="50"
                   placeholder="Email Address"
                   value="<?= old('email') ?>"
                   required>
        </div>

        <div class="d-grid mb-3">
            <button type="submit" class="btn btn-success item">Reset Password</button>
        </div>

        <div class="text-center">
            <p class="mb-0">Don't have an account?</p>
            <a href="/register" class="d-inline-block mt-1">Register now</a>
        </div>
    </form>
</div>

<!-- ✅ Include modal view -->
<?= view('user/password_reset_confirmation') ?>
<?= view('/errors/custom/blocked') ?>

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