/* Client-specific styles. The bulk of the old wwwroot/app.css should be copied over as the
   remaining pages are migrated; this file only holds what the new shell needs. */

html, body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Shown by index.html before the WASM runtime has started, and by <Authorizing>. */
.ace-boot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 60vh;
    color: #6c757d;
}

.ace-boot__spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #dee2e6;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: ace-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .ace-boot__spinner {
        animation-duration: 3s;
    }
}

.ace-layout-plain {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Blazor's built-in error banner. Kept visible and unmissable: in WASM there is no circuit
   teardown, so a swallowed exception otherwise shows up only as a stuck spinner. */
#blazor-error-ui {
    background: #ffe6e6;
    border-top: 2px solid #dc3545;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1100;
}

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

#blazor-error-ui .reload {
    margin-left: 0.5rem;
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Service health indicator (header)

   Plain CSS rather than a Radzen popup: the panel hangs off a fixed-position
   anchor in a header that never scrolls, which is the one case that needs no
   positioning logic at all.

   Colours are literals, not Radzen theme variables, on purpose. The header sits
   on rz-background-color-danger-darker — the brand red — so the theme's own
   danger colour would be invisible against it, and the whole point of this
   control is that "unhealthy" reads as unhealthy in every theme.
   --------------------------------------------------------------------------- */
/* The panel hangs below the header, so anything clipping the header clips it out of
   existence — and the failure looks like "clicking the dot does nothing" rather than
   like a style problem. Stated here rather than relied upon from the theme. */
.rz-header {
    overflow: visible;
}

.ace-health {
    position: relative;
    display: flex;
    align-items: center;
}

.ace-health__dot {
    background: none;
    border: none;
    padding: 0.25rem;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 50%;
    line-height: 0;
}

.ace-health__dot:hover,
.ace-health__dot:focus-visible {
    background: rgba(255, 255, 255, 0.15);
}

.ace-health__dot--healthy { color: #7ddb8a; }
.ace-health__dot--degraded { color: #ffd166; }
.ace-health__dot--unhealthy { color: #ff8a80; }
.ace-health__dot--unknown { color: rgba(255, 255, 255, 0.6); }

/* An outage is not the moment to have the only indicator of it gently pulsing in
   the corner where nobody looks. Suppressed under prefers-reduced-motion below. */
.ace-health__dot--unhealthy > .rzi {
    animation: ace-health-pulse 2s ease-in-out infinite;
}

@keyframes ace-health-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    .ace-health__dot--unhealthy > .rzi {
        animation: none;
    }
}

/* Sits behind the panel and in front of the app. Closes on an outside click
   without a document-level listener that would need tearing down on dispose. */
.ace-health__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.ace-health__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1050;
    width: min(24rem, calc(100vw - 2rem));
    max-height: min(28rem, calc(100vh - 5rem));
    overflow-y: auto;
    padding: 0.75rem;
    border-radius: 0.375rem;
    /* Theme variables here, unlike the dot: the panel is on the page background,
       not on the brand-red header, so it should follow the active theme. */
    background: var(--rz-base-background-color, #fff);
    color: var(--rz-text-color, #212529);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
}

.ace-health__table {
    width: 100%;
    border-collapse: collapse;
}

.ace-health__table td {
    padding: 0.25rem 0.25rem;
    vertical-align: top;
    border-top: 1px solid var(--rz-border-color, rgba(0, 0, 0, 0.08));
}

.ace-health__table tr:first-child td {
    border-top: none;
}

.ace-health__cell-icon { width: 1.5rem; }

.ace-health__cell-duration {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
    font-size: 0.75rem;
}

.ace-health__icon { font-size: 1.125rem; }

.ace-health__icon--healthy { color: #2e7d32; }
.ace-health__icon--degraded { color: #b26a00; }
.ace-health__icon--unhealthy { color: #c62828; }
.ace-health__icon--unknown { opacity: 0.5; }

/* Wraps rather than truncating. These lines are failure reasons, and the half of
   one that fits is rarely the informative half. */
.ace-health__detail {
    font-size: 0.75rem;
    opacity: 0.7;
    overflow-wrap: anywhere;
}
