/**
 * Error Boundary Styles
 * Story 2: Error Boundary & Recovery System
 */

/* Fallback UI Container */
.error-boundary-fallback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease-in-out;
}

.error-boundary-fallback.hidden {
    display: none;
}

/* Error Content Box */
.error-boundary-content {
    background: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--border-color, #404040);
    border-radius: 12px;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

/* Error Icon */
.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

/* Error Title */
.error-boundary-content h2 {
    color: var(--text-primary, #e0e0e0);
    font-size: 1.8rem;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

/* Error Message */
.error-message {
    color: var(--text-secondary, #b0b0b0);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
}

/* Error Details */
.error-details {
    margin: 1.5rem 0;
    text-align: left;
}

.error-details details {
    background: var(--bg-tertiary, #333333);
    border: 1px solid var(--border-color, #404040);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.error-details summary {
    cursor: pointer;
    color: var(--text-secondary, #b0b0b0);
    font-size: 0.9rem;
    user-select: none;
    padding: 0.5rem;
    margin: -0.5rem;
}

.error-details summary:hover {
    color: var(--text-primary, #e0e0e0);
}

.error-details pre {
    margin: 1rem 0 0 0;
    padding: 1rem;
    background: var(--bg-primary, #1a1a1a);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--text-secondary, #b0b0b0);
    max-height: 200px;
    overflow-y: auto;
}

/* Error Actions */
.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Error Buttons */
.error-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.error-btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.error-btn:hover:before {
    width: 300px;
    height: 300px;
}

.error-btn-primary {
    background: var(--accent-color, #4a9eff);
    color: white;
}

.error-btn-primary:hover {
    background: #3a8eef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 158, 255, 0.3);
}

.error-btn-secondary {
    background: var(--bg-tertiary, #333333);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-color, #404040);
}

.error-btn-secondary:hover {
    background: var(--bg-secondary, #2a2a2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.error-btn-tertiary {
    background: transparent;
    color: var(--text-secondary, #b0b0b0);
    border: 1px solid var(--border-color, #404040);
}

.error-btn-tertiary:hover {
    border-color: var(--text-primary, #e0e0e0);
    color: var(--text-primary, #e0e0e0);
}

/* Recovery Status */
.error-recovery-status {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-tertiary, #333333);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary, #b0b0b0);
}

.error-recovery-status.hidden {
    display: none;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #404040);
    border-top: 2px solid var(--accent-color, #4a9eff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error Notification (less intrusive) */
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary, #2a2a2a);
    border: 1px solid var(--error-color, #ff4444);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    max-width: 400px;
    z-index: 99998;
    animation: slideInRight 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.2);
}

.error-notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.error-notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-notification-message {
    flex: 1;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.95rem;
    line-height: 1.4;
}

.error-notification-close {
    background: none;
    border: none;
    color: var(--text-secondary, #b0b0b0);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.error-notification-close:hover {
    background: var(--bg-tertiary, #333333);
    color: var(--text-primary, #e0e0e0);
}

/* Error Toast (minimal) */
.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(42, 42, 42, 0.95);
    color: var(--text-secondary, #b0b0b0);
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-size: 0.9rem;
    z-index: 99997;
    animation: slideUp 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .error-boundary-content {
        padding: 2rem;
        width: 95%;
    }
    
    .error-icon {
        font-size: 3rem;
    }
    
    .error-boundary-content h2 {
        font-size: 1.5rem;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-btn {
        width: 100%;
    }
    
    .error-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .error-boundary-fallback,
    .error-boundary-content,
    .error-notification,
    .error-toast,
    .spinner {
        animation: none;
    }
    
    .error-btn:hover {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .error-boundary-content {
        border-width: 2px;
    }
    
    .error-btn {
        border: 2px solid currentColor;
    }
    
    .error-notification {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {
    .error-boundary-fallback,
    .error-notification,
    .error-toast {
        display: none !important;
    }
}