/**
 * Notification System Styles - Session 59
 *
 * Includes:
 * - Toast notifications
 * - Notification center panel
 * - Dark theme support
 * - Priority-based styling
 * - Responsive design
 */

/* =============================================================================
 * CSS Variables (Dark Theme by Default)
 * ============================================================================= */
:root {
    --notification-bg: #1e1e2e;
    --notification-text: #e0e0e0;
    --notification-border: #333344;
    --notification-success: #4caf50;
    --notification-error: #f44336;
    --notification-warning: #ff9800;
    --notification-info: #2196f3;
    --notification-critical: #d32f2f;
    --notification-badge-bg: #f44336;
    --notification-badge-text: #ffffff;
    --notification-hover: #2a2a3e;
    --notification-unread-indicator: #4fc3f7;
}

/* Light theme override */
[data-theme="light"] {
    --notification-bg: #ffffff;
    --notification-text: #333333;
    --notification-border: #e0e0e0;
    --notification-hover: #f5f5f5;
}

/* =============================================================================
 * Toast Notifications
 * ============================================================================= */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification-toast {
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: var(--notification-bg);
    color: var(--notification-text);
    border-left: 4px solid var(--notification-info);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 100%;
}

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

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

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

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

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

.notification-toast.critical {
    border-left-color: var(--notification-critical);
    animation: pulse-critical 0.5s ease-in-out 3;
}

@keyframes pulse-critical {
    0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(211, 47, 47, 0.5); }
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.toast-header strong {
    font-weight: 600;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--notification-text);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

.toast-body {
    font-size: 13px;
    line-height: 1.4;
}

/* =============================================================================
 * Notification Badge
 * ============================================================================= */
#notificationCenterToggle {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#notificationBadge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--notification-badge-bg);
    color: var(--notification-badge-text);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    animation: badge-bounce 0.3s ease;
}

@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* =============================================================================
 * Notification Center Panel
 * ============================================================================= */
#notificationCenter {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 380px;
    max-height: calc(100vh - 100px);
    background: var(--notification-bg);
    border: 1px solid var(--notification-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#notificationCenter.open {
    display: flex;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-center-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--notification-border);
    background: rgba(255, 255, 255, 0.02);
}

.notification-center-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--notification-text);
}

.notification-center-actions {
    display: flex;
    gap: 8px;
}

.notification-center-actions button {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--notification-border);
    background: transparent;
    color: var(--notification-text);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-center-actions button:hover {
    background: var(--notification-hover);
}

#notificationList {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* =============================================================================
 * Notification Items
 * ============================================================================= */
.notification-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--notification-border);
    transition: all 0.2s;
}

.notification-item:hover {
    background: var(--notification-hover);
}

.notification-item.unread {
    border-left: 3px solid var(--notification-unread-indicator);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.notification-item-type {
    font-size: 14px;
}

.notification-item-time {
    font-size: 11px;
    color: #888;
}

.notification-item-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--notification-text);
}

.notification-item-message {
    font-size: 12px;
    line-height: 1.4;
    color: var(--notification-text);
    opacity: 0.9;
}

.notification-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.notification-item:hover .notification-item-actions {
    opacity: 1;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--notification-border);
    background: transparent;
    color: var(--notification-text);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: var(--notification-hover);
}

.btn-sm.btn-danger {
    border-color: var(--notification-error);
    color: var(--notification-error);
}

.btn-sm.btn-danger:hover {
    background: rgba(244, 67, 54, 0.1);
}

/* Type-specific colors */
.notification-item.type-success .notification-item-type { color: var(--notification-success); }
.notification-item.type-error .notification-item-type { color: var(--notification-error); }
.notification-item.type-warning .notification-item-type { color: var(--notification-warning); }
.notification-item.type-info .notification-item-type { color: var(--notification-info); }
.notification-item.type-critical .notification-item-type { color: var(--notification-critical); }

/* =============================================================================
 * Empty State
 * ============================================================================= */
.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.notification-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-empty p {
    margin: 0;
    font-size: 14px;
}

/* =============================================================================
 * Responsive Design
 * ============================================================================= */
@media (max-width: 768px) {
    #notificationContainer {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    #notificationCenter {
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 80px);
    }
}

/* =============================================================================
 * Scrollbar Styling
 * ============================================================================= */
#notificationList::-webkit-scrollbar {
    width: 6px;
}

#notificationList::-webkit-scrollbar-track {
    background: transparent;
}

#notificationList::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

#notificationList::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* =============================================================================
 * Legacy Notification Element (Backward Compatibility)
 * ============================================================================= */
#notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: 12px 24px;
    border-radius: 8px;
    background: var(--notification-bg);
    color: var(--notification-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

#notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

#notification.success {
    border-left: 4px solid var(--notification-success);
}

#notification.error {
    border-left: 4px solid var(--notification-error);
}

#notification.warning {
    border-left: 4px solid var(--notification-warning);
}

#notification.info {
    border-left: 4px solid var(--notification-info);
}
