/* ===== NOTIFICATIONS COMPONENT ===== */
/* This component handles all notification types across the application */
/* Used by: All pages that show alerts, AJAX notifications, toast messages */
/* JavaScript dependencies: ajax-notifications.js, ajax-forms.js */

/* ===== STATIC ALERTS ===== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    border: 1px solid transparent;
}

.alert h2, .alert h3 {
    margin-bottom: var(--space-2);
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

[data-theme="dark"] .alert-success,
[data-theme="system"].system-dark .alert-success {
    background: #064e3b;
    border-color: #047857;
    color: #6ee7b7;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

[data-theme="dark"] .alert-error,
[data-theme="system"].system-dark .alert-error {
    background: #7f1d1d;
    border-color: #dc2626;
    color: #fca5a5;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fed7aa;
    color: #92400e;
}

[data-theme="dark"] .alert-warning,
[data-theme="system"].system-dark .alert-warning {
    background: #78350f;
    border-color: #d97706;
    color: #fdba74;
}

/* Base notification styles */
.notification {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: 0 8px 24px var(--shadow-lg);
    z-index: 1000;
    min-width: 300px;
    max-width: 500px;
    animation: slideInRight 0.3s ease-out;
}

/* Notification variants */
.notification.success { 
    border-left-color: var(--success); 
}

.notification.error { 
    border-left-color: var(--error); 
}

.notification.warning { 
    border-left-color: var(--warning); 
}

.notification.info { 
    border-left-color: var(--primary); 
}


/* Dashboard notification styles */
.dashboard-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: 0 8px 24px var(--shadow-lg);
    z-index: 1001;
    min-width: 300px;
    max-width: 500px;
    animation: slideInRight 0.3s ease-out;
}

.dashboard-notification.success { 
    border-left-color: var(--success); 
}

.dashboard-notification.error { 
    border-left-color: var(--error); 
}

.dashboard-notification.warning { 
    border-left-color: var(--warning); 
}

/* Notification content */
.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* Notification close button */
.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification-close:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* Auto-redirect notice (from logout.php) */
.auto-redirect-notice {
    background: var(--bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.auto-redirect-notice p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auto-redirect-notice #countdown {
    font-weight: 600;
    color: var(--primary);
}

/* Success and error content containers */
.success-content,
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
}

.success-icon,
.error-icon {
    font-size: 3rem;
}

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

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

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

/* Responsive design */
@media (max-width: 768px) {
    .notification,
    .dashboard-notification {
        left: var(--space-3);
        right: var(--space-3);
        min-width: auto;
        top: var(--space-3);
    }
    
    .auto-redirect-notice {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }
}

@media (max-width: 480px) {
    .notification,
    .dashboard-notification {
        left: var(--space-2);
        right: var(--space-2);
    }
}

/* Dark theme enhancements */
[data-theme="dark"] .notification,
[data-theme="dark"] .dashboard-notification,
[data-theme="system"].system-dark .notification,
[data-theme="system"].system-dark .dashboard-notification {
    background: var(--bg-secondary);
    border-color: var(--border);
}

[data-theme="dark"] .auto-redirect-notice,
[data-theme="system"].system-dark .auto-redirect-notice {
    background: var(--bg-primary);
    border-color: rgba(51, 65, 85, 0.8);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .notification,
    .dashboard-notification,
    .auto-redirect-notice {
        border: 2px solid currentColor;
    }
}

/* ===== AJAX NOTIFICATIONS ===== */
/* Dynamic notification system (extracted from ajax-notifications.js) */

/* Notification container */
.ajax-notifications-container {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Container positioning */
.ajax-notifications-top-right {
    top: var(--space-4);
    right: var(--space-4);
}

.ajax-notifications-top-left {
    top: var(--space-4);
    left: var(--space-4);
}

.ajax-notifications-bottom-right {
    bottom: var(--space-4);
    right: var(--space-4);
}

.ajax-notifications-bottom-left {
    bottom: var(--space-4);
    left: var(--space-4);
}

/* Individual notification styling */
.ajax-notification {
    pointer-events: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px var(--shadow-lg);
    padding: var(--space-4) var(--space-8) var(--space-4) var(--space-4);
    min-width: 300px;
    max-width: 500px;
    position: relative;
    animation: slideInNotification 0.3s ease-out;
}

.ajax-notification:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.ajax-notification-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.ajax-notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.ajax-notification-body {
    flex: 1;
    min-width: 0;
}

.ajax-notification-message {
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
}

.ajax-notification-actions {
    margin-top: var(--space-3);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.ajax-notification-action {
    padding: var(--space-1) var(--space-3);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
}

.ajax-notification-action:hover {
    background: var(--primary-hover);
}

.ajax-notification-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1rem;
}

.ajax-notification-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Progress bar */
.ajax-notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.ajax-notification-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Notification type styling */
.ajax-notification-success {
    border-color: var(--success);
}

.ajax-notification-success .ajax-notification-icon {
    color: var(--success);
}

.ajax-notification-error {
    border-color: var(--error);
}

.ajax-notification-error .ajax-notification-icon {
    color: var(--error);
}

.ajax-notification-warning {
    border-color: var(--warning);
}

.ajax-notification-warning .ajax-notification-icon {
    color: var(--warning);
}

.ajax-notification-info {
    border-color: var(--primary);
}

.ajax-notification-info .ajax-notification-icon {
    color: var(--primary);
}

.ajax-notification-loading {
    border-color: var(--text-muted);
}

.ajax-notification-loading .ajax-notification-icon {
    color: var(--text-muted);
    animation: spin 1s linear infinite;
}

/* ===== NOTIFICATION ANIMATIONS ===== */
@keyframes slideInNotification {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ===== RESPONSIVE DESIGN FOR AJAX NOTIFICATIONS ===== */
@media (max-width: 768px) {
    .ajax-notifications-container {
        left: var(--space-2) !important;
        right: var(--space-2) !important;
        top: var(--space-2) !important;
        bottom: auto !important;
    }
    
    .ajax-notifications-top-right,
    .ajax-notifications-bottom-right {
        right: var(--space-2);
    }
    
    .ajax-notifications-top-left,
    .ajax-notifications-bottom-left {
        left: var(--space-2);
    }
    
    .ajax-notification {
        min-width: auto;
        max-width: none;
    }
}

/* ===== DARK THEME SUPPORT ===== */
[data-theme="dark"] .ajax-notification {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ajax-notification-close:hover,
[data-theme="dark"] .ajax-notification-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="system"].system-dark .ajax-notification {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="system"].system-dark .ajax-notification-close:hover,
[data-theme="system"].system-dark .ajax-notification-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
    .notification,
    .dashboard-notification,
    .ajax-notification {
        animation: none;
    }
    
    .notification-close,
    .ajax-notification-progress-bar {
    }
    
    .ajax-notification-loading .ajax-notification-icon {
        animation: none;
    }
}