/* The connection-lost overlay.
 *
 * Blazor toggles the classes below on #components-reconnect-modal; the element
 * itself is ours (Components/App.razor), so the default English "Attempting to
 * reconnect to the server: 2 of 8" card is never injected. Behaviour lives in
 * js/onix-reconnect.js.
 *
 * The selectors are #id.class, not plain .class, because MudBlazor.min.css
 * ships
 *
 *     #components-reconnect-modal { z-index: 9999 !important;
 *                                   background-color: var(--mud-palette-background) !important; }
 *
 * assuming it is styling Blazor's own overlay. An ID plus !important beats any
 * class rule, so a plain .onix-reconnect background silently lost: the backdrop
 * came out as the opaque page grey, which hid the app entirely instead of
 * dimming it. Verified on-device — the whole screen went blank behind the card. */

#components-reconnect-modal.onix-reconnect {
    display: none;
    position: fixed;
    inset: 0;
    /* Over MudBlazor's own overlays; !important only to outrank the rule above. */
    z-index: 9999 !important;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(10, 31, 60, .45) !important;
}

/* The only three states Blazor sets. Anything else means connected, and the
 * default `display: none` above keeps the overlay out of the way — including
 * before Blazor has started, when the element is already in the DOM. */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.onix-reconnect-card {
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    backdrop-filter: blur(20px) saturate(1.5);
    width: 100%;
    max-width: 320px;
    padding: 24px 20px;
    text-align: center;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 32, .25);
}

.onix-reconnect-spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 14px;
    border: 3px solid #D5DADD;
    border-top-color: #0057D2;
    border-radius: 50%;
    animation: onix-reconnect-spin 900ms linear infinite;
}

/* Once Blazor has given up, a spinner is a lie — there is nothing in flight.
 * The card then waits on the network instead. */
.components-reconnect-failed .onix-reconnect-spinner,
.components-reconnect-rejected .onix-reconnect-spinner {
    animation: none;
    border-top-color: #D5DADD;
    opacity: .4;
}

@keyframes onix-reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .onix-reconnect-spinner { animation: none; }
}

.onix-reconnect-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    color: #12171D;
}

/* #id-scoped so it outranks MudBlazor's #components-reconnect-modal button. */
#components-reconnect-modal .onix-reconnect-retry {
    display: none;                  /* shown by the script only once retrying stops */
    margin-top: 16px;
    padding: 10px 20px;
    font: inherit;
    font-weight: 600;
    color: #FFFFFF;
    background: #0057D2;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}
