@model RecoveryCodesViewModel
@{
    ViewData["Title"] = "Recovery Codes";
}

<div class="page-heading compact">
    <div>
        <p class="eyebrow">Account</p>
        <h1>Recovery Codes</h1>
        <p class="lead-text">Recovery codes can be used once if you cannot access your authenticator app.</p>
    </div>
</div>

@if (TempData["AuthMessage"] is string authMessage)
{
    <div class="alert alert-info">@authMessage</div>
}

<section class="edit-panel">
    <div class="alert alert-warning">
        Store these codes somewhere safe. They are shown only once, and each code can be used one time.
    </div>

    @if (Model.HasNewCodes)
    {
        <div class="content-grid">
            @foreach (var code in Model.RecoveryCodes)
            {
                <div class="plain-card"><code>@code</code></div>
            }
        </div>
    }
    else
    {
        <p class="muted">No new recovery codes are available to display. Generate new codes if you need a fresh set.</p>
    }

    <form asp-action="RegenerateRecoveryCodes" method="post" class="button-row mt-3">
        <button class="btn btn-outline-primary" type="submit">Regenerate Recovery Codes</button>
        <a class="btn btn-outline-secondary" asp-action="Index">Back to Manage Account</a>
    </form>
</section>
