/* ===== 桌面端通知组件 - 仿企业微信风格 ===== */
.notif-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 360px;
}

.notif-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.04);
    padding: 14px 16px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: notif-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 280px;
    max-width: 360px;
}

.notif-toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}

.notif-toast.notif-exit {
    animation: notif-slide-out 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.notif-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #6366f1, #06b6d4);
}

/* 不同类型通知的左侧色条 */
.notif-toast.notif-type-alert::before { background: linear-gradient(180deg, #ef4444, #f97316); }
.notif-toast.notif-type-logistics::before { background: linear-gradient(180deg, #10b981, #06b6d4); }
.notif-toast.notif-type-notification::before { background: linear-gradient(180deg, #6366f1, #06b6d4); }
.notif-toast.notif-type-escalation::before { background: linear-gradient(180deg, #f97316, #f59e0b); }

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.notif-toast.notif-type-alert .notif-icon {
    background: linear-gradient(135deg, #ef4444, #f97316);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.notif-toast.notif-type-logistics .notif-icon {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.notif-toast.notif-type-escalation .notif-icon {
    background: linear-gradient(135deg, #f97316, #f59e0b);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.notif-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.notif-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notif-close {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.notif-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.notif-close svg {
    width: 12px;
    height: 12px;
}

.notif-content {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.notif-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(99, 102, 241, 0.2);
    overflow: hidden;
}

.notif-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    width: 100%;
    animation: notif-progress 5s linear forwards;
}

.notif-toast.notif-paused .notif-progress::after {
    animation-play-state: paused;
}

/* 通知权限请求提示 */
.notif-permission-prompt {
    pointer-events: auto;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    padding: 16px;
    max-width: 320px;
    animation: notif-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-permission-prompt .title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-permission-prompt .desc {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 12px;
}

.notif-permission-prompt .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.notif-permission-prompt button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.notif-permission-prompt .btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.notif-permission-prompt .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.notif-permission-prompt .btn-secondary {
    background: #f1f5f9;
    color: #64748b;
}

.notif-permission-prompt .btn-secondary:hover {
    background: #e2e8f0;
}

/* 动画定义 */
@keyframes notif-slide-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notif-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
        max-height: 200px;
        margin-bottom: 12px;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
    }
}

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

/* ===== 通知铃铛入口 ===== */
.notif-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.notif-bell {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.notif-bell:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.notif-bell svg {
    width: 20px;
    height: 20px;
}

.notif-bell.active svg {
    color: #6366f1;
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: notif-badge-pulse 2s ease-in-out infinite;
}

.notif-badge:empty {
    display: none;
}

@keyframes notif-badge-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

/* ===== 通知面板 ===== */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    z-index: 10000;
    animation: notif-panel-fade-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
}

.notif-panel.show {
    display: block;
}

@keyframes notif-panel-fade-in {
    from {
        transform: translateY(-8px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.notif-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-panel-header span {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.notif-panel-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.notif-panel-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.notif-panel-close svg {
    width: 16px;
    height: 16px;
}

.notif-panel-body {
    padding: 8px;
    overflow-y: auto;
    max-height: 380px;
}

.notif-panel-body::-webkit-scrollbar {
    width: 4px;
}

.notif-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.notif-panel-body::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
    border-radius: 2px;
}

.notif-loading {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-size: 13px;
}

.notif-panel-empty {
    text-align: center;
    padding: 32px 16px;
}

.notif-panel-empty .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-panel-empty .icon svg {
    width: 24px;
    height: 24px;
    color: #94a3b8;
}

.notif-panel-empty .text {
    font-size: 13px;
    color: #94a3b8;
}

/* ===== 通知列表项 ===== */
.notif-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    gap: 10px;
}

.notif-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.notif-item.unread {
    background: rgba(99, 102, 241, 0.04);
}

.notif-item.unread .notif-item-title {
    font-weight: 600;
}

.notif-item.unread::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    margin-top: 8px;
    flex-shrink: 0;
}

/* 已读消息：淡化显示，与未读区分开 */
.notif-item.read {
    opacity: 0.65;
}

.notif-item.read .notif-item-title {
    font-weight: 400;
}

.notif-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.notif-item-icon.alert {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.notif-item-icon.logistics {
    background: linear-gradient(135deg, #10b981, #06b6d4);
}

.notif-item-icon.notification {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
}

/* ===== 移动端响应式：通知面板适配小屏 ===== */
@media (max-width: 480px) {
    .notif-bell-wrapper { margin-right: 4px; }
    .notif-bell { padding: 6px; }
    .notif-bell svg { width: 18px; height: 18px; }
    .notif-badge {
        top: 2px; right: 2px;
        min-width: 14px; height: 14px;
        font-size: 10px; padding: 0 3px;
    }
    .notif-panel {
        width: calc(100vw - 16px);
        max-width: 360px;
        right: -8px;
        max-height: 70vh;
    }
    .notif-panel-header { padding: 10px 12px; }
    .notif-panel-header span { font-size: 13px; }
    .notif-panel-body { max-height: calc(70vh - 100px); }
    .notif-item { padding: 10px 12px; }
    .notif-item-title { font-size: 13px; }
    .notif-item-desc { font-size: 12px; }
    .notif-panel-footer a { padding: 10px 12px; font-size: 12px; }
}

.notif-item-icon.escalation {
    background: linear-gradient(135deg, #f97316, #f59e0b);
}

.notif-item-icon svg {
    width: 14px;
    height: 14px;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-item-title {
    font-size: 12.5px;
    color: #0f172a;
    font-weight: 500;
    line-height: 1.4;
}

.notif-item-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
}

.notif-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    text-align: center;
}

.notif-panel-footer a {
    font-size: 12.5px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.notif-panel-footer a:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.notif-panel-hint {
    font-size: 12.5px;
    color: #94a3b8;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .notif-panel {
        right: -10px;
        width: calc(100vw - 20px);
        max-width: 360px;
    }
}
