/*
   App-level CSS only. MudBlazor supplies the component styling and RadiantTheme supplies the palette, so
   this file is limited to the pre-Blazor loading screen, the error banner, and a couple of utilities that
   MudBlazor has no equivalent for.
*/

/* ── shared utilities ────────────────────────────────────────────────────── */

/* Digits in a column must line up, or the eye cannot compare them. Applied to every money and quantity
   cell; without it proportional figures drift and a column of numbers becomes hard to scan. */
.tabular {
    font-variant-numeric: tabular-nums;
}

/* Money and quantities are right-aligned so the decimal points stack. */
.text-end {
    text-align: right;
}

/* Document numbers and codes: monospace, so RCV-2026-000042 reads as an identifier rather than prose. */
.mono {
    font-family: "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
    font-size: 0.85em;
}

/* ── validation ──────────────────────────────────────────────────────────── */
/* MudBlazor renders its own field errors, so these only apply to any plain input left in the app. */

.invalid {
    outline: 1px solid var(--mud-palette-error);
}

.validation-message {
    color: var(--mud-palette-error);
}

/* ── loading screen, shown before the WASM runtime starts ────────────────── */
/* Cannot use MudBlazor here: none of it has loaded yet. Colours are the theme's teal, hard-coded for that
   reason. */

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e2efec;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #0f6e63;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: #35443f;
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    /* The first load is a few megabytes of WebAssembly, which on field mobile data is a wait worth
       explaining rather than leaving as a blank screen. */
    content: var(--blazor-load-percentage-text, "Loading Radiant Family…");
}

/* ── unhandled error banner ──────────────────────────────────────────────── */

#blazor-error-ui {
    color-scheme: light only;
    background: #f5e4e4;
    border-top: 3px solid #973030;
    color: #16211f;
    bottom: 0;
    box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 3000;
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

#blazor-error-ui .reload {
    color: #973030;
    font-weight: 600;
}

.blazor-error-boundary {
    background: #973030;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Something went wrong on this part of the page.";
}
