/**
 * QR Core Error Handling Styles
 * Comprehensive error notification and recovery UI
 */

/* Error notification container */
.qr-error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    pointer-events: none;
}

/* Error notification base styles */
.qr-error-notification {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    max-width: 100%;
}

.qr-error-notification.qr-error-error {
    border-left: 4px solid #ef4444;
}

.qr-error-notification.qr-error-warning {
    border-left: 4px solid #f59e0b;
}

.qr-error-notification.qr-error-info {
    border-left: 4px solid #3b82f6;
}

/* Error notification header */
.qr-error-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.qr-error-header i {
    font-size: 18px;
    margin-right: 12px;
    color: #ef4444;
}

.qr-error-warning .qr-error-header i {
    color: #f59e0b;
}

.qr-error-info .qr-error-header i {
    color: #3b82f6;
}

.qr-error-header h4 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.qr-error-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.qr-error-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

/* Error notification body */
.qr-error-body {
    padding: 0 16px 16px 16px;
}

.qr-error-body p {
    margin: 0 0 8px 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.qr-error-suggestion {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #0369a1;
    margin: 8px 0 !important;
}

/* Error notification actions */
.qr-error-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.qr-error-action {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-error-action.primary {
    background: #6366f1;
    color: white;
}

.qr-error-action.primary:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

.qr-error-action.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.qr-error-action.secondary:hover {
    background: #e5e7eb;
}

/* Fatal error overlay */
.qr-core-fatal-error {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.qr-fatal-overlay {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.qr-fatal-dialog {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

.qr-fatal-header {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #fecaca;
}

.qr-fatal-header i {
    font-size: 24px;
    color: #ef4444;
    margin-right: 12px;
}

.qr-fatal-header h2 {
    margin: 0;
    color: #dc2626;
    font-size: 20px;
    font-weight: 600;
}

.qr-fatal-body {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.qr-fatal-body p {
    margin: 0 0 12px 0;
    color: #4b5563;
    line-height: 1.6;
}

.qr-fatal-message {
    background: #fef3f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: 13px;
    color: #dc2626;
    word-break: break-word;
}

.qr-fatal-suggestion {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    border-radius: 8px;
    padding: 12px;
    color: #0369a1;
    font-size: 14px;
}

.qr-fatal-details {
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.qr-fatal-details summary {
    background: #f9fafb;
    padding: 12px;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.qr-fatal-details summary:hover {
    background: #f3f4f6;
}

.qr-fatal-details pre {
    margin: 0;
    padding: 16px;
    background: #1f2937;
    color: #f3f4f6;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.qr-fatal-actions {
    background: #f9fafb;
    padding: 20px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #e5e7eb;
}

.qr-btn {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qr-btn-primary {
    background: #6366f1;
    color: white;
    flex: 1;
}

.qr-btn-primary:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

.qr-btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.qr-btn-secondary:hover {
    background: #f9fafb;
}

/* Basic UI fallback styles */
#qr-basic-ui {
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.qr-basic-container {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.qr-basic-container h1 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 24px;
}

.qr-basic-container p {
    margin: 0 0 24px 0;
    color: #6b7280;
}

#qr-basic-input {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

#qr-basic-input:focus {
    outline: none;
    border-color: #6366f1;
}

.qr-basic-container button {
    background: #6366f1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-basic-container button:hover {
    background: #5855eb;
    transform: translateY(-1px);
}

#qr-basic-output {
    margin-top: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

/* Responsive design */
@media (max-width: 640px) {
    .qr-error-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }

    .qr-fatal-dialog {
        margin: 20px;
        max-height: 90vh;
    }

    .qr-fatal-actions {
        flex-direction: column;
    }

    .qr-error-actions {
        flex-direction: column;
    }

    .qr-error-action {
        width: 100%;
    }
}