<?php
declare(strict_types=1);

/** @var array{ok:?string,err:?string} $flash */
/** @var array{id:int,email:string,name:?string} $user */

$pageTitle = __('account.password_title');
$pageHeading = __('account.password_heading');
$activeNav = 'settings';
$hideHero = true;
$csrf = \SeoScope\Auth\AdminCsrf::token();

ob_start();
?>
<div class="dashboard-card section-card">
    <div class="section-title mb-2"><?= seoscope_h(__('account.password_heading')) ?></div>
    <div class="section-subtitle mb-3"><?= seoscope_h(__('account.password_subtitle')) ?></div>

    <div class="dashboard-card section-card" style="background: rgba(255,255,255,0.70);">
        <form method="post" action="<?= seoscope_h(seoscope_url('/account/password')) ?>">
            <input type="hidden" name="_csrf" value="<?= seoscope_h($csrf) ?>">

            <div class="row g-3">
                <div class="col-12 col-lg-4">
                    <label class="form-label"><?= seoscope_h(__('account.current_password')) ?></label>
                    <input class="form-control" type="password" name="current_password" autocomplete="current-password" required>
                </div>
                <div class="col-12 col-lg-4">
                    <label class="form-label"><?= seoscope_h(__('auth.new_password')) ?></label>
                    <input class="form-control" type="password" name="password" autocomplete="new-password" required>
                    <div class="text-muted small mt-2"><?= seoscope_h(__('auth.password_hint')) ?></div>
                </div>
                <div class="col-12 col-lg-4">
                    <label class="form-label"><?= seoscope_h(__('auth.new_password_confirm')) ?></label>
                    <input class="form-control" type="password" name="password_confirm" autocomplete="new-password" required>
                </div>
            </div>

            <div class="mt-3 d-flex align-items-center gap-2 flex-wrap">
                <button type="submit" class="btn btn-upgrade"><?= seoscope_h(__('account.password_save')) ?></button>
                <a class="btn btn-link" href="<?= seoscope_h(seoscope_url('/account')) ?>"><?= seoscope_h(__('account.back')) ?></a>
            </div>
        </form>
    </div>
</div>
<?php
$content = (string) ob_get_clean();
require __DIR__ . '/layout_admin.php';

