@page "/Error"
@using System.Diagnostics

<PageTitle>Error — EntKube</PageTitle>

<div class="text-center py-5">
    <i class="bi bi-exclamation-triangle text-danger" style="font-size: 4rem;"></i>
    <h2 class="mt-3 mb-1">Something went wrong</h2>
    <p class="text-muted mb-1">An unexpected error occurred while processing your request.</p>
    @if (ShowRequestId)
    {
        <p class="text-muted small mb-4">Request ID: <code>@RequestId</code></p>
    }
    <a href="/" class="btn btn-primary me-2">
        <i class="bi bi-house me-1"></i>Go Home
    </a>
    <a href="javascript:location.reload()" class="btn btn-outline-secondary">
        <i class="bi bi-arrow-clockwise me-1"></i>Retry
    </a>
</div>

@code {
    [CascadingParameter]
    private HttpContext? HttpContext { get; set; }

    private string? RequestId { get; set; }
    private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

    protected override void OnInitialized() =>
        RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
}
