/* 全局z-index层级系统 - 确保弹窗层级的最佳实践 */ :root { /* z-index层级标准 - 数值间隔1000确保充足的层级空间 */ --z-modal: 10000; /* 模态框 - 最高层级,包括系统消息弹窗 */ --z-popup: 9000; /* 弹出框 - 次高层级,如用户菜单、下拉框 */ --z-tooltip: 8000; /* 提示框 - 中等层级,如悬浮提示 */ --z-dropdown: 7000; /* 下拉菜单 - 较低层级 */ --z-header: 1000; /* 页头导航 - 基础层级 */ --z-content: 1; /* 页面内容 - 默认层级 */ } /* Layout组件专用变量定义 - 不与其他文件共享 */ .app-layout, .sidebar, .app-layout *, .sidebar * { --primary-color: #3b82f6; --text-primary: #111827; --text-secondary: #6b7280; --card-bg: #ffffff; --sidebar-bg: #ffffff; --border-color: #e5e7eb; } /* 布局相关样式 */ .app-layout { display: flex; min-height: 100vh; width: 100vw; } /* 侧边栏样式 */ .sidebar { width: 280px; /* 增加宽度避免内容换行 */ background: var(--sidebar-bg); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; /* 固定定位同时作为子元素的定位上下文 */ height: 100%; overflow: hidden; transition: width 0.3s ease; } /* 侧边栏滚动条样式 - 极简清透设计 */ .sidebar::-webkit-scrollbar { width: 6px; /* 纤细的滚动条 */ } .sidebar::-webkit-scrollbar-track { background: transparent; /* 透明轨道 */ margin: 10px 0; /* 上下留边 */ } .sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); /* 半透明滑块 */ border-radius: 3px; transition: background 0.2s ease; } .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); /* 悬停时加深 */ } /* Firefox滚动条样式 */ .sidebar { scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.1) transparent; } /* 折叠状态的侧边栏 */ .sidebar.collapsed { width: 64px; } .sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: flex-start; gap: 12px; } .sidebar-logo { width: 32px; height: 32px; background: var(--primary-color); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; } .sidebar-title { font-size: 14px; font-weight: 500; color: var(--text-primary); } .user-profile { padding: 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); } .user-avatar { width: 40px; height: 40px; min-width: 40px; min-height: 40px; border-radius: 50% !important; background: #e5e7eb; background-image: url('data:image/svg+xml;utf8,'); background-size: 20px; background-repeat: no-repeat; background-position: center; flex-shrink: 0; flex-grow: 0; } .user-info h4 { font-size: 14px; font-weight: 500; color: var(--text-primary); } /* 导航菜单样式 */ .nav-menu { flex: 1; padding: 8px 0; overflow-y: auto; } .nav-section { margin-bottom: 8px; } .nav-section-title { padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; } .nav-item { display: block; padding: 8px 16px; color: var(--text-secondary); text-decoration: none; font-size: 14px; transition: all 0.15s ease; border: none; background: none; width: 100%; text-align: left; cursor: pointer; } .nav-item:hover { background: #f3f4f6; color: var(--text-primary); } .nav-item.active { background: #eff6ff; color: var(--primary-color); font-weight: 500; } /* 折叠状态下的区块标题 */ .nav-section-title-collapsed { padding: 8px 16px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: center; border-bottom: 1px solid #f3f4f6; margin-bottom: 4px; } /* 悬浮的折叠/展开按钮 */ .sidebar-float-toggle { position: fixed; top: 5%; /* 垂直居中 */ left: 260px; /* 默认位置:侧边栏宽度 */ transform: translateY(-50%); width: 20px; height: 50px; background: linear-gradient(135deg, #3b82f6, #2563eb); border: none; border-radius: 0 10px 10px 0; /* 右侧圆角 */ color: white; cursor: pointer; font-size: 10px; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; box-shadow: 2px 0 10px rgba(59, 130, 246, 0.3); z-index: 1001; /* 确保在侧边栏上方 */ opacity: 0.9; backdrop-filter: blur(4px); } /* 折叠状态的按钮位置 */ .sidebar-float-toggle.collapsed { left: 64px; /* 折叠时的侧边栏宽度 */ } /* 悬停效果 */ .sidebar-float-toggle:hover { opacity: 1; width: 28px; background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 3px 0 15px rgba(59, 130, 246, 0.4); transform: translateY(-50%) translateX(2px); } /* 图标动画 */ .toggle-icon { transition: transform 0.3s ease; display: inline-block; } .sidebar-float-toggle:hover .toggle-icon { transform: scale(1.2); } /* 旧的toggle-btn样式已被sidebar-float-toggle替代 */ /* 折叠状态下的特殊样式 */ .sidebar.collapsed .nav-item { padding: 8px 12px; text-align: center; font-size: 16px; min-height: 40px; display: flex; align-items: center; justify-content: center; } .sidebar.collapsed .user-profile { justify-content: center; padding: 16px 12px; } .sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 12px; } /* 主内容区域 */ .main-content { flex: 1; margin-left: 280px; /* 配合侧边栏宽度调整 */ overflow: hidden; transition: margin-left 0.3s ease; display: flex; flex-direction: column; background-color: #f2f3f5; } /* 当侧边栏折叠时的主内容区域 */ .main-content.sidebar-collapsed { margin-left: 64px; } /* 用户信息区域优化 */ .user-info { display: flex; align-items: center; justify-content: space-between; width: 100%; } /* 消息图标容器 */ .message-icon-container { position: relative; cursor: pointer; padding: 4px; border-radius: 6px; transition: background-color 150ms ease; display: flex; align-items: center; justify-content: center; } .message-icon-container:hover { background-color: #f3f4f6; } /* 消息图标 */ .message-icon { font-size: 18px; color: #6b7280; transition: color 150ms ease; } .message-icon-container:hover .message-icon { color: #374151; } /* 未读消息徽章 */ .message-badge { position: absolute; top: -2px; right: -2px; background: #ef4444; color: white; border-radius: 50%; min-width: 16px; height: 16px; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; animation: messagePulse 2s ease-in-out infinite; } /* 未读徽章动画 */ @keyframes messagePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } } /* 消息通知浮窗遮罩 - 已由Portal替代,保留样式以防回退 */ .message-notification-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: var(--z-modal); pointer-events: none; } /* 消息通知浮窗 - 使用全局z-index系统 */ .message-notification-popup { position: fixed; /* Portal渲染到body,使用fixed定位 */ top: 120px; left: 280px; width: 320px; max-height: 400px; background: #ffffff; border-radius: 8px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.1); border: 1px solid #e5e7eb; pointer-events: auto; opacity: 1; transform: translateY(0); z-index: var(--z-modal); /* 使用全局变量确保最高层级 */ display: flex; flex-direction: column; overflow: hidden; } /* 浮窗淡入动画 */ @keyframes notificationFadeIn { from { opacity: 0; transform: translateY(-8px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } } /* 浮窗头部 */ .message-notification-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 12px 16px; border-bottom: 1px solid #f3f4f6; } .message-notification-title { margin: 0; font-size: 14px; font-weight: 600; color: #111827; } .message-notification-actions { display: flex; align-items: center; gap: 8px; } .mark-all-read-btn { font-size: 12px; color: #3b82f6; background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: background-color 150ms ease; } .mark-all-read-btn:hover { background-color: #eff6ff; } .close-btn { font-size: 18px; color: #9ca3af; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 150ms ease; line-height: 1; } .close-btn:hover { background-color: #f3f4f6; color: #6b7280; } /* 浮窗内容区域 */ .message-notification-content { flex: 1; max-height: 300px; overflow-y: auto; padding: 8px 0; background: #ffffff; } /* 滚动条样式 */ .message-notification-content::-webkit-scrollbar { width: 4px; } .message-notification-content::-webkit-scrollbar-track { background: transparent; } .message-notification-content::-webkit-scrollbar-thumb { background-color: #e5e7eb; border-radius: 2px; } .message-notification-content::-webkit-scrollbar-thumb:hover { background-color: #d1d5db; } /* 消息列表 */ .message-list { display: flex; flex-direction: column; } /* 消息项 */ .message-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background-color 150ms ease; border-left: 2px solid transparent; } .message-item:hover { background-color: #f9fafb; } .message-item.unread { background-color: #fefefe; border-left-color: #3b82f6; } .message-item.read { opacity: 0.8; } /* 消息图标包装器 */ .message-icon-wrapper { position: relative; flex-shrink: 0; } .message-type-icon { font-size: 16px; display: block; } .message-priority-dot { position: absolute; top: -2px; right: -2px; width: 6px; height: 6px; border-radius: 50%; } /* 消息内容 */ .message-content { flex: 1; min-width: 0; } .message-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; } .message-title { margin: 0; font-size: 13px; font-weight: 500; color: #111827; line-height: 1.3; } .message-time { font-size: 11px; color: #9ca3af; flex-shrink: 0; } .message-text { margin: 0; font-size: 12px; color: #6b7280; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* 空消息状态 */ .empty-messages { text-align: center; padding: 32px 16px; color: #9ca3af; } .empty-icon { font-size: 32px; margin-bottom: 8px; } .empty-messages p { margin: 0; font-size: 13px; } /* 浮窗底部 */ .message-notification-footer { padding: 12px 16px; border-top: 1px solid #f3f4f6; text-align: center; background: #fafafa; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; flex-shrink: 0; } .message-count { font-size: 11px; color: #9ca3af; font-weight: 500; }