/**
 * ErrorPopup CSS - Reusable error notification styles
 * 
 * Features:
 * - Modern, clean design
 * - Smooth animations
 * - Multiple error types with color coding
 * - Mobile responsive
 * - High contrast for accessibility
 * 
 * Usage:
 * Include this CSS file in your HTML:
 * <link rel="stylesheet" href="error-popup.css">
 */

/* Base popup styles */
.error-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: #000;
    padding: 16px 20px;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 400;
    z-index: 10000;
    max-width: 400px;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
    border: 1px solid #dc3545;
    border-left: 4px solid #dc3545;
    font-family: 'Oswald', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
}

/* Error type variations */
.error-popup.error-type-error {
    background: #fdf2f2;
    border-color: #dc3545;
    border-left-color: #dc3545;
    color: #000;
}

.error-popup.error-type-rate-limit {
    background: #fffaf7;
    border-color: #fd7e14;
    border-left-color: #fd7e14;
    color: #000;
}

.error-popup.error-type-warning {
    background: #fffdf7;
    border-color: #ffc107;
    border-left-color: #ffc107;
    color: #000;
}

.error-popup.error-type-info {
    background: #f7fcfd;
    border-color: #17a2b8;
    border-left-color: #17a2b8;
    color: #000;
}

.error-popup.error-type-success {
    background: #f8fdf9;
    border-color: #28a745;
    border-left-color: #28a745;
    color: #000;
}

/* Popup components */
.error-popup-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
}

.error-popup-content {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

.error-popup-title {
    font-weight: 400;
    margin-bottom: 4px;
    font-size: 0.95rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error-popup-message {
    font-weight: 300;
    opacity: 0.9;
    line-height: 1.4;
    word-wrap: break-word;
    hyphens: auto;
}

.error-popup-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    font-weight: bold;
    line-height: 1;
}

.error-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.error-popup-close:focus {
    outline: 2px solid rgba(0, 0, 0, 0.3);
    outline-offset: 1px;
}

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

.error-popup.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

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

/* Mobile responsiveness */
@media (max-width: 480px) {
    .error-popup {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: 0;
        padding: 14px 16px;
        font-size: 0.85rem;
    }
    
    .error-popup-title {
        font-size: 0.9rem;
    }
    
    .error-popup-icon {
        font-size: 1.1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .error-popup {
        border: 2px solid currentColor;
        box-shadow: none;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .error-popup {
        animation: none;
    }
    
    .error-popup.fade-out {
        animation: none;
        opacity: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .error-popup.error-type-warning {
        background: #e58e00;
        color: white;
    }
}

/* Multiple popups stacking */
.error-popup:nth-of-type(2) {
    top: 100px;
}

.error-popup:nth-of-type(3) {
    top: 180px;
}

.error-popup:nth-of-type(4) {
    top: 260px;
}

.error-popup:nth-of-type(n+5) {
    display: none; /* Hide excessive popups */
}

/* Focus trap for accessibility */
.error-popup:focus-within {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}