/**
 * 消息通知系统样式 - 兼容PC和移动端
 */

/* CSS自定义属性 - 优化对比度版本 */
:root {
    --notification-border-radius: 12px;
    --notification-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    --notification-transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    --notification-bg: rgba(255, 255, 255, 0.98);
    --notification-border: rgba(0, 0, 0, 0.12);
    --notification-text: #1a202c;
    --notification-close-hover: rgba(0, 0, 0, 0.08);
    --notification-backdrop: rgba(255, 255, 255, 0.9);
    --notification-gradient-overlay: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
}

/* 通知容器 */
.notification-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    max-width: 400px;
    width: 100%;
}

/* 位置定义 */
.notification-top-right {
    top: 20px;
    right: 20px;
}

.notification-top-left {
    top: 20px;
    left: 20px;
}

.notification-bottom-right {
    bottom: 20px;
    right: 20px;
}

.notification-bottom-left {
    bottom: 20px;
    left: 20px;
}

.notification-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.notification-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* 通知项基础样式 - 性能优化版本 */
.notification {
    pointer-events: auto;
    margin-bottom: 16px;
    border-radius: var(--notification-border-radius);
    box-shadow: var(--notification-shadow);
    background: var(--notification-bg);
    border: 1px solid var(--notification-border);
    overflow: hidden;
    position: relative;
    transform: translateX(100%) scale(0.95);
    opacity: 0;
    transition: var(--notification-transition);
    max-width: 100%;
    min-width: 320px;
    max-height: 200px;
    will-change: transform, opacity;
    backface-visibility: hidden;
    contain: layout style paint;
}

/* 移除性能消耗大的伪元素和复杂悬停效果 */
.notification:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* 显示动画 - 弹性效果 */
.notification-show {
    transform: translateX(0) scale(1);
    opacity: 1;
}

/* 隐藏动画 - 性能优化版本 */
.notification-hide {
    transform: translateX(100%) scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 1, 1), opacity 0.3s ease-out;
}

/* 通知内容 - 现代化布局 */
.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    gap: 16px;
    position: relative;
    z-index: 2;
}

/* 图标样式 - 现代化设计 */
.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-top: 1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
}

.notification-icon::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    z-index: -1;
}

/* 消息文本 - 现代化排版 */
.notification-message {
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
    color: var(--notification-text);
    word-wrap: break-word;
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* 关闭按钮 - 现代化交互 */
.notification-close {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 16px;
    color: #8b9dc3;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -2px;
    font-weight: 600;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #5a6c8a;
    transform: scale(1.1);
}

.notification-close:active {
    transform: scale(0.95);
}

/* 进度条 - 现代化设计 */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    animation: progress-countdown linear;
    transform-origin: left;
    will-change: width;
    backface-visibility: hidden;
    border-radius: 0 0 var(--notification-border-radius) var(--notification-border-radius);
    overflow: hidden;
}

/* 移除性能消耗大的shimmer动画 */
.notification-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

/* 不同类型通知的进度条颜色 - 现代化渐变 */
.notification-success .notification-progress {
    background: linear-gradient(90deg, #10b981 0%, #34d399 50%, rgba(16, 185, 129, 0.6) 100%);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.notification-error .notification-progress {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 50%, rgba(239, 68, 68, 0.6) 100%);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.notification-warning .notification-progress {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, rgba(245, 158, 11, 0.6) 100%);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.notification-info .notification-progress {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, rgba(59, 130, 246, 0.6) 100%);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

@keyframes progress-countdown {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* 通知类型样式 - 增强对比度版本 */
.notification-success {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255, 255, 255, 0.98) 100%);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.notification-success .notification-icon {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.notification-error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0.98) 100%);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.notification-error .notification-icon {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.notification-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(255, 255, 255, 0.98) 100%);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.notification-warning .notification-icon {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.notification-info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(255, 255, 255, 0.98) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.notification-info .notification-icon {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* 移动端适配 - 现代化移动体验 */
@media (max-width: 768px) {
    .notification-container {
        left: 12px !important;
        right: 12px !important;
        top: 12px !important;
        bottom: auto !important;
        transform: none !important;
        max-width: none;
    }
    
    .notification {
        min-width: auto;
        margin-bottom: 12px;
        border-radius: 10px;
        transform: translateY(-100%) scale(0.95);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease-out;
    }
    
    .notification:hover {
        transform: translateY(-1px);
    }
    
    .notification-show {
        transform: translateY(0) scale(1);
    }
    
    .notification-hide {
        transform: translateY(-100%) scale(0.95);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.4, 0, 1, 1), opacity 0.3s ease-out;
    }
    
    .notification-content {
        padding: 16px;
        gap: 12px;
    }
    
    .notification-message {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .notification-icon {
        width: 22px;
        height: 22px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .notification-close {
        width: 26px;
        height: 26px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .notification-progress {
        height: 3px;
    }
}

/* 小屏幕设备 - 优化触摸体验 */
@media (max-width: 480px) {
    .notification-container {
        left: 8px !important;
        right: 8px !important;
        top: 8px !important;
    }
    
    .notification {
        margin-bottom: 10px;
        border-radius: 8px;
    }
    
    .notification-content {
        padding: 14px;
        gap: 10px;
    }
    
    .notification-message {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .notification-icon {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .notification-close {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
}

/* 深色模式支持 - 优化对比度版本 */
@media (prefers-color-scheme: dark) {
    :root {
        --notification-bg: rgba(26, 32, 44, 0.98);
        --notification-border: rgba(255, 255, 255, 0.15);
        --notification-text: #f7fafc;
        --notification-close-hover: rgba(255, 255, 255, 0.12);
        --notification-backdrop: rgba(0, 0, 0, 0.9);
        --notification-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    /* 深色模式下的增强对比度 */
    .notification {
        background: var(--notification-bg);
        border-color: var(--notification-border);
        color: var(--notification-text);
        backdrop-filter: blur(8px) saturate(120%);
    }
    
    .notification:hover {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .notification-message {
        color: var(--notification-text);
        font-weight: 500;
    }
    
    .notification-close {
        background: rgba(255, 255, 255, 0.1);
        color: #a0aec0;
    }
    
    .notification-close:hover {
        background: rgba(255, 255, 255, 0.18);
        color: #e2e8f0;
    }
    
    /* 深色模式下的进度条 */
    .notification-progress {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .notification-success .notification-progress {
        background: linear-gradient(90deg, #059669 0%, #10b981 50%, rgba(5, 150, 105, 0.7) 100%);
        box-shadow: 0 0 12px rgba(5, 150, 105, 0.4);
    }
    
    .notification-error .notification-progress {
        background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, rgba(220, 38, 38, 0.7) 100%);
        box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
    }
    
    .notification-warning .notification-progress {
        background: linear-gradient(90deg, #d97706 0%, #f59e0b 50%, rgba(217, 119, 6, 0.7) 100%);
        box-shadow: 0 0 12px rgba(217, 119, 6, 0.4);
    }
    
    .notification-info .notification-progress {
        background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, rgba(37, 99, 235, 0.7) 100%);
        box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
    }
    
    /* 深色模式下的通知类型样式 - 增强对比度 */
    .notification-success {
        border-left-color: #10b981;
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(26, 32, 44, 0.98) 100%);
        border: 1px solid rgba(16, 185, 129, 0.2);
    }
    
    .notification-success .notification-icon {
        background: linear-gradient(135deg, #059669 0%, #10b981 100%);
        box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
    }
    
    .notification-error {
        border-left-color: #ef4444;
        background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(26, 32, 44, 0.98) 100%);
        border: 1px solid rgba(239, 68, 68, 0.2);
    }
    
    .notification-error .notification-icon {
        background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
    }
    
    .notification-warning {
        border-left-color: #f59e0b;
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(26, 32, 44, 0.98) 100%);
        border: 1px solid rgba(245, 158, 11, 0.2);
    }
    
    .notification-warning .notification-icon {
        background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
    }
    
    .notification-info {
        border-left-color: #3b82f6;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(26, 32, 44, 0.98) 100%);
        border: 1px solid rgba(59, 130, 246, 0.2);
    }
    
    .notification-info .notification-icon {
        background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .notification {
        border-width: 2px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .notification-close {
        border: 1px solid #999999;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .notification,
    .notification-close,
    .notification-progress {
        transition: none;
        animation: none;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .notification-close {
        width: 24px;
        height: 24px;
        font-size: 18px;
    }
    
    .notification {
        touch-action: pan-y;
    }
}

/* 打印样式 */
@media print {
    .notification-container {
        display: none;
    }
}