/**
 * CONNECTION OVERLAY - Elegant Error Display
 * Replaces ugly JS alerts with beautiful CSS overlay
 */

.connection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.connection-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.connection-modal {
    background: white;
    border-radius: 24px;
    padding: 48px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.connection-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.connection-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.connection-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
}

.connection-message {
    font-size: 16px;
    line-height: 1.6;
    color: #6B7280;
    margin: 0 0 32px 0;
}

.connection-message strong {
    color: #111827;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: #FEF2F2;
    border-radius: 12px;
    margin-bottom: 24px;
}

.connection-status-dot {
    width: 12px;
    height: 12px;
    background: #EF4444;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.connection-status-text {
    font-size: 14px;
    font-weight: 600;
    color: #991B1B;
}

.connection-retry {
    width: 100%;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(43, 76, 126, 0.3);
}

.connection-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(43, 76, 126, 0.4);
}

.connection-retry:active {
    transform: translateY(0);
}

.connection-help {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.connection-help-title {
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.connection-help-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.connection-help-list li {
    font-size: 14px;
    color: #6B7280;
    padding: 8px 0;
    padding-left: 28px;
    position: relative;
}

.connection-help-list li::before {
    content: '→';
    position: absolute;
    left: 8px;
    color: var(--primary-500);
    font-weight: bold;
}

/* Loading state */
.connection-overlay.loading .connection-icon {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
}

.connection-overlay.loading .connection-status {
    background: #EFF6FF;
}

.connection-overlay.loading .connection-status-dot {
    background: #3B82F6;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.connection-overlay.loading .connection-status-text {
    color: #1E40AF;
}

/* Success state (briefly shown before hiding) */
.connection-overlay.success .connection-icon {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.connection-overlay.success .connection-status {
    background: #ECFDF5;
}

.connection-overlay.success .connection-status-dot {
    background: #10B981;
    animation: none;
}

.connection-overlay.success .connection-status-text {
    color: #065F46;
}
