/* Quiet reconnect indicator (#1186): replaces Blazor's default "Rejoining the server..." dialog. Hidden until
   blazor.web.js adds components-reconnect-show / -failed / -rejected to #components-reconnect-modal.
   No dimmed screen and no dialog: the page stays as it is (a transparent layer only stops taps from getting
   lost while there is no connection), and a small pill at the top says "Syncing…". The pill fades in after
   2 seconds, so the usual short drops (switching apps, a tunnel) show nothing at all. */

#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: block;
}

#components-reconnect-modal .cp-reconnect-pill {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 50%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 32px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.05);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, -6px);
    animation: cp-reconnect-in 0.3s ease 2s forwards;
}

/* Reloading after the session ended: say so straight away. */
#components-reconnect-modal.components-reconnect-rejected .cp-reconnect-pill {
    animation-delay: 0s;
}

/* A soft breathing dot, like a sync in progress. */
#components-reconnect-modal .cp-reconnect-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22a06b;
    animation: cp-reconnect-breathe 1.6s ease-in-out infinite;
}

#components-reconnect-modal .cp-reconnect-state {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .cp-reconnect-state--show,
#components-reconnect-modal.components-reconnect-failed .cp-reconnect-state--failed,
#components-reconnect-modal.components-reconnect-rejected .cp-reconnect-state--rejected {
    display: inline;
}

@keyframes cp-reconnect-in {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes cp-reconnect-breathe {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal .cp-reconnect-pill {
        animation: none;
        opacity: 1;
        transform: translate(-50%, 0);
    }

    #components-reconnect-modal .cp-reconnect-dot {
        animation: none;
    }
}
