/**
 * 弹窗通知样式 - 右下角图标版
 */

/* 通知图标按钮 */
.notification-bell-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010; /* 提升层级，确保高于移动端底部导航和返回顶部 */
    transition: all 0.3s ease;
    border: 3px solid #fff;
    /* 支持触控拖动 */
    touch-action: none;
    cursor: grab;
}

.notification-bell-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
    background: rgba(37, 99, 235, 0.9);
}

.notification-bell-btn.dragging {
    cursor: grabbing;
}

.notification-bell-btn i {
    color: #fff;
    font-size: 24px;
}

/* 未读通知角标 */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 遮罩层 */
.notification-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10009;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.notification-backdrop.show {
    opacity: 1;
    display: block;
}

/* 通知弹窗（从右下角弹出） */
.notification-modal {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 420px;
    max-height: 600px;
    z-index: 10011; /* 弹窗置于最高层 */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: none;
}

.notification-modal.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    display: block;
}

/* 自动弹窗模式（居中显示） */
.notification-modal.popup-mode {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.9);
    width: 600px;
    max-height: 80vh;
}

.notification-modal.popup-mode.show {
    transform: translate(-50%, -50%) scale(1);
}

/* 弹窗内容 */
.notification-modal-content {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 弹窗头部 */
.notification-modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    position: relative;
}

.notification-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.notification-count {
    margin-left: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.notification-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    margin-left: 12px;
}

.notification-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-modal-close span {
    display: block;
    line-height: 1;
    margin-top: -2px;
}

/* 弹窗主体 - 通知列表 */
.notification-modal-body {
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    max-height: 450px;
}

/* 单个通知项 */
.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: #f8f9fa;
}

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

.notification-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    flex: 1;
}

.notification-item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

.notification-item-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #64748b;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 富文本内容样式 */
.notification-item-content p,
.notification-detail-content p {
    margin: 0 0 10px 0;
}

.notification-item-content p:last-child,
.notification-detail-content p:last-child {
    margin-bottom: 0;
}

.notification-item-content strong,
.notification-item-content b,
.notification-detail-content strong,
.notification-detail-content b {
    font-weight: 600;
    color: #1e293b;
}

.notification-item-content em,
.notification-item-content i,
.notification-detail-content em,
.notification-detail-content i {
    font-style: italic;
}

.notification-item-content u,
.notification-detail-content u {
    text-decoration: underline;
}

.notification-item-content a,
.notification-detail-content a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

.notification-item-content a:hover,
.notification-detail-content a:hover {
    color: #1e40af;
    text-decoration: underline;
}

.notification-item-content ul,
.notification-item-content ol,
.notification-detail-content ul,
.notification-detail-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.notification-item-content li,
.notification-detail-content li {
    margin: 4px 0;
}

.notification-item-content h1,
.notification-item-content h2,
.notification-item-content h3,
.notification-item-content h4,
.notification-item-content h5,
.notification-item-content h6,
.notification-detail-content h1,
.notification-detail-content h2,
.notification-detail-content h3,
.notification-detail-content h4,
.notification-detail-content h5,
.notification-detail-content h6 {
    margin: 12px 0 8px 0;
    color: #1e293b;
    font-weight: 600;
}

.notification-detail-content h1 { font-size: 1.5rem; }
.notification-detail-content h2 { font-size: 1.3rem; }
.notification-detail-content h3 { font-size: 1.1rem; }
.notification-detail-content h4 { font-size: 1rem; }
.notification-detail-content h5 { font-size: 0.95rem; }
.notification-detail-content h6 { font-size: 0.9rem; }

.notification-item-content img,
.notification-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.notification-item-content table,
.notification-detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.notification-item-content table th,
.notification-item-content table td,
.notification-detail-content table th,
.notification-detail-content table td {
    border: 1px solid #e2e8f0;
    padding: 8px;
    text-align: left;
}

.notification-item-content table th,
.notification-detail-content table th {
    background-color: #f8fafc;
    font-weight: 600;
}

.notification-item-content blockquote,
.notification-detail-content blockquote {
    border-left: 4px solid #2563eb;
    margin: 10px 0;
    padding: 10px 15px;
    background-color: #f8fafc;
    font-style: italic;
}

.notification-item-content code,
.notification-detail-content code {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #dc2626;
}

.notification-item-content pre,
.notification-detail-content pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.notification-item-content pre code,
.notification-detail-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.notification-item-expanded .notification-item-content {
    display: block;
    -webkit-line-clamp: unset;
}

/* 通知详情视图 */
.notification-detail-view {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.notification-detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.notification-detail-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 空状态 */
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
}

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

/* 自定义滚动条 */
.notification-modal-body::-webkit-scrollbar {
    width: 8px;
}

.notification-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.notification-modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.notification-modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 弹窗底部 */
.notification-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.notification-back-btn {
    padding: 8px 20px;
    border: 2px solid #2563eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    color: #2563eb;
}

.notification-back-btn:hover {
    background: #2563eb;
    color: #fff;
    transform: translateY(-1px);
}

.notification-clear-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.notification-clear-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
    background: rgba(37, 99, 235, 0.9);
}

/* 不同类型的徽章样式 */
.badge-info {
    background: #2563eb;
    color: #fff;
}

.badge-success {
    background: #10b981;
    color: #fff;
}

.badge-warning {
    background: #f59e0b;
    color: #fff;
}

.badge-error {
    background: #ef4444;
    color: #fff;
}

.badge-activity {
    background: #8b5cf6;
    color: #fff;
}

.badge-announcement {
    background: #6366f1;
    color: #fff;
}

.badge-promotion {
    background: #ec4899;
    color: #fff;
}

.badge-maintenance {
    background: #6b7280;
    color: #fff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .notification-bell-btn {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .notification-bell-btn i {
        font-size: 20px;
    }
    
    .notification-modal {
        bottom: calc(80px + env(safe-area-inset-bottom));
        right: 20px;
        left: 20px;
        width: auto;
        max-height: 500px;
    }
    
    .notification-modal-content {
        max-height: 500px;
    }
    
    .notification-modal-body {
        max-height: 380px;
    }
    
    .notification-item {
        padding: 14px 16px;
    }
    
    .notification-item-title {
        font-size: 0.9rem;
    }
    
    .notification-item-content {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .notification-bell-btn {
        width: 46px;
        height: 46px;
        bottom: 16px;
        right: 16px;
    }
    
    .notification-modal {
        bottom: 70px;
        right: 16px;
        left: 16px;
        max-height: 450px;
    }
    
    .notification-modal-body {
        max-height: 330px;
    }
}

/* 动画效果 */
@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notification-modal.show .notification-modal-content {
    animation: slideIn 0.3s ease;
}

/* 打印时隐藏 */
@media print {
    .notification-modal,
    .notification-backdrop {
        display: none !important;
    }
}

/* ==== 覆盖：移动端将通知铃铛置于屏幕中部（避免被底部导航遮挡） ==== */
@media (max-width: 768px) {
    .notification-bell-btn {
        top: 50%;
        right: 20px;
        left: auto;
        bottom: auto;
        transform: translateY(-50%);
    }
    .notification-bell-btn:hover {
        transform: translateY(-50%) scale(1.05);
    }
}

@media (max-width: 480px) {
    .notification-bell-btn {
        top: 50%;
        right: 16px;
        left: auto;
        bottom: auto;
        transform: translateY(-50%);
    }
    .notification-bell-btn:hover {
        transform: translateY(-50%) scale(1.05);
    }
}

