.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

/* Blazor keeps "components-reconnect-show" alongside the later states, so hide the first-attempt text then */
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-paused .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-reconnect-first-attempt-visible {
    display: none;
}

/* While the bar is open, push the page down so nothing sits underneath it */
html.reconnect-bar-open body {
    padding-top: var(--reconnect-bar-height, 0px);
}

html.reconnect-bar-open header.sticky,
html.reconnect-bar-open .admin-topbar {
    top: var(--reconnect-bar-height, 0px) !important;
}

html.reconnect-bar-open aside.fixed,
html.reconnect-bar-open .admin-sidebar {
    margin-top: var(--reconnect-bar-height, 0px);
}

html.reconnect-bar-open .admin-sidebar {
    height: calc(100dvh - var(--reconnect-bar-height, 0px));
}

/* Non-modal top bar instead of a centered popup; fixed so it stays on top while scrolling */
#components-reconnect-modal {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 2147483647;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
}

#components-reconnect-modal:not([open]) {
    display: none;
}

.reconnect-bar {
    background: linear-gradient(90deg, #881337 0%, #be123c 50%, #881337 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 22px rgba(136, 19, 55, 0.35);
}

#components-reconnect-modal[open] .reconnect-bar {
    animation: reconnect-slide-down 0.35s ease-out;
}

.reconnect-icon {
    animation: reconnect-pulse 1.4s ease-in-out infinite;
}

.reconnect-dots > span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background: currentColor;
    animation: reconnect-bounce 1.2s ease-in-out infinite;
}

.reconnect-dots > span:nth-child(2) {
    animation-delay: 0.15s;
}

.reconnect-dots > span:nth-child(3) {
    animation-delay: 0.3s;
}

/* Indeterminate progress sweep along the bottom edge */
.reconnect-progress {
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.reconnect-progress::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
    animation: reconnect-sweep 1.6s ease-in-out infinite;
}

@keyframes reconnect-slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes reconnect-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}

@keyframes reconnect-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-0.3rem);
        opacity: 1;
    }
}

@keyframes reconnect-sweep {
    from {
        right: -35%;
    }
    to {
        right: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal[open] .reconnect-bar {
        animation: none;
    }

    .reconnect-icon,
    .reconnect-dots > span,
    .reconnect-progress::after {
        animation-duration: 3s;
    }
}
