/**
 * Blazor Reconnection Modal - Microsoft's Battle-Tested Way
 *
 * Blazor automatically manages this element by adding CSS classes:
 * - .components-reconnect-show (during reconnection)
 * - .components-reconnect-failed (when failed)
 * - .components-reconnect-rejected (when rejected)
 *
 * We just provide the styling. Blazor does all the logic!
 */

/* Modal container - hidden by default */
#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

/* Blazor shows modal by adding these classes */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex !important;
}

/* Allow JavaScript to hide modal during delay period */
#components-reconnect-modal.js-delayed-hide {
    display: none !important;
}

/* Hide all state divs by default */
#components-reconnect-modal > div {
    display: none;
}

/* Show appropriate state based on Blazor's class */
#components-reconnect-modal.components-reconnect-show > .show {
    display: block;
}

#components-reconnect-modal.components-reconnect-failed > .failed {
    display: block;
}

#components-reconnect-modal.components-reconnect-rejected > .rejected {
    display: block;
}

/* Modal content styling */
.modal-content {
    background: #ffffff;
    max-width: 540px;
    width: 90%;
    padding: 32px;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    display: block;
    margin: 0 auto 20px;
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: #424242;
    margin: 0 0 12px 0;
}

.modal-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #424242;
    margin: 0 0 20px 0;
}

/* Info box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #0d47a1;
    margin-bottom: 24px;
    text-align: left;
}

.info-box svg {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Spinner for reconnecting state */
.spinner-container {
    margin: 20px 0;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button group */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.button-group button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.button-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button-group button:active {
    transform: translateY(0);
}

.button-group button svg {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 24px 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Blazor Error UI Modal (replaces yellow bar)
   ============================================ */

#blazor-error-ui {
    display: none; /* hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

/* If Blazor sets inline style display:block, show as modal */
#blazor-error-ui[style*="display: block"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* And when we explicitly add .show */
#blazor-error-ui.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

#blazor-error-ui .error-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Reuse .modal-content/.modal-icon/.info-box styles above */
