/*
 * Public-site Blazor Server host: shell-only styles (error bar + reconnect overlay).
 * Everything else comes from the shared EGKitsPublic wwwroot.
 */

#blazor-error-ui {
    display: none;
    background: #c51244;
    color: #fff;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    z-index: 1000;
    font-family: Inter, Roboto, Arial, sans-serif;
}

    #blazor-error-ui .dismiss {
        position: absolute;
        right: .75rem;
        top: .5rem;
        cursor: pointer;
        background: transparent;
        border: 0;
        color: #fff;
        font-size: 1.25rem;
    }

    [dir="rtl"] #blazor-error-ui .dismiss {
        right: auto;
        left: .75rem;
    }

    #blazor-error-ui .reload {
        color: #fff;
        text-decoration: underline;
    }

/*
 * MudBlazor.min.css ships
 *   #components-reconnect-modal { z-index:9999 !important;
 *                                 background-color: var(--mud-palette-background) !important }
 * Once MudThemeProvider defines the palette that turns the overlay into an OPAQUE
 * sheet in the theme's page colour with white text on it — visitors saw a
 * "completely blank page" for the whole reconnect. The selector below is more
 * specific AND !important so the translucent backdrop always wins, whatever the
 * stylesheet order; the page stays visible underneath.
 */
body > #components-reconnect-modal {
    position: fixed;
    inset: 0;
    z-index: 10000 !important;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(7, 11, 26, .45) !important;
    background-color: rgba(7, 11, 26, .45) !important;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    color: #fff;
    font-family: Inter, Roboto, Arial, sans-serif;
    text-align: center;
    padding: 1rem;
}

    /* Legible on ANY backdrop (light or dark theme): the copy sits on its own card. */
    body > #components-reconnect-modal .reconnect-card {
        background: rgba(15, 23, 42, .94);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: .875rem;
        box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
        padding: 1.5rem 2rem;
        max-width: 26rem;
        line-height: 1.45;
    }

        body > #components-reconnect-modal .reconnect-card h4 {
            margin: 0 0 .5rem;
            font-size: 1.125rem;
            font-weight: 600;
            color: #fff;
        }

        body > #components-reconnect-modal .reconnect-card p {
            margin: 0;
            font-size: .9375rem;
            color: rgba(255, 255, 255, .85);
        }

        body > #components-reconnect-modal .reconnect-card a {
            color: #fff;
            text-decoration: underline;
        }

        body > #components-reconnect-modal .reconnect-hint:empty {
            display: none;
        }

    /* Manual reload is offered only after a long outage (.reconnect-long, set by
       public-server-shell.js) and never while a resume or an automatic refresh is
       already in progress, nor while the browser itself is offline: reloading then
       just swaps this page for the browser's error screen and throws away the state
       that reconnect/resume would have preserved. */
    body > #components-reconnect-modal .reconnect-reload {
        display: none;
        margin-top: .875rem;
        font-size: .8125rem;
        color: rgba(255, 255, 255, .7);
    }

    body > #components-reconnect-modal.reconnect-long .reconnect-reload {
        display: block;
    }

    body > #components-reconnect-modal.components-reconnect-resuming .reconnect-reload,
    body > #components-reconnect-modal.components-reconnect-rejected .reconnect-reload,
    body > #components-reconnect-modal.reconnect-offline .reconnect-reload {
        display: none;
    }

    /* Small animated bar so a long reconnect never looks frozen. */
    body > #components-reconnect-modal .reconnect-progress {
        height: 3px;
        margin: 1rem auto 0;
        width: 100%;
        border-radius: 2px;
        background: rgba(255, 255, 255, .15);
        overflow: hidden;
        position: relative;
    }

        body > #components-reconnect-modal .reconnect-progress::after {
            content: '';
            position: absolute;
            inset: 0 auto 0 -40%;
            width: 40%;
            border-radius: 2px;
            background: #34d399;
            animation: egk-reconnect-sweep 1.4s ease-in-out infinite;
        }

    /* Browser reports offline: a static amber bar instead of a sweep that would
       suggest activity that is not happening. */
    body > #components-reconnect-modal.reconnect-offline .reconnect-progress::after {
        animation: none;
        left: 0;
        width: 100%;
        background: #f59e0b;
        opacity: .7;
    }

    @keyframes egk-reconnect-sweep {
        to { left: 100%; }
    }

    @media (prefers-reduced-motion: reduce) {
        body > #components-reconnect-modal .reconnect-progress::after { animation: none; left: 0; width: 100%; opacity: .6; }
    }

    /* Every non-hidden state the .NET 10 client can apply must be visible. */
    body > #components-reconnect-modal.components-reconnect-show,
    body > #components-reconnect-modal.components-reconnect-retrying,
    body > #components-reconnect-modal.components-reconnect-failed,
    body > #components-reconnect-modal.components-reconnect-rejected,
    body > #components-reconnect-modal.components-reconnect-paused,
    body > #components-reconnect-modal.components-reconnect-resume-failed,
    body > #components-reconnect-modal.components-reconnect-resuming {
        display: flex;
    }

    body > #components-reconnect-modal.components-reconnect-hide {
        display: none;
    }
