/**
 * Error Handling & Notification System Styles
 * 
 * Provides styles for error notifications, loading states, and
 * visual feedback for the Projecta Portal error handling system.
 */

/* Global Error Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 
                0 2px 16px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    min-width: 300px;
    transform: translateX(420px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-message {
    flex: 1;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Notification Type Styles */
.notification-error {
    background: linear-gradient(135deg, #fee, #fdd);
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

.notification-error .notification-message {
    color: #c0392b;
}

.notification-error::before {
    content: "⚠️";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    margin-right: 8px;
}

.notification-error .notification-content {
    margin-left: 24px;
}

.notification-success {
    background: linear-gradient(135deg, #eef9e7, #d4edda);
    border-left: 4px solid #74b72a;
    color: #27ae60;
}

.notification-success .notification-message {
    color: #27ae60;
}

.notification-success::before {
    content: "✅";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.notification-success .notification-content {
    margin-left: 24px;
}

.notification-warning {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-left: 4px solid #f39c12;
    color: #e67e22;
}

.notification-warning .notification-message {
    color: #e67e22;
}

.notification-warning::before {
    content: "⚡";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.notification-warning .notification-content {
    margin-left: 24px;
}

.notification-info {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-left: 4px solid #3498db;
    color: #2980b9;
}

.notification-info .notification-message {
    color: #2980b9;
}

.notification-info::before {
    content: "ℹ️";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.notification-info .notification-content {
    margin-left: 24px;
}

/* Loading States */
.global-loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(116, 183, 42, 0.2);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.global-loading-indicator::before {
    content: "";
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #74b72a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading States for Specific Elements */
[data-loading-for].loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

[data-loading-for].loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #74b72a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Button Loading States */
button.loading, 
.button.loading,
.action-link.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after,
.button.loading::after,
.action-link.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid #74b72a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error State Styling for Form Elements */
.error-state {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
    background-color: rgba(231, 76, 60, 0.05) !important;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-message::before {
    content: "⚠️";
    font-size: 14px;
}

/* Success State Styling */
.success-state {
    border-color: #74b72a !important;
    box-shadow: 0 0 0 2px rgba(116, 183, 42, 0.2) !important;
    background-color: rgba(116, 183, 42, 0.05) !important;
}

.success-message {
    color: #74b72a;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.success-message::before {
    content: "✅";
    font-size: 14px;
}

/* Modal Error States */
.portal-modal .error-notification {
    background: linear-gradient(135deg, #fee, #fdd);
    border: 1px solid #e74c3c;
    color: #c0392b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.portal-modal .error-notification::before {
    content: "⚠️";
    font-size: 16px;
}

.portal-modal .success-notification {
    background: linear-gradient(135deg, #eef9e7, #d4edda);
    border: 1px solid #74b72a;
    color: #27ae60;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.portal-modal .success-notification::before {
    content: "✅";
    font-size: 16px;
}

/* Retry Button Styling */
.retry-button {
    background: linear-gradient(135deg, #74b72a 0%, #5a9020 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(116, 183, 42, 0.3);
}

.retry-button:hover {
    background: linear-gradient(135deg, #5a9020 0%, #4a7818 100%);
    box-shadow: 0 4px 12px rgba(116, 183, 42, 0.4);
    transform: translateY(-1px);
}

.retry-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(116, 183, 42, 0.3);
}

/* Network Offline Indicator */
.network-offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    z-index: 10001;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.network-offline-indicator::before {
    content: "📡";
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .global-loading-indicator {
        left: 10px;
        right: 10px;
        transform: translateY(-50%);
        padding: 20px;
    }
    
    .network-offline-indicator {
        left: 10px;
        right: 10px;
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .notification {
        background: rgba(40, 40, 40, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .notification-message {
        color: #e0e0e0;
    }
    
    .notification-close {
        color: #ccc;
    }
    
    .notification-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .global-loading-indicator {
        background: rgba(40, 40, 40, 0.95);
        color: #e0e0e0;
        border: 1px solid rgba(116, 183, 42, 0.3);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .notification {
        border: 2px solid;
    }
    
    .notification-error {
        border-color: #c0392b;
    }
    
    .notification-success {
        border-color: #27ae60;
    }
    
    .notification-warning {
        border-color: #e67e22;
    }
    
    .notification-info {
        border-color: #2980b9;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .notification,
    .global-loading-indicator,
    .retry-button,
    [data-loading-for].loading::after,
    button.loading::after,
    .button.loading::after,
    .action-link.loading::after {
        transition: none;
        animation: none;
    }
    
    .global-loading-indicator::before {
        animation: none;
        transform: none;
        border: 3px solid #74b72a;
    }
} 