/* ============================================
   Blazor Server reconnection overlay — Rural Premium
   Styles the #components-reconnect-modal element that blazor.web.js
   toggles via state classes when the SignalR circuit drops:
     .components-reconnect-show      → connection lost, retrying
     .components-reconnect-retrying  → a reconnect attempt is in flight (.NET 10)
     .components-reconnect-failed    → retries exhausted; offer manual retry
     .components-reconnect-rejected  → server reached but circuit gone; reload
     .components-reconnect-hide      → reconnected (overlay hidden)
   Uses the shared design tokens from rural-premium.css (linked first).
   ============================================ */

#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay, rgba(26, 26, 46, 0.95));
    backdrop-filter: blur(2px);
    font-family: var(--font-family-body, 'Roboto', sans-serif);
}

/* Blazor adds .components-reconnect-show / -failed / -rejected when the
   overlay should be visible; -hide when it should not. */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none;
}

.reconnect-dialog {
    max-width: 28rem;
    width: calc(100% - 2 * var(--space-lg, 1.5rem));
    margin: var(--space-lg, 1.5rem);
    padding: var(--space-xl, 2rem);
    text-align: center;
    color: var(--text-primary, #f5f0e8);
    background: var(--bg-surface, #16213e);
    border: 1px solid var(--border-strong, #3a4a7a);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.3));
}

.reconnect-spinner {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto var(--space-md, 1rem);
    border: 3px solid var(--accent-gold-muted, rgba(184, 150, 90, 0.2));
    border-top-color: var(--accent-gold, #b8965a);
    border-radius: var(--radius-full, 9999px);
    animation: reconnect-spin 0.9s linear infinite;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .reconnect-spinner { animation: none; }
}

.reconnect-title {
    margin: 0 0 var(--space-sm, 0.75rem);
    font-family: var(--font-family-heading, 'Bebas Neue', sans-serif);
    font-size: var(--font-size-2xl, 2rem);
    letter-spacing: 0.02em;
    color: var(--text-primary, #f5f0e8);
}

.reconnect-message {
    margin: 0 0 var(--space-lg, 1.5rem);
    font-size: var(--font-size-base, 1rem);
    color: var(--text-secondary, #d4cdbe);
}

/* Per-state message + action visibility, driven by the parent state class. */
.reconnect-state { display: none; }
#components-reconnect-modal.components-reconnect-show .reconnect-state-retrying,
#components-reconnect-modal.components-reconnect-retrying .reconnect-state-retrying { display: block; }
#components-reconnect-modal.components-reconnect-failed .reconnect-state-failed { display: block; }
#components-reconnect-modal.components-reconnect-rejected .reconnect-state-rejected { display: block; }

/* While actively retrying, the spinner shows; on failure/rejection it hides. */
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner { display: none; }

.reconnect-actions {
    display: flex;
    gap: var(--space-sm, 0.75rem);
    justify-content: center;
    flex-wrap: wrap;
}

.reconnect-btn {
    appearance: none;
    cursor: pointer;
    padding: var(--space-sm, 0.75rem) var(--space-lg, 1.5rem);
    font-family: var(--font-family-body, 'Roboto', sans-serif);
    font-size: var(--font-size-sm, 1rem);
    font-weight: 700;
    border-radius: var(--radius-md, 8px);
    border: 1px solid transparent;
    transition: background var(--transition-fast, 150ms ease-in-out),
                color var(--transition-fast, 150ms ease-in-out);
}

.reconnect-btn-primary {
    background: var(--accent-gold, #b8965a);
    color: var(--on-accent, #1a1a2e);
}

.reconnect-btn-primary:hover {
    background: var(--accent-gold-hover, #cba76a);
}

.reconnect-btn-secondary {
    background: transparent;
    color: var(--text-primary, #f5f0e8);
    border-color: var(--border-strong, #3a4a7a);
}

.reconnect-btn-secondary:hover {
    background: var(--bg-elevated, #0f3460);
}
