/* Notification 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 modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
}

body #notification-container {
    position: fixed !important;
    top: 80px !important;
    right: 20px !important;
    z-index: 10000 !important;
    max-width: 400px !important;
}

@media (max-width: 768px) {
    body #notification-container {
        top: 90px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
    }
}

/* Enhanced Modal System for Notifications */
.notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.notification-modal {
    background: var(--card, #fff);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border, #e5e7eb);
    animation: modalFadeIn 0.3s ease;
    position: relative;
}

.notification-modal.closing {
    animation: modalFadeOut 0.3s ease;
}

.notification-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-soft, #f8f9fa);
}

.notification-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text, #1f2937);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    padding-right: 16px;
}

.notification-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-modal-close:hover {
    background: var(--bg-dark, #f0f2ff);
    color: var(--text, #1f2937);
    transform: scale(1.1);
}

.notification-modal-meta {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--bg-soft, #f8f9fa);
}

.notification-modal-type {
    background: var(--accent, #a78bfa);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-modal-time {
    color: var(--text-muted, #6b7280);
    font-size: 14px;
    font-weight: 500;
}

.notification-modal-body {
    padding: 24px;
    max-height: 50vh;
    overflow-y: auto;
    color: var(--text, #1f2937);
    line-height: 1.6;
    font-size: 16px;
}

/* HTML content styling within modal */
.notification-modal-body h1,
.notification-modal-body h2,
.notification-modal-body h3,
.notification-modal-body h4,
.notification-modal-body h5,
.notification-modal-body h6 {
    margin: 0 0 16px 0;
    color: var(--text, #1f2937);
}

.notification-modal-body p {
    margin: 0 0 16px 0;
}

.notification-modal-body ul,
.notification-modal-body ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}

.notification-modal-body li {
    margin-bottom: 8px;
}

.notification-modal-body strong,
.notification-modal-body b {
    font-weight: 600;
    color: var(--text, #1f2937);
}

.notification-modal-body em,
.notification-modal-body i {
    font-style: italic;
}

.notification-modal-body a {
    color: var(--accent, #a78bfa);
    text-decoration: none;
    font-weight: 500;
}

.notification-modal-body a:hover {
    text-decoration: underline;
}

.notification-modal-body code {
    background: var(--bg-dark, #f0f2ff);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.notification-modal-body pre {
    background: var(--bg-dark, #f0f2ff);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0 0 16px 0;
}

.notification-modal-body blockquote {
    border-left: 4px solid var(--accent, #a78bfa);
    padding-left: 16px;
    margin: 0 0 16px 0;
    font-style: italic;
    color: var(--text-muted, #6b7280);
}

.notification-modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* Responsive modal design */
@media (max-width: 768px) {
    .notification-modal {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    .notification-modal-header {
        padding: 20px 20px 12px;
    }
    
    .notification-modal-title {
        font-size: 18px;
    }
    
    .notification-modal-meta {
        padding: 12px 20px;
    }
    
    .notification-modal-body {
        padding: 20px;
        font-size: 15px;
        max-height: 60vh;
    }
}

/* Accessibility improvements */
.notification-modal-overlay[aria-hidden="true"] {
    display: none;
}

.notification-modal:focus {
    outline: 2px solid var(--accent, #a78bfa);
    outline-offset: 2px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

.notification-toast {
    background: var(--card, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
    max-width: 100%;
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent, #a78bfa);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1f2937);
    margin-bottom: 4px;
    line-height: 1.3;
}

.toast-message {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-dark, #f0f2ff);
    color: var(--text, #1f2937);
}

@media (max-width: 768px) {
    .toast-container {
        top: 90px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification-toast {
        padding: 14px;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

/* Enhanced notification item hover effects */
.notification-item:hover {
    background: var(--bg-soft, #f8f9fa);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-notification-item:hover {
    background: var(--bg-soft, #f8f9fa);
    transform: translateX(2px);
}

/* Notification type specific colors */
.notification-modal-type {
    background: var(--accent, #a78bfa);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-modal-type[data-type="announcement"] {
    background: #3b82f6;
}

.notification-modal-type[data-type="system"] {
    background: #6b7280;
}

.notification-modal-type[data-type="achievement"] {
    background: #10b981;
}

.notification-modal-type[data-type="test"] {
    background: #f59e0b;
}

/* Enhanced focus states for accessibility */
.notification-modal:focus {
    outline: 2px solid var(--accent, #a78bfa);
    outline-offset: 2px;
}

.notification-modal-close:focus {
    outline: 2px solid var(--accent, #a78bfa);
    outline-offset: 2px;
    background: var(--bg-dark, #f0f2ff);
}

/* Smooth transitions for all interactive elements */
.notification-item,
.mobile-notification-item,
.notification-modal-close,
.toast-close {
    transition: all 0.2s ease;
}

/* Performance optimizations */
.notification-modal-overlay {
    will-change: opacity, visibility;
}

.notification-modal {
    will-change: transform;
}

.notification-toast {
    will-change: transform, opacity;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .notification-modal-overlay,
    .notification-modal,
    .notification-toast,
    .notification-item,
    .mobile-notification-item {
        transition: none;
        animation: none;
    }
    
    .notification-item:hover,
    .mobile-notification-item:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .notification-modal {
        border: 2px solid;
    }
    
    .notification-modal-close {
        border: 1px solid;
    }
    
    .notification-toast {
        border: 2px solid;
    }
}

/* Error handling styles */
.notification-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.dark .notification-error {
    background: #2d1b1b;
    border-color: #7f1d1d;
    color: #fca5a5;
}

.notification-retry-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.notification-retry-btn:hover {
    background: #b91c1c;
}

/* Loading state for modal */
.notification-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted, #6b7280);
}

.notification-modal-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border, #e5e7eb);
    border-top: 2px solid var(--accent, #a78bfa);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Admin Notification Modal Styles */
.admin-notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.admin-notification-modal-overlay.show {
    opacity: 1;
}

.admin-notification-modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.admin-notification-modal-overlay.show .admin-notification-modal {
    transform: scale(1);
}

.admin-notification-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-notification-modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.admin-notification-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-notification-modal-close:hover {
    color: #333;
}

.admin-notification-modal-meta {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-notification-modal-type {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.admin-notification-modal-time {
    color: #666;
    font-size: 0.875rem;
}

.admin-html-badge {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.admin-notification-modal-body {
    padding: 20px;
    line-height: 1.6;
}

.admin-notification-modal-body h1,
.admin-notification-modal-body h2,
.admin-notification-modal-body h3,
.admin-notification-modal-body h4,
.admin-notification-modal-body h5,
.admin-notification-modal-body h6 {
    margin-top: 0;
    margin-bottom: 10px;
}

.admin-notification-modal-body p {
    margin-bottom: 10px;
}

.admin-notification-modal-body ul,
.admin-notification-modal-body ol {
    margin-bottom: 10px;
    padding-left: 20px;
}

.admin-notification-modal-body a {
    color: #007bff;
    text-decoration: none;
}

.admin-notification-modal-body a:hover {
    text-decoration: underline;
}

.admin-notification-modal.closing {
    transform: scale(0.9);
}