/* Circuit-reconnection overlay. Driven by wwwroot/js/reconnect.js and by the
   components-reconnect-* classes Blazor puts on #components-reconnect-modal.

   Deliberately plain CSS with no dependency on MudBlazor: it has to render correctly at the exact
   moment the server is gone, which is when nothing can be fetched and no component can re-render. */

#components-reconnect-modal {
    display: none;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected,
#components-reconnect-modal.artstore-reconnect-waiting {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* Covers the frozen page rather than sitting on top of it: half-rendered controls that no
       longer respond to clicks read as a broken app. */
    background: rgba(17, 17, 17, 0.72);
    backdrop-filter: blur(2px);
}

#components-reconnect-modal .reconnect-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 22rem;
    width: 100%;
    padding: 1.75rem 1.5rem;
    border-radius: 0.75rem;
    background: #fff;
    color: #212121;
    text-align: center;
    font-family: Roboto, "Segoe UI", system-ui, sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

#components-reconnect-modal .reconnect-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid rgba(167, 207, 71, 0.3);
    border-top-color: #a7cf47;
    border-radius: 50%;
    animation: artstore-reconnect-spin 900ms linear infinite;
}

#components-reconnect-modal #reconnect-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

#components-reconnect-modal #reconnect-detail {
    margin: 0;
    font-size: 0.875rem;
    color: #616161;
}

#components-reconnect-modal #reconnect-detail:empty {
    display: none;
}

/* The manual escape hatch only exists once automatic recovery has given up (three reloads inside
   a minute), so it stays hidden through the normal path. */
#components-reconnect-modal #reconnect-retry {
    display: none;
    margin-top: 0.25rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 2rem;
    background: #a7cf47;
    color: #1a1a1a;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

#components-reconnect-modal.artstore-reconnect-manual #reconnect-retry {
    display: inline-block;
}

#components-reconnect-modal.artstore-reconnect-manual .reconnect-spinner {
    display: none;
}

@keyframes artstore-reconnect-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal .reconnect-spinner {
        animation-duration: 3s;
    }
}
