/* Error / reconnect states shared by App.razor (reconnect modal), MainLayout (ErrorBoundary panel),
   Routes.razor (NotFound) and Pages/Error.razor. Colours follow main.css (--pip-darkBackground, --pip-blue). */

/* ---- Reconnect modal (driven by blazor.web.js via the components-reconnect-* classes) ---- */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(51, 51, 51, 0.55);
    align-items: center;
    justify-content: center;
    font-family: 'Comfortaa', sans-serif;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none;
}

.vision-reconnect-dialog {
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    max-width: 440px;
    width: calc(100% - 2rem);
    padding: 1.75rem 2rem;
    text-align: center;
    color: #333333;
}

    .vision-reconnect-dialog h2 {
        font-size: 1.25rem;
        margin: 0 0 0.6rem;
    }

    .vision-reconnect-dialog p {
        margin: 0 0 0.75rem;
        line-height: 1.5;
    }

/* Only the state matching the modal's current class is visible. */
.vision-reconnect-state { display: none; }
#components-reconnect-modal.components-reconnect-show .vision-reconnect-state-show,
#components-reconnect-modal.components-reconnect-failed .vision-reconnect-state-failed,
#components-reconnect-modal.components-reconnect-rejected .vision-reconnect-state-rejected {
    display: block;
}

.vision-reconnect-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #e3e3e3;
    border-top-color: var(--pip-blue, #149bd7);
    border-radius: 50%;
    animation: vision-reconnect-spin 0.9s linear infinite;
}

@keyframes vision-reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .vision-reconnect-spinner { animation: none; }
}

.vision-reconnect-button,
.vision-page-error-button,
.vision-error-link {
    display: inline-block;
    background: var(--pip-darkBackground, #333333);
    color: #ffffff !important;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    padding: 0.6rem 1.2rem;
    margin: 0.2rem 0.3rem;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

    .vision-reconnect-button:hover,
    .vision-page-error-button:hover,
    .vision-error-link:hover {
        background: var(--pip-blue, #149bd7);
    }

    .vision-reconnect-button:focus-visible,
    .vision-page-error-button:focus-visible,
    .vision-error-link:focus-visible {
        outline: 3px solid var(--pip-blue, #149bd7);
        outline-offset: 2px;
    }

.vision-reconnect-button-secondary {
    background: #888888;
}

/* ---- ErrorBoundary panel inside the main layout ---- */
.vision-page-error {
    margin: 2rem auto;
    max-width: 560px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-top: 6px solid #FF6666;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    text-align: center;
    color: #333333;
}

    .vision-page-error h2 {
        font-size: 1.3rem;
        margin: 0 0 0.6rem;
    }

/* ---- Full-page error / not-found (statically rendered, inside LoginLayout) ---- */
.vision-error-page {
    max-width: 520px;
    margin: 10vh auto 0;
    background: #ffffff;
    border-radius: 6px;
    padding: 2rem 2.5rem;
    text-align: center;
    color: #333333;
    font-family: 'Comfortaa', sans-serif;
}

    .vision-error-page h1 {
        font-size: 1.5rem;
        margin: 0 0 0.75rem;
    }

.vision-error-requestid code {
    font-size: 0.85em;
    background: #f2f2f2;
    padding: 0.15em 0.4em;
    border-radius: 3px;
}
