<?php ob_start(); ?>

<h2><?= __('installer.admin_title') ?></h2>
<p><?= __('installer.admin_text') ?></p>

<?php if (!empty($error)): ?>
<div class="alert alert-error"><?= e($error) ?></div>
<?php endif; ?>

<form method="POST" action="/installer/step/5">
    <?= $csrf->field() ?>
    <div class="form-group">
        <label for="admin_username"><?= __('installer.admin_username') ?></label>
        <input type="text" id="admin_username" name="admin_username" required>
    </div>
    <div class="form-group">
        <label for="admin_email"><?= __('installer.admin_email') ?></label>
        <input type="email" id="admin_email" name="admin_email" required>
    </div>
    <div class="form-group">
        <label for="admin_password"><?= __('installer.admin_password') ?></label>
        <div class="iw-pw-wrap">
            <input type="password" id="admin_password" name="admin_password" required minlength="<?= \App\Core\Auth::MIN_PASSWORD_LENGTH ?>">
            <button type="button" class="iw-pw-toggle" data-target="admin_password" aria-label="Show password">
                <svg class="iw-pw-eye" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>
                <svg class="iw-pw-eye-off" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/></svg>
            </button>
        </div>
        <small><?= __('installer.admin_password_hint') ?></small>
    </div>
    <div class="form-group">
        <label for="admin_password_confirm"><?= __('installer.admin_password_confirm') ?></label>
        <div class="iw-pw-wrap">
            <input type="password" id="admin_password_confirm" name="admin_password_confirm" required>
            <button type="button" class="iw-pw-toggle" data-target="admin_password_confirm" aria-label="Show password">
                <svg class="iw-pw-eye" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>
                <svg class="iw-pw-eye-off" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/></svg>
            </button>
        </div>
    </div>

    <div class="step-actions">
        <a href="/installer/step/4" class="btn btn-secondary"><?= __('installer.admin_back') ?></a>
        <button type="submit" class="btn btn-primary"><?= __('installer.admin_create') ?></button>
    </div>
</form>

<?php $content = ob_get_clean(); include __DIR__ . '/layout.php'; ?>
