/* ============================================
   Blazor Reconnection Modal
   ============================================ */

/* Base modal */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

/* Show/hide states */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex !important;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none !important;
}

/* Modal content */
.reconnect-modal-content {
    background: var(--mud-palette-surface);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 16px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(124, 58, 237, 0.1);
}

/* Icon */
.reconnect-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

/* Failed state */
#components-reconnect-modal.components-reconnect-failed .reconnect-icon,
#components-reconnect-modal.components-reconnect-rejected .reconnect-icon {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
    animation: none;
}

/* Typography */
.reconnect-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin-bottom: 1rem;
}

.reconnect-message {
    font-size: 0.9375rem;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Message states */
.reconnect-attempting,
.reconnect-failed,
.reconnect-rejected {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .reconnect-attempting {
    display: block;
}

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

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

/* Progress bar */
.reconnect-progress {
    width: 100%;
    height: 4px;
    background: var(--mud-palette-lines-default);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-progress,
#components-reconnect-modal.components-reconnect-rejected .reconnect-progress {
    display: none;
}

.reconnect-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7C3AED, #A78BFA, #7C3AED);
    background-size: 200% 100%;
    animation: progressSlide 1.5s ease-in-out infinite;
}

/* Attempt counter */
.reconnect-attempts {
    font-size: 0.875rem;
    color: var(--mud-palette-text-disabled);
    margin-bottom: 1.5rem;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-attempts,
#components-reconnect-modal.components-reconnect-rejected .reconnect-attempts {
    display: none;
}

/* Buttons */
.reconnect-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#components-reconnect-modal.components-reconnect-show .btn-reconnect-retry {
    display: none;
}

.btn-reconnect-retry {
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.btn-reconnect-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.6);
}

.btn-reconnect-reload {
    background: rgba(124, 58, 237, 0.1);
    color: var(--mud-palette-text-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reconnect-reload:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.5);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes progressSlide {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 200% 0;
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .reconnect-modal-content {
        padding: 1.5rem;
        max-width: 95%;
    }

    .reconnect-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .reconnect-title {
        font-size: 1.25rem;
    }

    .reconnect-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-reconnect-retry,
    .btn-reconnect-reload {
        width: 100%;
    }
}

/* Accessibility */
.btn-reconnect-retry:focus,
.btn-reconnect-reload:focus {
    outline: 2px solid rgba(124, 58, 237, 0.5);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .reconnect-icon,
    .reconnect-progress-bar {
        animation: none;
    }

    .btn-reconnect-retry:hover {
        transform: none;
    }
}
