/* Circuit reconnection toast + overlay (see js/circuit-reconnect.js and App.razor).
   Plain CSS with a self-contained spinner — no icon-font dependency — so it renders
   correctly on every page (including those that don't load Bootstrap Icons) and while
   the Blazor circuit is down. Bootstrap CSS variables are used where available, with
   light-theme fallbacks, so the toast follows the active data-bs-theme. */

.circuit-toast {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1100;
    max-width: 380px;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
}

.circuit-toast.circuit-toast-visible {
    display: flex;
    animation: circuit-toast-in 0.2s ease-out;
}

@keyframes circuit-toast-in {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.circuit-toast-warning { border-left: 4px solid var(--bs-warning, #ffc107); }
.circuit-toast-error   { border-left: 4px solid var(--bs-danger, #dc3545); }

.circuit-toast-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 2px;
}

/* No spinner in the terminal "session expired" state. */
.circuit-toast-error .circuit-toast-icon { display: none; }

.circuit-toast-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--bs-border-color, rgba(0, 0, 0, 0.15));
    border-top-color: var(--bs-primary, #0d6efd);
    border-radius: 50%;
    animation: circuit-spin 0.8s linear infinite;
}

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

.circuit-toast-content { min-width: 0; }
.circuit-toast-title { font-weight: 600; line-height: 1.2; }
.circuit-toast-message { font-size: 0.875rem; opacity: 0.85; margin-top: 0.15rem; }

.circuit-toast-action {
    margin-top: 0.6rem;
    padding: 0.35rem 0.9rem;
    border: 0;
    border-radius: 0.375rem;
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
.circuit-toast-action:hover { filter: brightness(0.92); }

/* Draws the eye when the user clicks during downtime (Blazor handlers are dead). */
.circuit-toast-flash { animation: circuit-toast-flash 0.6s ease-out; }
@keyframes circuit-toast-flash {
    0%   { box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18); transform: scale(1); }
    15%  { box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.5), 0 0.5rem 1.5rem rgba(220, 53, 69, 0.4); transform: scale(1.04); }
    100% { box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18); transform: scale(1); }
}

/* Full-screen overlay shown briefly while the page reloads. */
#circuit-reconnect-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}
#circuit-reconnect-overlay > div { text-align: center; color: #fff; }
.circuit-overlay-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.75rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: circuit-spin 0.8s linear infinite;
}
.circuit-overlay-text { font-size: 1rem; }
