* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: url('img/bg.jpg') center center / cover no-repeat fixed;
    height: 100vh;
    overflow: hidden;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #171f44 0%, #063654 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.modal-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.modal-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #303133;
    margin-bottom: 8px;
    font-weight: 500;
}

.required {
    color: #f56c6c;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dcdfe6;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
}

.form-group input:focus {
    border-color: #4a68f1;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #909399;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg,  #0c112c 0%, #193476 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-message {
    margin-top: 15px;
    padding: 10px;
    background: #fef0f0;
    border: 1px solid #fde2e2;
    border-radius: 6px;
    color: #f56c6c;
    font-size: 13px;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* 聊天容器 */
#chatContainer {
    width: 100%;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
}

/* 聊天头部 */
.chat-header {
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden; /* 确保图片不会超出圆形边界 */
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* 头像未读消息角标 */
.avatar-with-badge {
    position: relative;
}

.unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: #f56c6c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.status {
    font-size: 12px;
    opacity: 0.9;
}

.status.online::before {
    content: '●';
    margin-right: 4px;
    color: #67c23a;
}

.user-name {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0; /* 修复flex布局问题 */
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #c0c4cc;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #909399;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.welcome-message h3 {
    font-size: 20px;
    color: #303133;
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 10px;
    max-width: 70%;
    animation: messageSlideIn 0.3s ease;
    margin-bottom: 25px; /* 调整数值可控制间距大小，比如20px、25px */
    
}

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

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.sent .message-content {
    align-items: flex-end; /* 发送方消息右对齐 */
}

.message.received {
    align-self: flex-start;
}

.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden; /* 确保图片不会超出圆形边界 */
    background: #f0f0f0; /* 图片加载前的背景色 */
    position: relative;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 确保图片填满圆形区域 */
    border-radius: 50%;
}

/* 消息头像未读角标 */
.message-avatar .unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    background: #f56c6c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #f0f2f5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start; /* 让子元素根据自己的内容宽度显示 */
}

.message-username {
    font-size: 12px;
    color: #909399;
    padding: 0 4px;
    width: fit-content; /* 根据内容自适应，不撑开父容器 */
    max-width: 100%; /* 不超过父容器 */
}

.message.sent .message-username {
    text-align: right;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
    max-width: 990px; /* 限制最大宽度 */
    width: fit-content; /* 根据内容自适应宽度 */
    min-width: 0; /* 允许缩小 */
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: white;
    color: #303133;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 图片和表情消息不显示气泡背景 */
.message-bubble.no-background {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
}

.message-time {
    font-size: 11px;
    color: #909399;
    margin-right: 0; /* 时间在前，不需要左边距 */
    display: inline; /* inline显示 */
    font-weight: normal; /* 正常字重 */
}

.message-image {
    max-width: 250px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-emoji {
    font-size: 48px;
    line-height: 1;
}

/* GIF表情样式 */
.message-gif-emoji {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
}

/* 输入区域 */
.chat-input-container {
    position: relative; /* 为表情选择器的绝对定位提供参考 */
    background: white;
    border-top: 2px solid #e4e7ed;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.image-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-preview img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    border: 2px solid #dcdfe6;
    object-fit: cover;
}

.btn-cancel-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f56c6c;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 工具栏在输入框上方 */
.chat-input-toolbar {
    position: relative; /* 为表情选择器提供定位参考 */
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.toolbar-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.toolbar-btn:hover {
    background: #f5f7fa;
}

.toolbar-btn:active {
    transform: scale(0.95);
}

/* 工具栏图标统一大小 */
.toolbar-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none; /* 防止图标阻止点击事件 */
}

/* 表情选择器 - 现代弹出式风格，从输入框上方弹出 */
.emoji-picker {
    position: absolute;
    bottom: 100%; /* 在输入框上方 */
    left: 0;
    margin-bottom: 8px; /* 与输入框保持距离 */
    width: 420px;
    max-width: calc(100vw - 32px);
    background: white;
    border: 1px solid #e4e7ed;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    animation: emojiPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

@keyframes emojiPopIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.emoji-picker-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.emoji-tabs {
    display: flex;
    gap: 20px;
}

.emoji-tab {
    padding: 6px 12px;
    font-size: 14px;
    color: #606266;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    user-select: none;
}

.emoji-tab:hover {
    color: #4a68f1;
}

.emoji-tab.active {
    color: #4a68f1;
    font-weight: 500;
}

.emoji-tab.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    border-radius: 1px;
}

.emoji-picker-body {
    padding: 16px;
    max-height: 280px;
    overflow-y: auto;
}

.emoji-picker-body::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker-body::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.emoji-picker-body::-webkit-scrollbar-thumb:hover {
    background: #c0c4cc;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 0;
}

.emoji-item {
    width: 40px;
    height: 40px;
    font-size: 28px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.emoji-item:hover {
    background: #f0f2f5;
    transform: scale(1.15);
}

.emoji-item:active {
    transform: scale(0.95);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #dcdfe6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical; /* 允许垂直调整大小 */
    min-height: 180px; /* 最小高度 - QQ风格 */
    max-height: 300px; /* 最大高度 */
    outline: none;
    transition: border-color 0.3s;
    line-height: 1.6;
}

#messageInput:focus {
    border-color: #4a68f1;
}

/* QQ风格的可调整大小输入框 */
.resizable-input {
    resize: vertical !important;
    min-height: 80px !important;
    max-height: 300px !important;
}

.btn-send {
    padding: 10px 24px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
    transform: translateY(0);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 输入框包装器 */
.input-box-wrapper {
    position: relative;
    border-radius: 8px;
    padding: 0px;
    min-height: 130px;
}

/* 去掉点击后的边框变色效果 */
.input-box-wrapper:focus-within {
    border-color: #e4e7ed; /* 保持原色，不变色 */
}

.message-input-modern {
    width: 100%;
    min-height: 100px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
    padding: 0;
    padding-bottom: 40px; /* 为右下角的发送按钮留出空间 */
    overflow-y: auto;
}

.chat-input-container,
.input-wrapper-modern {
  background-color: #f0f2f5; /* 与消息栏浅灰色保持一致，可根据实际色值微调 */
}

.message-input-modern, 
textarea#messageInput {
  border: none; /* 隐藏边框线条 */
  background-color: #f0f2f5; /* 替换为消息栏的浅灰色，可根据实际视觉微调色值 */
  outline: none; /* 去掉焦点时的轮廓线 */
}

.message-input-modern::placeholder {
    color: #a8abb2;
}

.message-input-modern::-webkit-scrollbar {
    width: 4px;
}

.message-input-modern::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 2px;
}


.btn-send-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-send-modern:active {
    transform: translateY(0);
}

.btn-send-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 客服端发送按钮 - 保持原样 */
.admin-layout .btn-send-modern {
    position: absolute;
    bottom: 20px;
    right: 30px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

/* 客户端发送按钮 - 单独控制（不在admin-layout中的） */
body > #chatContainer .btn-send-modern {
    position: absolute;
    bottom: 8px;
    right: 10px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

/* 用户列表滚动条样式 */
.user-list::-webkit-scrollbar {
    width: 6px;
}

.user-list::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.user-list::-webkit-scrollbar-thumb:hover {
    background: #c0c4cc;
}

/* 输入框拉伸手柄样式优化 */
.resizable-input::-webkit-resizer {
    background: linear-gradient(135deg, transparent 0%, transparent 40%, #4a68f1 40%, #4a68f1 60%, transparent 60%);
}

/* 提示文本样式 */
.input-hint-text {
    font-size: 11px;
    color: #909399;
    padding: 0 4px;
    margin-bottom: 4px;
}

/* 头部操作按钮 */
.header-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .message {
        max-width: 85%;
    }

    .emoji-picker {
        width: calc(100vw - 32px);
        left: 0;
        right: 0;
        margin: 0 16px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .emoji-item {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    
    /* 文件列表响应式 */
    .file-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .file-icon {
        height: 100px;
    }
    
    .file-name {
        font-size: 12px;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .sidebar {
        width: 240px;
    }
    
    .resizable-input {
        min-height: 60px !important;
    }
}

/* 滚动到底部按钮 */
.scroll-to-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #dcdfe6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.scroll-to-bottom:hover {
    background: #f5f7fa;
    transform: translateY(-2px);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 系统消息 */
.system-message {
    text-align: center;
    color: #909399;
    font-size: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin: 8px auto;
    max-width: 300px;
}



/* 文件列表 - 网格布局，支持缩略图 */
.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 4px;
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e4e7ed;
    border-radius: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-item:hover {
    border-color: #4a68f1;
    box-shadow: 0 8px 20px rgba(74, 104, 241, 0.15);
    transform: translateY(-4px);
}

.file-item:active {
    transform: translateY(-2px);
}

/* 文件图标/缩略图容器 */
.file-icon {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f2f5 0%, #e4e7ed 100%);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

/* 图片缩略图 */
.file-icon img.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文件类型图标 */
.file-icon .file-type-icon {
    font-size: 48px;
    color: #4a68f1;
}

.file-info {
    width: 100%;
    text-align: center;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #303133;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.file-meta {
    font-size: 11px;
    color: #909399;
}

/* 文件选中效果 */
.file-item.selected {
    border-color: #4a68f1;
    background: linear-gradient(135deg, #f0f5ff 0%, #e6f0ff 100%);
}

.file-item.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.file-loading,
.file-empty,
.file-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #909399;
    font-size: 14px;
}

.file-empty small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #c0c4cc;
}

.file-error {
    color: #f56c6c;
}

/* 图片类型标识 */
.file-icon .image-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(74, 104, 241, 0.9);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* 文件选择弹窗样式 */
.modal.file-picker-modal {
    z-index: 2000;
}

.modal-content.file-picker {
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.file-list {
    max-height: 500px;
    overflow-y: auto;
}

.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

/* ============================================ */
/* 快捷消息弹窗样式 - 从右侧滑出 */
/* ============================================ */
.quick-msg-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 90vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.quick-msg-modal.show {
    transform: translateX(0);
}

#quickMsgModal {
    background: transparent;
    align-items: flex-end;
    justify-content: flex-start;
    backdrop-filter: none;
    z-index: 1000;
}

#quickMsgModal .modal-content {
    animation: none;
}

.quick-msg-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    min-height: 200px; /* 设置最小高度，防止内容变化导致按钮跳动 */
}

.quick-msg-list::-webkit-scrollbar {
    width: 6px;
}

.quick-msg-list::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.quick-msg-empty {
    text-align: center;
    padding: 60px 20px;
    color: #909399;
    font-size: 14px;
}

.quick-msg-item {
    padding: 12px 16px;
    background: #f5f7fa;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.quick-msg-item:hover {
    background: #e6f2ff;
    border-color: #4a68f1;
    transform: translateX(4px);
}

.quick-msg-content {
    width: 100%; /* 占满整行 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.5;
    height: 21px; /* 固定高度 */
    text-align: left; /* 文字左对齐 */
    padding-right: 0; /* 不给按钮预留空间 */
}

.quick-msg-content * {
    display: inline; /* 强制所有子元素内联显示 */
    white-space: nowrap;
}

.quick-msg-actions {
    position: absolute; /* 绝对定位，覆盖在文字上 */
    right: 12px; /* 右边距 */
    top: 50%; /* 垂直居中 */
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    opacity: 0; /* 默认隐藏 */
    pointer-events: none; /* 隐藏时不响应鼠标事件，避免影响文字选择 */
    transition: all 0.2s;
    padding-left: 30px; /* 左侧渐变区域 */
    background: linear-gradient(to right, transparent, #f5f7fa 20%, #f5f7fa);
}

.quick-msg-item:hover .quick-msg-actions {
    opacity: 1; /* 悬停时显示 */
    pointer-events: auto; /* 显示时可以响应鼠标事件 */
    background: linear-gradient(to right, transparent, #e6f2ff 20%, #e6f2ff); /* 悬停时显示渐变背景 */
}

.quick-msg-edit,
.quick-msg-delete {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quick-msg-edit {
    background: #4a68f1;
    color: white;
}

.quick-msg-edit:hover {
    background: #3a58e1;
    transform: scale(1.1);
}

.quick-msg-delete {
    background: #f56c6c;
    color: white;
}

.quick-msg-delete:hover {
    background: #e55353;
    transform: scale(1.1);
}

.btn-add-quick-msg {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.btn-add-quick-msg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 104, 241, 0.4);
}

.btn-add-quick-msg span {
    font-size: 20px;
    font-weight: bold;
}

/* ============================================ */
/* 图片预览灯箱样式 */
/* ============================================ */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.lightbox-image-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-image-container img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 40px);
    border-radius: 12px;
    object-fit: contain;
    pointer-events: none;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.lightbox-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* ============================================ */
/* ============================================ */
/* 加载更多历史消息按钮样式 */
/* ============================================ */
.load-more-messages {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin: 15px 0;
}

.load-more-messages button {
    padding: 12px 28px;
    background: rgba(74, 104, 241, 0.08);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(74, 104, 241, 0.2);
    border-radius: 50px;
    color: #4a68f1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(74, 104, 241, 0.1);
}

.load-more-messages button:hover {
    background: rgba(74, 104, 241, 0.12);
    border-color: rgba(74, 104, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(74, 104, 241, 0.2);
}

.load-more-messages button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 104, 241, 0.15);
}

.load-more-messages .hourglass-icon {
    font-size: 16px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(180deg);
    }
}

/* ============================================ */
/* 编辑快捷消息弹窗样式 */
/* ============================================ */
.edit-quick-msg-modal {
    max-width: 600px;
    width: 90%;
    z-index: 1100; /* 比快捷消息弹窗（1000）更高，确保在上层 */
}

.rich-text-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f5f7fa;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #e4e7ed;
}

.rt-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rt-btn:hover {
    background: #4a68f1;
    color: white;
    transform: scale(1.05);
}

.rt-btn:active,
.rt-btn.active {
    background: #3a58e1;
    color: white;
}

.rt-separator {
    width: 1px;
    height: 24px;
    background: #dcdfe6;
}

.rt-color {
    display: none;
}

.rt-color-label {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s;
}

.rt-color-label:hover {
    transform: scale(1.1);
    background: #f0f2f5;
}

.rich-text-editor {
    min-height: 150px;
    max-height: 300px;
    padding: 16px;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    background: white;
}

.rich-text-editor::-webkit-scrollbar {
    width: 6px;
}

.rich-text-editor::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.rich-text-editor[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #c0c4cc;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid #e4e7ed;
}

.btn-cancel,
.btn-save {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: #f5f7fa;
    color: #606266;
}

.btn-cancel:hover {
    background: #e4e7ed;
}

.btn-save {
    background: linear-gradient(135deg, #4a68f1 0%, #205cf0 100%);
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 104, 241, 0.4);
}


