/*
 * Busy overlay - see busy-overlay.js. The look follows the Font Awesome
 * spinner of jQuery Busy Load (fa-spinner fa-spin fa-3x, white on a dimmed
 * page), with a dark panel behind it so the words stay legible on any page.
 * Retheme with the variables. Keep the copies in the core and the portal
 * identical.
 */
.busy-overlay {
    --busy-backdrop: rgba(0, 0, 0, 0.35);
    --busy-panel: rgba(17, 24, 39, 0.92);
    --busy-color: #ffffff;
    --busy-muted: #e5e7eb;
    --busy-size: 48px;

    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 16px;
    border: 0;
    overflow: hidden;
    background: var(--busy-backdrop);
    color: var(--busy-color);
    z-index: 2147483647;
}

.busy-overlay[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    /* The page is blocked at once; the dimming waits a moment so a quick
       submission does not flash. */
    animation: busy-overlay-in 200ms ease-out 150ms both;
}

/* The dialog paints the dimming itself, so the non-modal fallback looks the same. */
.busy-overlay::backdrop {
    background: transparent;
}

.busy-overlay:focus {
    outline: none;
}

.busy-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: min(90vw, 360px);
    padding: 24px 28px;
    border-radius: 12px;
    background: var(--busy-panel);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.busy-overlay__spinner {
    display: block;
    width: var(--busy-size);
    height: var(--busy-size);
    animation: busy-overlay-spin 2s linear infinite;
}

.busy-overlay__spinner svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.busy-overlay__text {
    margin: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--busy-color);
}

.busy-overlay__stuck {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--busy-muted);
}

.busy-overlay__close {
    margin-left: 6px;
    padding: 2px 10px;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: var(--busy-color);
    font: inherit;
    cursor: pointer;
}

.busy-overlay__close:focus-visible {
    outline: 2px solid var(--busy-color);
    outline-offset: 2px;
}

@keyframes busy-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes busy-overlay-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .busy-overlay[open] { animation-duration: 1ms; }
    /* Slower, not stopped: a still spinner reads as a hung page. */
    .busy-overlay__spinner { animation-duration: 6s; }
}
