<?php
declare(strict_types=1);
/** @var array{ok:?string,err:?string} $flash */
/** @var bool|null $sent */

require_once __DIR__ . '/http_helpers.php';
$csrf = \SeoScope\Auth\AdminCsrf::token();
$sent = (bool) ($sent ?? false);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= seoscope_h(__('auth.forgot_title')) ?> — <?= seoscope_h(__('app.name')) ?></title>
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/fonts/inter/inter.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/vendor/bootstrap/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/vendor/fontawesome/css/all.min.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/admin-template/css/admin-template.css')) ?>">
</head>
<body class="login-page">
    <div class="login-shell">
        <div class="login-wrapper">
            <div class="row g-0">
                <div class="col-lg-5">
                    <div class="login-left">
                        <div>
                            <div class="brand mb-5">
                                <span class="brand-icon"><i class="fa-solid fa-wave-square"></i></span>
                                <span><?= seoscope_h(__('app.name')) ?></span>
                            </div>
                            <div class="left-copy">
                                <h1 class="fw-800"><?= seoscope_h(__('auth.forgot_hero')) ?></h1>
                                <p class="mb-0"><?= seoscope_h(__('auth.forgot_subtitle')) ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-lg-7">
                    <div class="login-right">
                        <div class="login-card">
                            <h2 class="fw-800"><?= seoscope_h(__('auth.forgot_title')) ?></h2>
                            <p class="subtitle"><?= seoscope_h(__('auth.forgot_help')) ?></p>

                            <?php if (!empty($flash['ok'])): ?>
                                <div class="alert alert-success mb-4"><?= seoscope_h($flash['ok']) ?></div>
                            <?php endif; ?>
                            <?php if (!empty($flash['err'])): ?>
                                <div class="alert alert-danger mb-4"><?= seoscope_h($flash['err']) ?></div>
                            <?php endif; ?>
                            <?php if ($sent): ?>
                                <div class="alert alert-success mb-4"><?= seoscope_h(__('auth.forgot_sent')) ?></div>
                            <?php endif; ?>

                            <form method="post" action="<?= seoscope_h(seoscope_url('/forgot-password')) ?>">
                                <input type="hidden" name="_csrf" value="<?= seoscope_h($csrf) ?>">
                                <div class="mb-4">
                                    <label for="email" class="form-label"><?= seoscope_h(__('auth.email')) ?></label>
                                    <input type="email" class="form-control" id="email" name="email" placeholder="name@example.com" required autocomplete="username">
                                </div>
                                <button type="submit" class="btn-login"><?= seoscope_h(__('auth.forgot_submit')) ?></button>
                            </form>

                            <p class="helper-text mt-3">
                                <a href="<?= seoscope_h(seoscope_url('/login')) ?>"><?= seoscope_h(__('auth.back_to_login')) ?></a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="<?= seoscope_h(seoscope_url('/assets/vendor/bootstrap/bootstrap.bundle.min.js')) ?>"></script>
</body>
</html>

