/* Styling for the custom Blazor reconnect display (#components-reconnect-modal in App.razor).
   When that element exists, Blazor skips its built-in full-screen overlay and ONLY toggles
   state classes on ours — it applies no styles of its own, so hiding the element by default
   is our job. State classes verified against Microsoft.AspNetCore.Components.Endpoints 8.0.27. */

#components-reconnect-modal {
    display: none;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2000; /* above #blazor-error-ui (1000) so the two can't overlap */
    max-width: min(24rem, calc(100vw - 2rem));
}

    /* The three states worth surfacing. `components-reconnect-hide` intentionally has no rule:
       falling back to the base display:none is what hides the toast after a successful retry. */
    #components-reconnect-modal.components-reconnect-show,
    #components-reconnect-modal.components-reconnect-failed,
    #components-reconnect-modal.components-reconnect-rejected {
        display: block;
    }

.rs-reconnect-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(23, 25, 35, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color: #e8eaf6;
    font-size: 0.9rem;
    line-height: 1.35;
    backdrop-filter: blur(6px);
}

.rs-reconnect-spinner {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: rs-reconnect-spin 0.8s linear infinite;
}

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

/* Nothing is actually retrying in the failed state, so a spinner there would be a lie. */
.components-reconnect-failed .rs-reconnect-spinner {
    display: none;
}

/* One span per state; the active one is revealed by the matching state class below. */
.rs-reconnect-retrying,
.rs-reconnect-expired,
.rs-reconnect-lost {
    display: none;
}

.components-reconnect-show .rs-reconnect-retrying,
.components-reconnect-rejected .rs-reconnect-expired,
.components-reconnect-failed .rs-reconnect-lost {
    display: inline;
}

.rs-reconnect-attempt {
    opacity: 0.65;
}

.rs-reconnect-btn {
    margin-left: 0.4rem;
    padding: 0.15rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

    .rs-reconnect-btn:hover {
        background: rgba(99, 102, 241, 0.3);
        color: #fff;
    }

@media (max-width: 480px) {
    #components-reconnect-modal {
        right: 0.5rem;
        left: 0.5rem;
        bottom: 0.5rem;
        max-width: none;
    }
}

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