/**
 * ============================================================
 * 在线客服聊天窗口 - 完整样式文件
 * ============================================================
 * 
 * @description 客服聊天窗口的所有样式，包括布局、消息气泡、
 *              音频播放器、文档附件、暗黑模式等
 * 
 * @author 声匠配音团队
 * @version 3.0.0
 * @since 2024-12-21
 * @lastModified 2025-01-30
 * 
 * @features
 * - 毛玻璃透明效果
 * - 消息气泡样式（客服/用户）
 * - 音频播放器（波形可视化）
 * - 文档附件样式
 * - 回复引用样式
 * - 右键菜单
 * - 暗黑模式适配
 * - 移动端响应式
 * - 动画效果
 * 
 * @relatedFiles
 * - js/web/customer-chat.js  客服聊天主文件
 * - js/web/chat-drag.js      拖动功能
 * - js/web/chat-resize.js    缩放功能
 * 
 * @colorScheme
 * - 主色调：橙色 (#FB8C00, #F57C00)
 * - 用户消息：蓝色边框 (#2196F3)
 * - 客服消息：白色背景
 * - 背景：透明毛玻璃效果
 * 
 * ============================================================
 */

/* ===== 消息容器样式（JavaScript生成的消息） ===== */
.cs-message-modern {
    display: flex;
    margin: 15px 0;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.cs-message-modern.agent {
    flex-direction: row;
    justify-content: flex-start;
}

.cs-message-modern.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* 消息头像样式 - ✨ 重设计 */
.cs-message-avatar-modern {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cs-message-modern.agent .cs-message-avatar-modern {
    background: linear-gradient(135deg, #ff8c42 0%, #f57c00 100%);
    margin: 4px 10px 0 0;   /* 与时间标签顶端持平 (bubble 20px - header -16px = 4px) */
    align-self: flex-start;
}

.cs-message-modern.user .cs-message-avatar-modern {
    background: linear-gradient(135deg, #4a90e2 0%, #1a6dd4 100%);
    margin: 4px 0 0 10px;   /* 与时间标签顶端持平 */
    align-self: flex-start;
}

/* 消息气泡基础样式 */
.cs-message-bubble-modern {
    padding: 10px 14px;
    border-radius: 14px;
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 68%;
    flex-shrink: 1;
    flex-grow: 0;
    margin-top: 20px;
    overflow: visible;
}

/* 客服消息气泡 - 纯投影阴影，无边框/外框，避免三角接缝出现黑线 */
.cs-message-bubble-modern.bubble-agent {
    background: #ffffff;
    color: #1a1d21;
    box-shadow: 0 1px 6px rgba(0,0,0,0.10), 0 2px 16px rgba(0,0,0,0.06);
    border: none;
    border-radius: 14px;
}

/* 用户消息气泡 - 蓝色，四角圆润 */
.cs-message-bubble-modern.bubble-user {
    background: linear-gradient(135deg, #2278e0 0%, #1a6dd4 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(26, 109, 212, 0.25), 0 4px 16px rgba(26, 109, 212, 0.12);
    border: none;
    border-radius: 14px;
}

/* ===== 消息头部（名字+时间）浮在气泡外上方，与头像顶端对齐 ===== */
/* 计算: 气泡 margin-top(20px) - top绝对值(16px) = 4px = 头像 margin-top(4px) → 持平 */
.cs-message-header {
    position: absolute;
    top: -16px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    color: #96a0b5;
    margin-bottom: 0;
    line-height: 1;
}

/* 客服：标签靠左 */
.bubble-agent .cs-message-header {
    left: 0;
}

/* 用户：标签靠右（颜色强制灰色，不随气泡颜色继承） */
.bubble-user .cs-message-header {
    right: 0;
    flex-direction: row-reverse;
    color: #96a0b5 !important;
}

.cs-message-time {
    font-weight: 400;
    font-size: 11px;
    color: #96a0b5 !important;
}

/* 消息内容 */
.cs-message-content {
    font-size: 14px;
    line-height: 1.55;
    font-weight: 400;
}

.bubble-user .cs-message-content {
    color: #ffffff;
}

.bubble-agent .cs-message-content {
    color: #1a1d21;
}

/* 空消息提示 */
/* 🚀 加载状态样式 */
.cs-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
}

.cs-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: #ff9800;
    border-radius: 50%;
    animation: cs-spin 0.8s linear infinite;
}

@keyframes cs-spin {
    to { transform: rotate(360deg); }
}

.cs-loading-text {
    margin-top: 12px;
    color: #999;
    font-size: 13px;
}

.cs-empty-message {
    text-align: center;
    padding: 40px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.cs-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #FF9800 0%, #FB8C00 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cs-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: block;
}

.cs-empty-desc {
    font-size: 13px;
    color: #999;
    margin: 0;
    line-height: 1.7;
    display: block;
    white-space: normal;
    word-wrap: break-word;
}

/* 附件容器 */
.cs-attachment-container {
    margin-top: 10px;
}

/* 音频附件 */
.cs-audio-attachment {
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bubble-agent .cs-audio-attachment {
    color: #333;
}

.bubble-user .cs-audio-attachment {
    color: #000000;
}

.cs-audio-icon {
    font-size: 18px;
}

.cs-audio-info {
    flex: 1;
    min-width: 0;
}

.cs-audio-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-audio-size {
    opacity: 0.7;
}

/* 文件附件 */
.cs-file-attachment {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bubble-agent .cs-file-attachment {
    color: #333;
}

.bubble-user .cs-file-attachment {
    color: #000000;
}

.cs-file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.cs-file-info {
    flex: 1;
    min-width: 0;
}

.cs-file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.cs-file-size {
    font-size: 11px;
    opacity: 0.7;
}

/* 图片附件 - 直接预览 */
.cs-image-attachment {
    margin-top: 10px;
}

.cs-image-preview-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    max-width: 280px;
}

.cs-image-preview {
    display: block;
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
}

.cs-image-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 文件预览样式 */
.cs-file-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInDown 0.3s ease;
}

.cs-file-preview-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cs-file-preview-icon {
    font-size: 24px;
}

.cs-file-preview-info {
    flex: 1;
    min-width: 0;
}

.cs-file-preview-name {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    margin-bottom: 2px;
}

.cs-file-preview-size {
    font-size: 11px;
    color: #999;
}

.cs-file-ready {
    color: #0f766e;
    font-weight: 600;
}

.cs-file-preview-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
    font-size: 16px;
    color: #999;
}

.cs-file-preview-close:hover {
    background: #e0e0e0;
}

/* 可编辑输入区：文字与内联附件同一流 */
.cs-composer-inline-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
    min-height: 44px;
}

.cs-composer-inline-row #cs-message-input-modern {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

#cs-message-input-modern.cs-composer-editable {
    position: relative;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    max-height: 120px;
    line-height: 1.5;
    font-size: 15px;
    color: #1a1d21;
    caret-color: #1a6dd4;
    user-select: text;
    -webkit-user-select: text;
}

/* 占位文案脱离文档流，避免挡住 contenteditable 的插入竖线（光标） */
#cs-message-input-modern.cs-composer-editable.is-empty:before {
    content: attr(data-placeholder);
    color: #b0b8c8;
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
}

/* 横向小卡片：内联在光标旁，与文字同一行 */
.cs-wx-inline-chip {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    vertical-align: middle;
    margin: 0 3px 2px 0;
    height: 36px;
    max-height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
    cursor: pointer;
}

.cs-wx-inline-chip:focus-visible {
    outline: 2px solid rgba(26, 109, 212, 0.45);
    outline-offset: 1px;
}

.cs-wx-inline-chip--image {
    width: 36px;
    padding: 0;
    overflow: hidden;
}

.cs-wx-inline-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cs-wx-inline-chip--file {
    min-width: 0;
    max-width: 100%;
    padding: 0 2px 0 8px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.04);
}

.cs-wx-inline-chip-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    line-height: 1.15;
}

.cs-wx-inline-name {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-wx-inline-size {
    font-size: 11px;
    color: #888;
}

.cs-wx-inline-chip-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 28px;
    margin-right: 2px;
    border-radius: 4px;
    overflow: hidden;
}

.cs-wx-inline-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.cs-wx-inline-badge--audio {
    background: linear-gradient(145deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
}

.cs-wx-inline-badge--pdf {
    background: linear-gradient(145deg, #ffebee, #ffcdd2);
    color: #c62828;
    font-size: 10px;
}

.cs-wx-inline-badge--word {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    font-size: 14px;
    font-weight: 800;
    font-family: Georgia, 'Times New Roman', serif;
}

.cs-wx-inline-badge--txt {
    background: linear-gradient(145deg, #f5f5f5, #e0e0e0);
    color: #424242;
    font-size: 9px;
}

.cs-wx-inline-badge--zip {
    background: linear-gradient(145deg, #fff8e1, #ffecb3);
    color: #f57f17;
    font-size: 9px;
}

.cs-wx-inline-badge--doc {
    background: linear-gradient(145deg, #eceff1, #cfd8dc);
    color: #37474f;
    font-size: 9px;
}

/* 音频播放器样式 */
.cs-audio-player {
    width: 100%;
    height: 36px;
    border-radius: 6px;
    margin-top: 8px;
}

.cs-audio-download {
    margin-top: 8px;
    text-align: center;
}

.cs-download-link {
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
}

.bubble-agent .cs-download-link {
    color: #2196f3;
}

.bubble-user .cs-download-link {
    color: #0D47A1;
}

.cs-download-icon {
    flex-shrink: 0;
}

/* ===== 聊天容器（包裹聊天窗口，挂在 body 下、.Whole 外，避免被页面层叠上下文压在遮罩下） ===== */
#cs-chat-container {
    position: relative;
    z-index: 100000;
    pointer-events: none;
}

#cs-chat-container > * {
    pointer-events: auto;
}

/* ===== 聊天窗口基础样式 ===== */
#cs-chat-window-modern {
    position: fixed;
    /* 自适应居中 - 无论窗口大小如何变化 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 526px;
    height: 650px;
    max-width: 95vw;
    max-height: 95vh;
    /* ✨ 重设计：更精致的圆角与多层阴影（与微信皮肤统一为白底） */
    background: #ffffff;
    border-radius: 18px;
    border: none;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.14),
        0 40px 80px rgba(0, 0, 0, 0.06);
    display: none;
    will-change: transform, opacity;
    flex-direction: column;
    overflow: hidden;
    z-index: 100000;
}

/* 显示状态 */
#cs-chat-window-modern.show {
    display: flex;
    /* 🎨 显示时加强视觉效果 */
    animation: chatWindowShow 0.3s ease-out;
}

/* 窗口显示动画 */
@keyframes chatWindowShow {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* 拖拽/缩放时禁用过渡 */
#cs-chat-window-modern.dragging,
#cs-chat-window-modern.resizing {
    transition: none;
}

/* 拖拽时的光标 */
#cs-chat-window-modern.dragging #cs-chat-header-modern {
    cursor: grabbing;
}

/* ===== 响应式居中类 - 关键样式 ===== */
.chat-window-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    /* transform 由 JS 动画控制，不使用 */
    transform: translate(-50%, -50%);
    margin: 0;
}

/* 用户拖动后的状态 */
.chat-window-dragged {
    position: fixed;
    /* JavaScript 会设置 top/left，清除居中的 transform */
    transform: none;
}

/* ===== 聊天窗口头部 - 深色科技混合渐变（明暗模式统一） ===== */
#cs-chat-header-modern {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(125deg, #070b14 0%, #0f172a 38%, #111827 100%);
    color: #f0f9ff;
    padding: 16px 20px;
    border-radius: 18px 18px 0 0;
    border-bottom: 1px solid rgba(56, 189, 248, 0.22);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    box-shadow:
        0 4px 28px rgba(6, 182, 212, 0.18),
        0 8px 32px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* 头部混合渐变光晕层 */
#cs-chat-header-modern::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    background:
        radial-gradient(ellipse 90% 140% at 8% 45%, rgba(6, 182, 212, 0.55) 0%, transparent 58%),
        radial-gradient(ellipse 75% 110% at 92% 18%, rgba(129, 140, 248, 0.48) 0%, transparent 52%),
        radial-gradient(ellipse 65% 95% at 55% 110%, rgba(20, 184, 166, 0.38) 0%, transparent 48%),
        linear-gradient(108deg,
            rgba(14, 165, 233, 0.32) 0%,
            rgba(59, 130, 246, 0.22) 28%,
            rgba(139, 92, 246, 0.28) 52%,
            rgba(6, 182, 212, 0.24) 78%,
            rgba(16, 185, 129, 0.16) 100%);
    mix-blend-mode: screen;
}

#cs-chat-header-modern::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.02) 38%,
        rgba(0, 0, 0, 0.12) 100%);
}

#cs-chat-header-modern > * {
    position: relative;
    z-index: 1;
}

#cs-chat-header-modern:active {
    cursor: grabbing;
}

/* 旧版头部样式已移至第817行的完整样式补充中 */

/* 头部右侧按钮容器 */
.chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 返回按钮 - 桌面端默认隐藏 */
.chat-back-btn {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* 放大按钮 / 新窗口打开 */
.chat-expand-btn,
.chat-newtab-btn {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    transition: background-color 0.15s, color 0.15s;
    background: transparent;
    border: none;
}

.chat-expand-btn:hover,
.chat-newtab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.chat-expand-btn svg,
.chat-newtab-btn svg {
    transition: transform 0.2s;
}

/* 放大状态下的按钮图标旋转 */
.chat-expanded .chat-expand-btn svg {
    transform: rotate(45deg);
}

/* 最小化按钮 */
.chat-close-btn {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 22px;
    transition: background-color 0.15s, color 0.15s;
    background: transparent;
    border: none;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* 消息列容器：占满头部与输入区之间，「回到最新消息」相对本区域底部定位 */
.cs-chat-main-column {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}

/* ===== 消息区域 - ✨ 重设计 ===== */
#cs-messages-modern {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 20px 16px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    /* 长列表重绘时缩小影响范围，减轻打开/滚动时的卡顿 */
    contain: layout paint;
}

/* 消息区域滚动条 */
#cs-messages-modern::-webkit-scrollbar {
    width: 8px;
}

#cs-messages-modern::-webkit-scrollbar-track {
    background: transparent;
}

#cs-messages-modern::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

#cs-messages-modern::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ===== 输入区域 - ✨ 重设计 ===== */
#cs-input-area-modern {
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
    position: relative;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.04), 0 -6px 20px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

/* 输入区域布局 */
.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

/* 文件上传包装器 */
.chat-file-wrapper {
    position: relative;
}

/* 隐藏文件输入 */
#cs-file-input {
    display: none;
}

/* 文件上传按钮 - ✨ 重设计 */
.chat-file-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    background: #f3f6fb;
    border: 1.5px solid #e4e9f2;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #8a96a8;
}

.chat-file-btn:hover {
    background: #e8f0fd;
    border-color: #1a6dd4;
    color: #1a6dd4;
    box-shadow: 0 2px 10px rgba(26, 109, 212, 0.15);
}

/* 消息输入框 - ✨ 重设计 */
#cs-message-input-modern {
    flex: 1;
    min-width: 0;
    padding: 11px 16px;
    border: 1.5px solid #e4e9f2;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    color: #1a1d21;
    background: #f9fafc;
    transition: all 0.2s ease;
    height: 42px;
    box-sizing: border-box;
}

#cs-message-input-modern:focus {
    border-color: #1a6dd4;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(26, 109, 212, 0.10);
}

#cs-message-input-modern::placeholder {
    color: #b0b8c8;
    font-size: 13.5px;
}

/* 发送按钮 - ✨ 重设计 */
.chat-send-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%);
    color: #ffffff;
    border: none;
    padding: 0 22px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgba(26, 109, 212, 0.30);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #2278e0 0%, #1565c8 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(26, 109, 212, 0.40);
}

.chat-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 109, 212, 0.25);
}

/* ===== 拖拽上传提示层 ===== */
#cs-drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.98), rgba(25, 118, 210, 0.98));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 0 0 16px 16px;
}

#cs-drag-overlay.show {
    display: flex;
}

/* 拖拽提示内容 */
.drag-overlay-content {
    text-align: center;
    color: white;
    transform: scale(1);
    transition: transform 0.3s ease;
}

/* 拖拽图标容器 */
.drag-overlay-icon {
    background: rgba(255,255,255,0.2);
    width: 120px;
    height: 120px;
    border-radius: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 3px dashed white;
}

/* 拖拽标题 */
.drag-overlay-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 拖拽副标题 */
.drag-overlay-subtitle {
    font-size: 16px;
    opacity: 0.95;
    font-weight: 500;
}

/* 拖拽提示文字 */
.drag-overlay-hint {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 8px;
}

/* （文件预览样式见上文「输入框内嵌附件预览」.cs-file-preview-inline） */

/* ===== 弹窗样式已移至 footer-popups.css ===== */
/* 所有底部浮动弹窗样式现在统一在 footer-popups.css 中管理 */

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    #cs-chat-window-modern,
    #cs-chat-window-modern.chat-window-centered,
    #cs-chat-window-modern.chat-window-dragged {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        border-radius: 0;
        border: none;
        box-shadow: none;
        /* 🔧 移动端触摸滚动优化 */
        overflow: hidden;
        /* 🔧 使用 dvh 单位适应虚拟键盘，回退到 vh */
        height: 100dvh;
        height: 100vh; /* 降级方案 */
    }
    
    /* 🔧 支持 dvh 的浏览器覆盖 vh */
    @supports (height: 100dvh) {
        #cs-chat-window-modern,
        #cs-chat-window-modern.chat-window-centered,
        #cs-chat-window-modern.chat-window-dragged {
            height: 100dvh;
        }
    }
    
    /* 移动端头部调整 - 🔧 居中布局 */
    #cs-chat-header-modern {
        cursor: default;
        padding: 10px 12px;
        display: flex;
        justify-content: center; /* 整体居中 */
        align-items: center;
        position: relative;
    }
    
    #cs-chat-header-modern::before {
        display: none;
    }
    
    /* 移动端返回按钮 - 左侧绝对定位 */
    #cs-chat-header-modern .chat-back-btn {
        display: flex;
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: #fff;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }
    
    #cs-chat-header-modern .chat-back-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }
    
    /* 移动端头部左侧容器 - 左右结构 */
    #cs-chat-header-modern .chat-header-left {
        gap: 10px;
        flex-direction: row; /* 水平排列 */
        align-items: center;
        text-align: left;
    }
    
    /* 移动端客服头像 - 🔧 缩小 */
    #cs-chat-header-modern .chat-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    /* 移动端客服信息容器 - 🔧 垂直排列，防止重叠 */
    #cs-chat-header-modern .chat-service-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
        text-align: left;
        justify-content: center;
        min-height: 36px;
    }
    
    /* 移动端客服名称 - 🔧 确保独占一行 */
    #cs-chat-header-modern .chat-service-name {
        display: block;
        width: 100%;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 0;
    }
    
    /* 移动端QQ号 - 🔧 确保独占一行 */
    #cs-chat-header-modern .chat-service-qq {
        display: block;
        width: 100%;
        font-size: 12px;
        opacity: 0.9;
        line-height: 1.3;
        margin-top: 0;
    }
    
    /* 移动端放大 / 新窗口按钮（隐藏，移动端全屏不需要） */
    #cs-chat-header-modern .chat-expand-btn,
    #cs-chat-header-modern .chat-newtab-btn {
        display: none;
    }
    
    /* 移动端右侧按钮容器 - 绝对定位到右边 */
    #cs-chat-header-modern .chat-header-right {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* 移动端关闭按钮 - 🔧 缩小 */
    #cs-chat-header-modern .chat-close-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
        min-width: 32px;
        min-height: 32px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 8px;
    }
    
    #cs-chat-header-modern .chat-close-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }
    
    /* 移动端消息气泡样式调整 */
    .cs-message-bubble-modern {
        font-size: 15px;
        padding: 10px 14px;
        line-height: 1.5;
        max-width: 75%;
    }
    
    .cs-message-avatar-modern {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    /* 移动端输入区域容器 - 🔧 减小padding + 键盘适配 */
    #cs-input-area-modern {
        padding: 8px 10px;
        /* 🔧 底部安全区域适配（微信浏览器导航栏 + iPhone X等刘海屏） */
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #e8e8e8;
        /* 🔧 确保输入区域不被压缩 */
        flex-shrink: 0;
        min-height: auto;
        /* 🔧 输入区域背景确保可见 */
        background: #fafbfc;
        /* 🔧 防止输入时出现问题 */
        position: relative;
        z-index: 10;
        /* 🔧 确保不溢出 */
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }
    
    /* 🔧 微信浏览器底部导航栏适配 - 增加聊天窗口底部边距 */
    #cs-chat-window-modern {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    /* 移动端输入行容器 - 🔧 修复自适应问题 */
    .chat-input-row {
        gap: 6px;
        align-items: center;
        flex-wrap: nowrap;
        display: flex;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* 微信两行输入区：纵向排列，首行输入全宽 */
    .chat-input-row.cs-wechat-composer {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
    }

    .chat-input-row.cs-wechat-composer .chat-input-wrapper {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }

    .cs-wechat-composer-toolbar {
        flex-shrink: 0;
    }
    
    /* 移动端文件上传包装器 */
    .chat-file-wrapper {
        flex: 0 0 36px;
        width: 36px;
    }
    
    /* 移动端文件上传按钮 - 🔧 更小尺寸 */
    .chat-file-btn {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        min-width: 36px;
        max-width: 36px;
    }
    
    /* 移动端输入框包装器 - 🔧 关键：允许收缩 */
    .chat-input-wrapper {
        flex: 1 1 0;
        min-width: 0;
        max-width: calc(100% - 100px);
        position: relative;
    }
    
    /* 移动端输入框 - 🔧 修复宽度自适应 */
    #cs-message-input-modern {
        width: 100%;
        min-width: 0;
        font-size: 16px;
        padding: 8px 36px 8px 12px;
        border-radius: 18px;
        height: 36px;
        box-sizing: border-box;
    }
    
    /* 移动端历史记录按钮 - 在输入框内部 */
    .chat-history-btn {
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        width: 26px;
        height: 26px;
    }
    
    /* 移动端发送按钮 - 🔧 确保始终显示 */
    .chat-send-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
        height: 36px;
        border-radius: 18px;
        white-space: nowrap;
        width: auto;
        min-width: 48px;
        max-width: 60px;
    }
    
    .chat-file-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* 移动端历史记录按钮 - 🔧 更小 */
    .chat-history-btn {
        right: 4px;
        width: 26px;
        height: 26px;
    }
    
    .chat-history-btn svg {
        width: 14px;
        height: 14px;
    }

    /*
     * 微信皮肤：历史按钮在 .cs-wechat-composer-toolbar 内与附件、发送同一行。
     * 上文「输入框内绝对定位」仅适用于旧单栏输入；若不重置，history 会相对 #cs-input-area-modern
     * 垂直居中，与底栏图标/发送按钮明显不在一条线上。
     * 与附件/发送的等高、对齐见 chat-wechat-skin.css（.cs-wechat-skin 内 !important 覆盖桌面高度）。
     */
    #cs-chat-window-modern .cs-wechat-composer-toolbar .chat-history-btn {
        position: relative;
        right: auto;
        top: auto;
        left: auto;
        transform: none;
        width: 36px;
        height: 36px;
        min-width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    #cs-chat-window-modern .cs-wechat-composer-toolbar .chat-history-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* 移动端弹窗样式已移至 footer-popups.css */
}

/* ========================================
   聊天窗口完整样式补充 - 2025-12-22
   包含所有缺失的元素样式
   ======================================== */

/* ===== 聊天头部详细样式 - ✨ 重设计 ===== */
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: url('../../img/logo.png') center center / cover no-repeat, linear-gradient(135deg, #ffffff30 0%, #ffffff10 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.20);
    border: 1.5px solid rgba(255,255,255,0.25);
}

.chat-service-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-service-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.chat-service-qq {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-service-qq::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
    flex-shrink: 0;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.chat-expand-btn,
.chat-newtab-btn,
.chat-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.chat-expand-btn:hover,
.chat-newtab-btn:hover {
    background: rgba(255,255,255,0.22);
    color: #ffffff;
    transform: scale(1.05);
}

.chat-close-btn {
    font-size: 20px;
    line-height: 1;
}

.chat-close-btn:hover {
    background: rgba(255, 80, 80, 0.35);
    color: #ffffff;
    transform: scale(1.05);
}

/* ===== 输入区域详细样式 - ✨ 重设计 ===== */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 前台在线客服（微信皮肤）：上输入 + 下工具条，与 cs-wechat-composer 配套 */
.chat-input-row.cs-wechat-composer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.cs-wechat-composer-top {
    width: 100%;
    min-width: 0;
}

.cs-wechat-composer-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.chat-input-row.cs-wechat-composer .chat-send-btn {
    margin-left: auto;
}

.chat-file-wrapper {
    position: relative;
    flex-shrink: 0;
}

.chat-file-wrapper input[type="file"] {
    display: none;
}

/* 附件按钮 - 与上方主样式统一 */
.chat-file-btn {
    width: 42px;
    height: 42px;
    border: 1.5px solid #e4e9f2;
    border-radius: 12px;
    background: #f3f6fb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #8a96a8;
    flex-shrink: 0;
}

.chat-file-btn:hover {
    background: #e8f0fd;
    border-color: #1a6dd4;
    color: #1a6dd4;
}

.chat-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.chat-input-wrapper input {
    flex: 1;
    height: 42px;
    padding: 0 42px 0 14px;
    border: 1.5px solid #e4e9f2;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #f9fafc;
    color: #1a1d21;
    transition: all 0.2s ease;
}

.chat-input-wrapper input:focus {
    border-color: #1a6dd4;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(26, 109, 212, 0.10);
}

.chat-input-wrapper input::placeholder {
    color: #b0b8c8;
}

.chat-history-btn {
    position: absolute;
    right: 8px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    transition: all 0.2s;
    z-index: 10;
    color: #b0b8c8;
}

.chat-history-btn:hover {
    background: #eef2f8;
    color: #1a6dd4;
}

.chat-send-btn {
    height: 42px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 20px;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgba(26, 109, 212, 0.28);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(26, 109, 212, 0.38);
}

.chat-send-btn:active {
    transform: translateY(0);
}

/* ===== 拖拽上传覆盖层 ===== */
#cs-drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 87, 34, 0.98);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#cs-drag-overlay.show {
    display: flex;
}

.drag-overlay-content {
    text-align: center;
    color: white;
}

.drag-overlay-icon {
    margin-bottom: 16px;
}

.drag-overlay-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.drag-overlay-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.drag-overlay-hint {
    font-size: 12px;
    opacity: 0.8;
}

/* ===== 聊天记录侧边栏样式 ===== */
.cs-history-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: #ffffff;
    border-left: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

.cs-history-sidebar.show {
    transform: translateX(0);
}

/* 侧边栏头部 */
.cs-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
    background: #ff572214;
}

.cs-history-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.cs-history-close-btn {
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #666;
    transition: all 0.2s;
}

.cs-history-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* 筛选按钮 */
.cs-history-filters {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.cs-filter-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    background: #ffffff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.cs-filter-btn:hover {
    border-color: #7b4397;
    color: #7b4397;
}

.cs-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #ffffff;
}

/* 搜索框 */
.cs-history-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.cs-history-search svg {
    flex-shrink: 0;
}

.cs-history-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: #333;
    background: transparent;
}

.cs-history-search input::placeholder {
    color: #999;
}

/* 日期选择 */
.cs-history-date {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.cs-date-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #666;
}

.cs-date-display:hover {
    border-color: #7b4397;
    background: #f5f0ff;
}

.cs-calendar-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #e5e5e5;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cs-calendar-btn:hover {
    border-color: #7b4397;
    background: #f5f0ff;
}

/* 日历面板 */
.cs-calendar-panel {
    margin: 0 20px 12px;
    padding: 12px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.cs-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cs-calendar-month {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.cs-calendar-nav {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.cs-calendar-nav:hover {
    background: #e5e5e5;
    color: #333;
}

.cs-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.cs-calendar-weekdays div {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 4px 0;
}

.cs-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cs-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
}

.cs-calendar-day:hover {
    background: #e5e5e5;
}

.cs-calendar-day.has-message {
    background: #f5f0ff;
    color: #7b4397;
    font-weight: 600;
}

.cs-calendar-day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.cs-calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* 本会话该日无聊天记录：灰显且不可点（由 JS 不绑定点击） */
.cs-calendar-day.no-messages-day {
    color: #8a8a8a;
    background: #ececec;
    cursor: not-allowed;
    font-weight: 400;
}

.cs-calendar-day.no-messages-day:hover {
    background: #ececec;
}

.cs-calendar-day.selected.no-messages-day {
    /* 不应出现：无消息日不可选 */
    background: #ececec;
    color: #8a8a8a;
}

/* 消息记录列表 */
.cs-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
}

.cs-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.cs-history-empty svg {
    margin-bottom: 12px;
}

.cs-history-empty p {
    font-size: 13px;
    margin: 0;
}

.cs-history-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.cs-history-item:hover {
    background: #f5f0ff;
    border-color: #7b4397;
    transform: translateX(-2px);
}

.cs-history-item-highlight {
    background: #fff8e1;
    border-color: #ffa726;
}

.cs-history-item-sender {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
    padding-bottom: 4px;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.cs-sender-name {
    font-size: 13px;
    font-weight: 600;
}

.cs-sender-name.sender-agent {
    color: #FF5722;
}

.cs-sender-name.sender-user {
    color: #2196F3;
}

.cs-history-item-time {
    font-size: 11px;
    color: #999;
}

.cs-history-item-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 0px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.cs-history-item-type.audio {
    background: #e3f2fd;
    color: #1976d2;
}

.cs-history-item-type.document {
    background: #fff3e0;
    color: #f57c00;
}

.cs-history-item-type.link {
    background: #e8f5e9;
    color: #388e3c;
}

.cs-history-item-content {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

/* 移动端聊天记录侧边栏 */
@media (max-width: 768px) {
    .cs-history-sidebar {
        width: 100%;
        border-left: none;
    }
}

/* ===== 暗黑模式适配 ===== */
body.dark-mode .chat-service-name {
    color: #e0e0e0;
}

body.dark-mode .chat-input-wrapper input {
    background: #2a2d3a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

body.dark-mode .cs-history-sidebar {
    background: #1f222e;
    border-left-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .cs-history-header {
    background: #2a2d3a;
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .cs-history-title {
    color: #e0e0e0;
}

body.dark-mode .cs-filter-btn {
    background: #2a2d3a;
    color: #b0b0b0;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .cs-history-item {
    background: #2a2d3a;
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .cs-history-item:hover {
    background: #252836;
}

body.dark-mode .cs-history-item-content {
    color: #b0b0b0;
}

/* ========================================
   补充缺失的交互样式 - 2025-12-22
   包含：回复、右键菜单、批量操作、确认框等
   ======================================== */

/* ===== 回复预览区域 ===== */
.cs-reply-preview {
    background: #f8f9fa;
    border-left: 3px solid #0084ff;
    padding: 10px 12px;
    margin: 0 0 10px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 6px;
    animation: slideDown 0.2s ease;
}

.cs-reply-content {
    flex: 1;
    min-width: 0;
}

.cs-reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.cs-reply-label {
    color: #0084ff;
    font-weight: 600;
}

.cs-reply-sender {
    color: #666;
    font-weight: 500;
}

.cs-reply-time {
    color: #999;
    font-size: 12px;
}

.cs-reply-message {
    color: #555;
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cs-reply-cancel {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cs-reply-cancel:hover {
    background: #e9ecef;
    color: #666;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 右键菜单 ===== */
.cs-context-menu {
    position: absolute;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 10000;
    min-width: 160px;
    animation: contextMenuShow 0.2s ease;
    pointer-events: auto;
}

@keyframes contextMenuShow {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cs-context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #333;
}

.cs-context-menu-item:hover {
    background: #f5f5f5;
}

.cs-context-menu-item svg {
    flex-shrink: 0;
}

.cs-context-menu-item.cs-menu-danger {
    color: #f44336;
}

.cs-context-menu-item.cs-menu-danger:hover {
    background: #ffebee;
}

.cs-context-menu-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 6px 0;
}

/* ===== 批量操作工具栏 ===== */
.cs-batch-toolbar {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #FF5722 100%);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    animation: slideDownFast 0.3s ease;
}

@keyframes slideDownFast {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cs-batch-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
    font-size: 14px;
}

.cs-batch-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.cs-batch-select-all input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.cs-batch-count {
    font-weight: 500;
}

.cs-batch-count span {
    font-weight: 700;
    font-size: 16px;
}

.cs-batch-actions {
    display: flex;
    gap: 8px;
}

.cs-batch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.cs-batch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.cs-batch-btn.cs-batch-delete {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.3);
}

.cs-batch-btn.cs-batch-delete:hover {
    background: rgba(244, 67, 54, 0.4);
}

/* 批量模式下的消息样式 */
.cs-batch-mode .cs-message-modern {
    padding-left: 40px;
    position: relative;
}

.cs-batch-mode .cs-message-modern::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: white;
    cursor: pointer;
}

.cs-batch-mode .cs-message-modern.selected::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.cs-batch-mode .cs-message-modern.selected::after {
    content: '✓';
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* ===== 确认对话框 ===== */
.cs-confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.cs-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.cs-confirm-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 24px 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.cs-confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.cs-confirm-icon svg {
    color: #FF9800;
    animation: pulse 2s ease-in-out infinite;
}

.cs-confirm-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.cs-confirm-message {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}

.cs-confirm-buttons {
    display: flex;
    gap: 12px;
}

.cs-confirm-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cs-confirm-cancel {
    background: #f5f5f5;
    color: #666;
}

.cs-confirm-cancel:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.cs-confirm-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cs-confirm-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===== Toast 提示 ===== */
.cs-toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.cs-toast {
    background: rgba(40, 40, 40, 0.98);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    animation: toastSlideIn 0.2s ease-out;
    pointer-events: auto;
    max-width: 400px;
    word-wrap: break-word;
}

.cs-toast.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.cs-toast.success {
    background: linear-gradient(135deg, #0f766e 0%, #388e3c 100%);
}

.cs-toast.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.cs-toast.info {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.cs-toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* ===== 新消息提示按钮 - 🚀 优化（默认；微信皮肤下见 .cs-chat-main-column 内定位） ===== */
.cs-new-message-tip {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 40, 40, 0.98);
    color: #4ade80;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: slideUpFade 0.2s ease-out;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
}

.cs-new-message-tip:hover {
    background: rgba(50, 50, 50, 0.98);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.cs-new-message-tip svg {
    color: #4ade80;
    animation: bounce 1s ease infinite;
}

.cs-new-message-count {
    color: #4ade80;
    white-space: nowrap;
}

/* 仅因向上翻历史出现的「回到最新消息」，箭头不必跳动 */
.cs-new-message-tip.cs-scroll-to-bottom-only svg {
    animation: none;
}

/* 按钮在消息列内：贴在列表底部、输入框上方，不压到输入区 */
.cs-chat-main-column .cs-new-message-tip {
    bottom: 10px;
    z-index: 6;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* ===== 放大状态样式 ===== */
.chat-expanded {
    /* 放大状态由JavaScript动态设置宽度 */
}

/* ===== 调整大小控制点 ===== */
.resize-handle {
    position: absolute;
    z-index: 10;
}

.resize-n, .resize-s {
    width: 100%;
    height: 6px;
    cursor: ns-resize;
}

.resize-w, .resize-e {
    width: 6px;
    height: 100%;
    cursor: ew-resize;
}

.resize-n { top: 0; left: 0; }
.resize-s { bottom: 0; left: 0; }
.resize-w { top: 0; left: 0; }
.resize-e { top: 0; right: 0; }

.resize-nw, .resize-ne, .resize-sw, .resize-se {
    width: 20px;
    height: 20px;
}

.resize-nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.resize-ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.resize-sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.resize-se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.resize-handle:hover::after {
    content: '';
    position: absolute;
    background: rgba(255, 87, 34, 0.4);
}

.resize-n:hover::after,
.resize-s:hover::after {
    width: 100%;
    height: 3px;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.resize-w:hover::after,
.resize-e:hover::after {
    width: 3px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.resize-nw:hover::after,
.resize-ne:hover::after,
.resize-sw:hover::after,
.resize-se:hover::after {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===== 暗黑模式适配 ===== */
body.dark-mode .cs-reply-preview {
    background: #2a2d3a;
    border-left-color: #0084ff;
}

body.dark-mode .cs-context-menu {
    background: #2a2d3a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cs-context-menu-item {
    color: #e0e0e0;
}

body.dark-mode .cs-context-menu-item:hover {
    background: #252836;
}

body.dark-mode .cs-confirm-content {
    background: #2a2d3a;
}

body.dark-mode .cs-confirm-title {
    color: #e0e0e0;
}

body.dark-mode .cs-confirm-message {
    color: #b0b0b0;
}

body.dark-mode .cs-confirm-cancel {
    background: #1f222e;
    color: #b0b0b0;
}

body.dark-mode .cs-confirm-cancel:hover {
    background: #252836;
}

/* ========================================
   隐藏右边的调整大小控制点
   - 隐藏右边边框 (resize-e)
   - 隐藏右上角 (resize-ne)
   - 隐藏右下角 (resize-se)
   ======================================== */
.resize-e,
.resize-ne,
.resize-se {
    display: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .cs-chat-main-column .cs-new-message-tip {
        bottom: 8px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 16px;
    }
    
    .resize-handle {
        display: none;
    }
}

/* ========================================
   文件和媒体消息样式 - 2025-12-22
   包含：文件、图片、视频、音频等消息类型
   ======================================== */

/* ===== 文件消息容器 ===== */
.cs-file-message {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.cs-file-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cs-file-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

.cs-file-message:hover::before {
    opacity: 1;
}

.cs-file-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    font-weight: 600;
    color: white;
    position: relative;
    overflow: hidden;
}

.cs-file-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    /* 🚀 优化：加快动画 0.6s → 0.3s */
    transition: transform 0.3s;
}

.cs-file-message:hover .cs-file-icon::before {
    transform: translateX(100%) translateY(100%);
}

/* 不同文件类型的图标颜色 */
.cs-file-icon.doc,
.cs-file-icon.docx {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.cs-file-icon.pdf {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.cs-file-icon.xls,
.cs-file-icon.xlsx {
    background: linear-gradient(135deg, #0f766e 0%, #388e3c 100%);
}

.cs-file-icon.zip,
.cs-file-icon.rar,
.cs-file-icon.7z {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.cs-file-icon.txt {
    background: linear-gradient(135deg, #9e9e9e 0%, #616161 100%);
}

.cs-file-icon.ppt,
.cs-file-icon.pptx {
    background: linear-gradient(135deg, #ff5722 0%, #d84315 100%);
}

.cs-file-icon.default {
    background: linear-gradient(135deg, #607d8b 0%, #455a64 100%);
}

.cs-file-info {
    flex: 1;
    min-width: 0;
}

.cs-file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.cs-file-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #999;
}

.cs-file-size {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cs-file-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cs-file-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cs-file-message:hover .cs-file-actions {
    opacity: 1;
}

.cs-file-action-btn {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #666;
}

.cs-file-action-btn:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
    transform: scale(1.1);
}

/* ===== 图片消息 ===== */
.cs-image-message {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    max-width: 300px;
    background: #f0f0f0;
    transition: all 0.3s ease;
}

.cs-image-message img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.cs-image-message:hover img {
    transform: scale(1.05);
}

.cs-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 12px;
}

.cs-image-message:hover .cs-image-overlay {
    opacity: 1;
}

.cs-image-info {
    color: white;
    font-size: 12px;
}

.cs-image-actions {
    display: flex;
    gap: 8px;
}

.cs-image-action-btn {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, transform 0.15s;
    color: white;
}

.cs-image-action-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* ===== 视频消息 ===== */
.cs-video-message {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    max-width: 360px;
    background: #000;
}

.cs-video-message video {
    display: block;
    width: 100%;
    height: auto;
}

.cs-video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.cs-video-play-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: white;
}

.cs-video-play-button svg {
    color: #667eea;
    margin-left: 4px;
}

.cs-video-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== 音频消息 ===== */
.cs-audio-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cs-audio-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    /* 🚀 优化：改用 transform 代替 left，加快动画 */
    transition: transform 0.3s;
}

.cs-audio-message:hover::before {
    left: 100%;
}

.cs-audio-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.cs-audio-play-btn {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.cs-audio-play-btn:hover {
    transform: scale(1.1);
}

.cs-audio-play-btn svg {
    color: #667eea;
}

.cs-audio-info {
    flex: 1;
    min-width: 0;
}

.cs-audio-duration {
    color: white;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.cs-audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.cs-audio-bar {
    width: 3px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.cs-audio-message:hover .cs-audio-bar {
    background: white;
}

.cs-audio-bar:nth-child(1) { height: 30%; }
.cs-audio-bar:nth-child(2) { height: 60%; }
.cs-audio-bar:nth-child(3) { height: 40%; }
.cs-audio-bar:nth-child(4) { height: 80%; }
.cs-audio-bar:nth-child(5) { height: 50%; }
.cs-audio-bar:nth-child(6) { height: 70%; }
.cs-audio-bar:nth-child(7) { height: 35%; }
.cs-audio-bar:nth-child(8) { height: 65%; }
.cs-audio-bar:nth-child(9) { height: 45%; }
.cs-audio-bar:nth-child(10) { height: 75%; }

/* ===== 位置消息 ===== */
.cs-location-message {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    max-width: 300px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.cs-location-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

.cs-location-map {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-location-map svg {
    color: white;
    opacity: 0.8;
}

.cs-location-info {
    padding: 14px;
}

.cs-location-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.cs-location-address {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ===== 暗黑模式适配 ===== */
body.dark-mode .cs-file-message {
    background: linear-gradient(135deg, #2a2d3a 0%, #1f222e 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .cs-file-name {
    color: #e0e0e0;
}

body.dark-mode .cs-file-meta {
    color: #888;
}

body.dark-mode .cs-file-action-btn {
    background: #1f222e;
    border-color: rgba(255, 255, 255, 0.1);
    color: #b0b0b0;
}

body.dark-mode .cs-file-action-btn:hover {
    background: #252836;
    border-color: #667eea;
    color: #667eea;
}

body.dark-mode .cs-location-message {
    background: #2a2d3a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .cs-location-title {
    color: #e0e0e0;
}

body.dark-mode .cs-location-address {
    color: #b0b0b0;
}

/* ===== 文件上传进度 ===== */
.cs-file-uploading {
    opacity: 0.7;
    pointer-events: none;
}

.cs-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.cs-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    /* 🚀 优化：加快动画 0.3s → 0.15s */
    transition: width 0.15s ease;
    position: relative;
    overflow: hidden;
}

.cs-upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 移动端文件消息适配 */
@media (max-width: 768px) {
    .cs-file-message {
        max-width: 100%;
    }
    
    .cs-file-actions {
        opacity: 1;
    }
    
    .cs-image-message {
        max-width: 100%;
    }
    
    .cs-video-message {
        max-width: 100%;
    }
    
    .cs-audio-message {
        max-width: 100%;
    }
    
    .cs-location-message {
        max-width: 100%;
    }
}

/* ========================================
   波形音频播放器完整样式 - 2025-12-22
   补充所有缺失的波形播放器样式
   ======================================== */

/* 音频播放器美化 */
audio {
    filter: saturate(0.8);
}
audio::-webkit-media-controls-panel {
    background: rgba(255, 255, 255, 0.9);
}

/* 波形附件容器 - 与上下文卡片样式一致 */
.cs-waveform-attachment {
    /* 🎯 统一宽度与上下文卡片样式一致（PC端280px，移动端100%） */
    width: 280px;
    max-width: 100%;
    border-radius: 12px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 同一条消息内多个附件：用相邻兄弟选择器拉开间距（避免 :last-child 在末尾有注释/空白时失效） */
.cs-message-bubble-modern .cs-waveform-attachment + .cs-waveform-attachment,
.cs-message-bubble-modern .cs-waveform-attachment + .cs-image-attachment,
.cs-message-bubble-modern .cs-waveform-attachment + .cs-attachment-container,
.cs-message-bubble-modern .cs-image-attachment + .cs-waveform-attachment,
.cs-message-bubble-modern .cs-image-attachment + .cs-image-attachment,
.cs-message-bubble-modern .cs-image-attachment + .cs-attachment-container,
.cs-message-bubble-modern .cs-attachment-container + .cs-waveform-attachment,
.cs-message-bubble-modern .cs-attachment-container + .cs-image-attachment,
.cs-message-bubble-modern .cs-attachment-container + .cs-attachment-container {
    margin-top: 18px;
}

/* 文字或引用块与下方第一个附件 */
.cs-message-bubble-modern .cs-message-content + .cs-waveform-attachment,
.cs-message-bubble-modern .cs-message-content + .cs-image-attachment,
.cs-message-bubble-modern .cs-message-content + .cs-attachment-container,
.cs-message-bubble-modern .cs-message-reply-quote + .cs-waveform-attachment,
.cs-message-bubble-modern .cs-message-reply-quote + .cs-image-attachment,
.cs-message-bubble-modern .cs-message-reply-quote + .cs-attachment-container {
    margin-top: 14px;
}

/* 第一行：文件名 + 文件大小 */
.cs-audio-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5; /* 确保所有子元素有合适的行高 */
}

.cs-audio-header .cs-audio-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.cs-audio-header .cs-audio-name {
    flex: 1;
    min-width: 0; /* 修复flex子元素文本溢出问题 */
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5; /* 修复高度为0的问题 */
    min-height: 18px; /* 确保至少有18px高度 */
}

.cs-audio-header .cs-audio-size {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}

/* 用户消息的音频头部样式 */
.cs-message-modern.user .cs-audio-header .cs-audio-name {
    color: #333;
}

.cs-message-modern.user .cs-audio-header .cs-audio-size {
    color: #666;
}

/* 第二行：播放器 + 下载按钮 */
.cs-audio-player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    
}

/* 播放按钮容器 */
.cs-wave-controls {
    flex-shrink: 0;
}

/* 播放按钮（圆形空心，跟随后台配置） */
.cs-wave-play-btn {
    width: var(--button-size, 32px);  /* 跟随后台配置 */
    height: var(--button-size, 32px);  /* 跟随后台配置 */
    border-radius: 50%;
    background: var(--button-pause-bg-color, transparent);  /* 暂停时背景色，跟随后台配置 */
    border-width: var(--button-border-width, 1.5px);  /* 跟随后台配置 */
    border-style: solid;
    border-color: var(--button-border-color, #333);  /* 跟随后台配置 */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.cs-wave-play-btn:hover {
    background: var(--button-hover-color, #ff9800);  /* 跟随后台配置 */
    border-color: var(--button-hover-color, #ff9800);  /* 跟随后台配置 */
}

/* 播放图标 - 跟随后台配置 */
.cs-wave-play-btn .play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent var(--button-play-icon-color, #000000);  /* 跟随后台配置 */
    margin-left: 2px;
    transition: border-color 0.2s ease;
}

.cs-wave-play-btn:hover .play-icon {
    border-left-color: var(--button-pause-icon-color, #fff);  /* 跟随后台配置 */
}

/* 播放中状态 - 背景色和边框色分别跟随配置 */
.cs-wave-play-btn.playing {
    background: var(--button-playing-bg-color, #ff9800);
    border-color: var(--button-playing-color, #ff9800);
}

/* 暂停图标 */
.cs-wave-play-btn.playing .play-icon {
    width: 10px;
    height: 12px;
    border: none;
    margin-left: 0;
    position: relative;
}

.cs-wave-play-btn.playing .play-icon::before,
.cs-wave-play-btn.playing .play-icon::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 100%;
    /* 暂停条与播放中边框色一致，跟随后台 --button-playing-color */
    background-color: var(--button-playing-color, var(--button-pause-icon-color, #ff9800));
    top: 0;
}

.cs-wave-play-btn.playing .play-icon::before {
    left: 0;
}

.cs-wave-play-btn.playing .play-icon::after {
    right: 0;
}

/* 用户消息的播放按钮 - 已移除硬编码，统一跟随后台配置 */
/* 所有播放按钮（客服消息和用户消息）都使用相同的配置 */

/* 波形容器 */
.cs-waveform-container {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: visible; /* 允许时间显示溢出 */
}

/* 波形图 */
.cs-waveform {
    width: 100%;
    height: 40px;
    position: relative;
    cursor: pointer;
    transition: opacity 0.2s ease;
    overflow: visible; /* 允许时间显示溢出 */
}

.cs-waveform:hover {
    opacity: 0.8;
}

/* 波形canvas样式 */
.cs-waveform canvas {
    display: block;
}

/* ========== 彻底隐藏波形播放器滚动条 ========== */
/* 隐藏 WaveSurfer 所有内部容器的滚动条（强力版） */
.cs-waveform,
.cs-waveform *,
.cs-waveform > div,
.cs-waveform > div > *,
.cs-waveform wave,
/* 隐藏WaveSurfer内部的滚动条，但不影响时间显示 */
.cs-waveform-container > div:not(.cs-wave-current-time) {
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* 针对 WebKit 浏览器（Chrome, Safari, Edge）彻底隐藏滚动条 */
.cs-waveform::-webkit-scrollbar,
.cs-waveform *::-webkit-scrollbar,
.cs-waveform > div::-webkit-scrollbar,
.cs-waveform > div > *::-webkit-scrollbar,
.cs-waveform-container::-webkit-scrollbar,
.cs-waveform-container *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

/* 针对 Firefox 彻底隐藏滚动条，但不影响时间显示 */
.cs-waveform > div:not(.cs-wave-current-time),
.cs-waveform > div:not(.cs-wave-current-time) > *,
.cs-waveform-container > div:not(.cs-wave-current-time) {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 针对 WaveSurfer 的特定类名 */
div[class*="wavesurfer"],
div[class*="wavesurfer"] * {
    overflow: hidden;
    scrollbar-width: none;
}

div[class*="wavesurfer"]::-webkit-scrollbar,
div[class*="wavesurfer"] *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* 浮动时间指针（首页风格） */
.cs-wave-time-pointer {
    position: absolute;
    top: 100%;
    margin-left: -20px;
    background-color: #372248;
    color: white;
    padding: 9px 6px;
    border-radius: 3px;
    font-size: 11px;
    display: none;  /* 强制隐藏，使用中间的时间显示代替 */
    z-index: 20;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 用户消息的时间指针（浅色背景） */
.cs-message-modern.user .cs-wave-time-pointer {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
}

/* 当前播放时间显示（跟随指针移动，垂直居中） - 跟随后台播放器配置 */
.cs-wave-current-time {
    position: absolute;
    top: 50%;  /* 垂直居中 */
    /* 时间在指针线左侧，距离跟随后台配置 */
    transform: translate(calc(-100% - var(--pointer-time-distance, 5px)), -50%);
    font-size: var(--pointer-font-size, 11px);  /* 跟随后台配置 */
    color: var(--pointer-text-color, #ffffff);  /* 跟随后台配置 */
    background-color: var(--pointer-bg-color, #223e48);  /* 跟随后台配置 */
    padding: var(--pointer-padding, 3px 7px);  /* 跟随后台配置 */
    border-radius: var(--pointer-border-radius, 4px);  /* 跟随后台配置 */
    min-width: auto;  /* 自适应宽度 */
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    display: none;  /* 默认隐藏 */
    z-index: 10;  /* 降低z-index，避免遮挡 */
    pointer-events: none;  /* 强制不阻挡点击 */
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    line-height: 1.3;  /* 增加行高 */
}

/* 下载按钮 - 简洁无边框样式 */
.cs-wave-download-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: transparent;
    border: none;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cs-wave-download-btn svg {
    width: 18px;
    height: 18px;
    color: #666;
    transition: all 0.2s ease;
}

.cs-wave-download-btn:hover {
    background: rgba(76, 175, 80, 0.1);
}

.cs-wave-download-btn:hover svg {
    color: #0f766e;
    transform: scale(1.1);
}

.cs-message-modern.user .cs-wave-download-btn svg {
    color: #555;
}

.cs-message-modern.user .cs-wave-download-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.cs-message-modern.user .cs-wave-download-btn:hover svg {
    color: #333;
}

/* ========== 波形悬停时间提示 ========== */
.waveform-hover-time-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    display: none;
    white-space: nowrap;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 8px;
    padding: 4px 2px; /* 上下4px 左右2px */
    background-color: rgb(34, 62, 72);
    color: rgb(255, 255, 255);
    font-size: 12px;
    border-radius: 4px;
}

/* ========================================
   消息回复引用样式 - 2025-12-22
   消息中显示的被回复内容
   ======================================== */

/* 消息高亮动画 */
@keyframes messageHighlight {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(0, 132, 255, 0.1);
    }
}

/* 消息中的回复引用样式 */
.cs-message-reply-quote {
    background: #f0f2f5;
    border-left: 3px solid #0084ff;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.cs-message-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
}

.cs-message-reply-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.cs-message-reply-sender {
    color: #000000;
    font-weight: 600;
    font-size: 12px;
}

.cs-message-reply-time {
    color: #333333;
    font-size: var(--pointer-font-size, 11px);  /* 跟随播放器时间指针字体大小 */
}

.cs-message-reply-jump {
    background: none;
    border: none;
    color: #0D47A1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cs-message-reply-jump:hover {
    background: #e3f2ff;
}

.cs-message-reply-content {
    color: #000000;
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 引用区中包含卡片时，取消行数限制并调整显示 */
.cs-message-reply-content:has(.cs-context-card),
.cs-message-reply-content:has(.cs-inline-card) {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
    overflow: visible; /* 允许卡片完整显示 */
}

/* 引用区整体也需要足够空间显示卡片 */
.cs-message-reply-quote:has(.cs-context-card),
.cs-message-reply-quote:has(.cs-inline-card) {
    overflow: visible;
}

/* 引用区中的上下文卡片样式 - 紧凑显示 */
.cs-message-reply-content .cs-context-card {
    max-width: 100%;
    margin: 4px 0 8px 0; /* 底部留出更多空间 */
    transform: scale(0.9);
    transform-origin: left top;
    /* pointer-events: none; 移除，允许链接点击 */
    opacity: 0.85; /* 半透明效果，表示是引用 */
}

/* 引用区中的链接和头像可点击 */
.cs-message-reply-content .cs-inline-card-avatar-link,
.cs-message-reply-content .cs-inline-card-title-link,
.cs-message-reply-content .cs-context-avatar-link,
.cs-message-reply-content .cs-context-name-link,
.cs-message-reply-content a[href]:not(.cs-wave-download-btn),
.cs-message-reply-quote .cs-inline-card-avatar-link,
.cs-message-reply-quote .cs-inline-card-title-link,
.cs-message-reply-quote .cs-context-avatar-link,
.cs-message-reply-quote .cs-context-name-link,
.cs-message-reply-quote a[href]:not(.cs-wave-download-btn) {
    pointer-events: auto;
    cursor: pointer;
}

/* 引用区链接悬停效果 */
.cs-message-reply-content .cs-inline-card-avatar-link:hover img,
.cs-message-reply-content .cs-context-avatar-link:hover img,
.cs-message-reply-quote .cs-inline-card-avatar-link:hover img,
.cs-message-reply-quote .cs-context-avatar-link:hover img {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s;
}

.cs-message-reply-content .cs-inline-card-title-link:hover,
.cs-message-reply-content .cs-context-name-link:hover,
.cs-message-reply-quote .cs-inline-card-title-link:hover,
.cs-message-reply-quote .cs-context-name-link:hover {
    color: #0f766e;
    transition: color 0.2s;
}

/* 注意：.cs-inline-card 的样式已移至 card_actions.css 中统一管理 */

/* 引用区卡片内部元素确保不被裁剪 */
.cs-message-reply-content .cs-context-card .cs-card-body,
.cs-message-reply-content .cs-inline-card .cs-card-body {
    overflow: visible;
}

/* ========================================
   引用区中隐藏播放器 - 完全隐藏所有音频相关元素
   ======================================== */

/* 主要隐藏规则 - 引用区域中的所有音频播放器和波形 */
.cs-message-reply-content .cs-audio-player-row,
.cs-message-reply-content .cs-waveform-attachment,
.cs-message-reply-content .cs-waveform-container,
.cs-message-reply-content .cs-waveform,
.cs-message-reply-content .cs-wave-controls,
.cs-message-reply-content .cs-wave-play-btn,
.cs-message-reply-content .cs-context-body,
.cs-message-reply-content audio,
.cs-message-reply-quote .cs-audio-player-row,
.cs-message-reply-quote .cs-waveform-attachment,
.cs-message-reply-quote .cs-waveform-container,
.cs-message-reply-quote .cs-waveform,
.cs-message-reply-quote .cs-wave-controls,
.cs-message-reply-quote .cs-wave-play-btn,
.cs-message-reply-quote .cs-context-body,
.cs-message-reply-quote audio {
    display: none;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
    margin: 0;
}

/* 引用区卡片的按钮和链接隐藏 */
.cs-message-reply-content .cs-card-actions,
.cs-message-reply-content .cs-wave-download-btn,
.cs-message-reply-content .cs-inline-card-actions,
.cs-message-reply-quote .cs-card-actions,
.cs-message-reply-quote .cs-wave-download-btn,
.cs-message-reply-quote .cs-inline-card-actions {
    display: none;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* ========================================
   消息气泡小三角形箭头 - 2025-12-22
   指向头像的小箭头样式
   ======================================== */

/* 消息气泡响应式补充 */
.cs-message-bubble-modern {
    box-sizing: border-box;
    width: auto;
    min-width: 60px;
    display: inline-block;
}

/* 客服气泡三角 - 纯白色实心三角 */
.cs-message-bubble-modern.bubble-agent::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid #ffffff;
    border-left: 0;
    display: block;
}

.cs-message-bubble-modern.bubble-agent::after {
    display: none;
}

/* 用户气泡三角 - 蓝色实心三角 */
.cs-message-bubble-modern.bubble-user::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 8px solid #1a6dd4;
    border-right: 0;
    display: block;
}

/* 确保消息容器占满宽度并使用flex布局 */
.cs-message-modern {
    width: 100%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

/* 客服消息左对齐 */
.cs-message-modern.agent {
    flex-direction: row;
    justify-content: flex-start;
}

/* 用户消息右对齐 */
.cs-message-modern.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* 头像与时间标签顶端对齐 */
.cs-message-modern.agent .cs-message-avatar-modern {
    margin: 4px 10px 0 0;
    align-self: flex-start;
}

.cs-message-modern.user .cs-message-avatar-modern {
    margin: 4px 0 0 10px;
    align-self: flex-start;
}

/* 音频播放器和附件自适应 */
.cs-message-bubble-modern audio,
.cs-message-bubble-modern img {
    max-width: 100%;
    box-sizing: border-box;
}

/* ========================================
   动画效果集合 - 2025-12-22
   各种过渡和动画效果
   ======================================== */

/* 消息气泡滑入动画 */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 拖放提示层动画 */
#cs-drag-overlay {
    animation: dragOverlayFadeIn 0.2s ease;
}

@keyframes dragOverlayFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 拖放图标脉冲动画 */
#cs-drag-overlay svg {
    animation: dragIconPulse 1.5s ease-in-out infinite;
}

@keyframes dragIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 文件预览淡入缩放动画 */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 聊天窗口动画由 JavaScript 控制 (animateChatWindow 函数) */
/* 🎬 动画进行中的状态 - 允许 JS 控制 transform */
#cs-chat-window-modern.chat-animating {
    transform: none;
}

/* 发送按钮激活态 */
#cs-message-input-modern:focus ~ button,
#cs-message-input-modern:not(:placeholder-shown) ~ button {
    box-shadow: 0 4px 16px rgba(30, 136, 229, 0.35);
}

/* ========================================
   批量模式下的消息复选框 - 2025-12-22
   补充完整的批量选择样式
   ======================================== */

/* 批量模式下的消息样式 */
.cs-batch-mode .cs-message-modern {
    padding-left: 40px;
    position: relative;
}

.cs-batch-mode .cs-message-modern::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    z-index: 10;
}

.cs-batch-mode .cs-message-modern.selected::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.cs-batch-mode .cs-message-modern.selected::after {
    content: '✓';
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    z-index: 11;
}

/* ========================================
   移动端和响应式优化 - 2025-12-22
   ======================================== */

/* 移动端或小窗口时增加气泡最大宽度占比 */
@media (max-width: 768px) {
    .cs-message-bubble-modern {
        width: auto;
        max-width: 85%;
    }
    
    /* 包含卡片的消息气泡 - 允许更宽以容纳卡片 */
    .cs-message-bubble-modern:has(.cs-inline-card),
    .cs-message-bubble-modern:has(.cs-context-card) {
        max-width: 90%;
        width: 90%;
    }
    
    /* 确保卡片不超出气泡 */
    .cs-message-bubble-modern .cs-inline-card,
    .cs-message-bubble-modern .cs-context-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 400px) {
    .cs-message-bubble-modern {
        width: auto;
        max-width: 88%;
    }
    
    /* 包含卡片的消息气泡 - 允许更宽 */
    .cs-message-bubble-modern:has(.cs-inline-card),
    .cs-message-bubble-modern:has(.cs-context-card) {
        max-width: 92%;
        width: 92%;
    }
}

/* 移动端波形播放器优化 */
@media (max-width: 768px) {
    .cs-waveform-attachment {
        width: 100%;
        max-width: 100%;
         
        border-radius: 10px;
    }
    
    .cs-audio-header {
        font-size: 12px;
    }
    
    .cs-wave-play-btn {
        width: 36px;
        height: 36px;
    }
    
    .cs-wave-download-btn {
        width: 24px;
        height: 24px;
        padding: 2px;
    }
    
    .cs-waveform {
        height: 36px;
    }
    
    .cs-wave-time-pointer {
        font-size: 10px;
        padding: 2px 4px;
        margin-top: 4px;
    }
}

/* ========================================
   聊天窗口状态类 - 2025-12-22
   ======================================== */

/* 居中状态 */
/* 拖动后状态 - 已在上面定义 */

/* 拖动中 */
.dragging {
    cursor: move;
    user-select: none;
}

/* 调整大小中 */
.resizing {
    user-select: none;
}

/* ========================================
   暗黑模式补充 - 2025-12-22
   ======================================== */

body.dark-mode .cs-message-reply-quote {
    background: #2a2d3a;
    border-left-color: #0084ff;
}

body.dark-mode .cs-message-reply-content {
    color: #b0b0b0;
}

/* 暗黑模式下的播放按钮 - 已移除所有硬编码，完全跟随后台配置 */

/* ========================================
   客服按钮样式和动画
   从 customer-chat.css 整合而来
   ======================================== */

/* 微信客服相关样式已删除 */

/* ========================================
   移动端客服按钮位置适配
   从 customer-chat.css 整合而来
   ======================================== */

/* 全屏遮罩：仅纯色半透明，不用 backdrop-filter，避免背后发糊、发晕 */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9997;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.38);
}

@media (max-width: 768px) {
    /* 在线客服按钮 - 移动端位置已移至 footer-buttons.css 统一管理 */
    /*
    #floating-customer-service {
        bottom: 155px;
        right: 8px;
    }
    
    #btn-chat {
        width: 48px;
        height: 48px;
        opacity: 0.92;
    }
    
    #btn-chat span {
        font-size: 16px;
    }
    */
    
    /* 微信客服按钮样式已删除 */
    
    /* 在线客服聊天窗口 - 移动端全屏显示 */
    /* 注意：这里的样式会被上面的 @media (max-width: 768px) 覆盖 */
    /* 如果需要居中弹窗而非全屏，取消注释以下代码 */
    /*
    #cs-chat-window-modern {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 95%;
        max-width: 400px;
        height: auto;
        max-height: 85vh;
        z-index: 10000;
    }
    */
    
    /* 防止输入时屏幕放大 */
    #cs-message-input-modern {
        font-size: 16px;
    }
    
    /* 🔧 移动端消息区域滚动优化 - 关键修复 */
    #cs-messages-modern {
        /* 🔧 确保消息区域可正常滚动 */
        flex: 1 1 0;
        min-height: 0; /* 关键：允许flex子项收缩 */
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        /* 🔧 减小内边距，给更多空间 */
        padding: 12px 12px;
        /* 🔧 确保滚动容器隔离 */
        isolation: isolate;
        /* 🔧 硬件加速 */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* 🔧 移动端头部不收缩 */
    #cs-chat-header-modern {
        flex-shrink: 0;
    }
    
    /* 🔧 虚拟键盘弹出时的适配 */
    #cs-chat-window-modern.keyboard-open {
        height: auto;
        max-height: 100%;
    }
    
    #cs-chat-window-modern.keyboard-open #cs-messages-modern {
        /* 键盘弹出时减少消息区域高度 */
        flex: 1 1 auto;
    }
    
    /* 🔧 防止iOS Safari地址栏收起时的布局跳动 */
    #cs-chat-window-modern {
        /* 使用 min-height 而不是 height 避免问题 */
        min-height: -webkit-fill-available;
    }
}

/* ========================================
   🔧 移动端聊天窗口打开时禁止页面滚动
   ======================================== */
body.chat-open-mobile {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    /* 🔧 防止iOS Safari的橡皮筋效果 */
    overscroll-behavior: none;
}

/* 🔧 移动端客服窗口打开时隐藏底部导航和其他固定元素 */
body.chat-open-mobile .mobile-nav,
body.chat-open-mobile .bottom-nav,
body.chat-open-mobile .page-nav,
body.chat-open-mobile .footer-nav,
body.chat-open-mobile #floating-buttons-container,
body.chat-open-mobile .floating-buttons,
body.chat-open-mobile [class*="bottom-bar"],
body.chat-open-mobile [class*="nav-bar"]:not(#cs-chat-window-modern *) {
    display: none;
    visibility: hidden;
}

/* 🔧 iOS Safari 特殊处理 */
@supports (-webkit-touch-callout: none) {
    /* iOS only */
    body.chat-open-mobile {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    /* iOS Safari 的消息滚动区域 */
    #cs-chat-window-modern #cs-messages-modern {
        /* 🔧 iOS滚动修复 */
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }
}

/* ========================================
   🌙 在线客服暗黑模式
   ======================================== */

/* 聊天窗口主体 */
body.dark-mode #cs-chat-window-modern {
    background: #1a1c28;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 2px 6px rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 24px 48px rgba(0, 0, 0, 0.3);
}

/* 聊天内容区域 */
body.dark-mode #cs-chat-content-modern {
    background: #1a1c28;
}

/* 客服消息气泡 */
body.dark-mode .cs-message-bubble-modern.bubble-agent {
    background: #2a2d3a;
    color: #e0e0e0;
}

body.dark-mode .bubble-agent .cs-message-header {
    color: #b0b0b0;
}

body.dark-mode .bubble-agent .cs-message-text {
    color: #e0e0e0;
}

/* 用户消息气泡 */
body.dark-mode .cs-message-bubble-modern.bubble-user {
    background: #3a4a5a00;
    color: #e0e0e0;
}

body.dark-mode .bubble-user .cs-message-header {
    color: #b0b0b0;
}

body.dark-mode .bubble-user .cs-message-text {
    color: #e0e0e0;
}

/* 输入区域 */
body.dark-mode #cs-input-area-modern {
    background: #1a1c28;
    border-top-color: #333;
}

body.dark-mode #cs-message-input-modern {
    background: #2a2d3a;
    color: #e0e0e0;
    border-color: #444;
    caret-color: #64b5f6;
}

body.dark-mode #cs-message-input-modern::placeholder {
    color: #888;
}

/* 发送按钮 */
body.dark-mode .chat-send-btn,
body.dark-mode #cs-send-btn-modern {
    background: linear-gradient(135deg, #1E88E5 0%, #1565C0 100%);
    color: #fff;
}

body.dark-mode .chat-send-btn:hover,
body.dark-mode #cs-send-btn-modern:hover {
    box-shadow: 0 4px 16px rgba(30, 136, 229, 0.4);
}

/* 头部区域：暗黑混合渐变（与微信皮肤客服窗一致） */
body.dark-mode #cs-chat-header-modern {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(125deg, #070b14 0%, #0f172a 38%, #111827 100%);
    border-bottom: 1px solid rgba(56, 189, 248, 0.22);
    box-shadow:
        0 4px 28px rgba(6, 182, 212, 0.18),
        0 8px 32px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode #cs-chat-header-modern::before {
    display: block;
    inset: 0;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    transform: none;
    opacity: 1;
    border-radius: inherit;
    background:
        radial-gradient(ellipse 90% 140% at 8% 45%, rgba(6, 182, 212, 0.55) 0%, transparent 58%),
        radial-gradient(ellipse 75% 110% at 92% 18%, rgba(129, 140, 248, 0.48) 0%, transparent 52%),
        radial-gradient(ellipse 65% 95% at 55% 110%, rgba(20, 184, 166, 0.38) 0%, transparent 48%),
        linear-gradient(108deg,
            rgba(14, 165, 233, 0.32) 0%,
            rgba(59, 130, 246, 0.22) 28%,
            rgba(139, 92, 246, 0.28) 52%,
            rgba(6, 182, 212, 0.24) 78%,
            rgba(16, 185, 129, 0.16) 100%);
    mix-blend-mode: screen;
}

body.dark-mode #cs-chat-header-modern::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.02) 38%,
        rgba(0, 0, 0, 0.12) 100%);
}

body.dark-mode #cs-chat-header-modern > * {
    position: relative;
    z-index: 1;
}

/* 附件按钮 */
body.dark-mode .cs-attachment-btn {
    color: #888;
}

body.dark-mode .cs-attachment-btn:hover {
    color: #ff9800;
}

/* 时间分隔线 */
body.dark-mode .cs-time-divider {
    color: #ffffff;
}

body.dark-mode .cs-time-divider::before,
body.dark-mode .cs-time-divider::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

/* 消息时间 */
body.dark-mode .cs-message-time {
    color: #ffffff !important;
}

/* 表情选择器 */
body.dark-mode .cs-emoji-picker {
    background: #2a2d3a;
    border-color: #444;
}

/* 链接样式 */
body.dark-mode .cs-message-bubble-modern a {
    color: #64b5f6;
}

/* 聊天窗口内播放器：跟随后台 unified_player（已移除硬编码 #666 边框 / 白 SVG） */

body.dark-mode #cs-chat-window-modern .waveform-container,
body.dark-mode #cs-chat-content-modern .waveform-container {
    background-color: transparent;
}

body.dark-mode #cs-chat-window-modern .time-display,
body.dark-mode #cs-chat-content-modern .time-display {
    color: #b0b0b0;
}

/* 音频附件暗黑模式 */
body.dark-mode .bubble-agent .cs-audio-attachment {
    color: #b0b0b0;
}

body.dark-mode .bubble-user .cs-audio-attachment {
    color: #b0b0b0;
}

body.dark-mode .cs-audio-name {
    color: #e0e0e0;
}

body.dark-mode .cs-audio-size {
    color: #888;
}

/* 下载按钮暗黑模式 */
body.dark-mode #cs-chat-window-modern .download-btn,
body.dark-mode #cs-chat-content-modern .download-btn {
    color: #888;
}

body.dark-mode #cs-chat-window-modern .download-btn:hover,
body.dark-mode #cs-chat-content-modern .download-btn:hover {
    color: #ff9800;
}

/* 音频消息暗黑模式 */
body.dark-mode .cs-audio-message {
    background: linear-gradient(135deg, #3a3d4a 0%, #2a2d3a 100%);
}

body.dark-mode .cs-audio-play-btn {
    background: #444;
}

body.dark-mode .cs-audio-play-btn svg {
    color: #ff9800;
}

body.dark-mode .cs-audio-duration {
    color: #e0e0e0;
}

body.dark-mode .cs-audio-bar {
    background: rgba(255, 255, 255, 0.4);
}

body.dark-mode .cs-audio-message:hover .cs-audio-bar {
    background: rgba(255, 255, 255, 0.8);
}

/* 文件预览区域暗黑模式（输入条横向小卡片） */
body.dark-mode .cs-wx-inline-chip {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .cs-wx-inline-chip--file {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .cs-wx-inline-name {
    color: #e8eaed;
}

body.dark-mode .cs-wx-inline-size {
    color: #9aa0a6;
}

body.dark-mode .cs-file-preview-name {
    color: #e0e0e0;
}

body.dark-mode .cs-file-preview-size {
    color: #888;
}

body.dark-mode .cs-file-preview-close {
    background: #3a3d4a;
    color: #888;
}

body.dark-mode .cs-file-preview-close:hover {
    background: #4a4d5a;
    color: #e0e0e0;
}

/* 原生 audio 元素暗黑模式 */
body.dark-mode .cs-audio-player {
    filter: invert(1) hue-rotate(180deg);
}

body.dark-mode #cs-chat-window-modern audio,
body.dark-mode #cs-chat-content-modern audio {
    filter: invert(1) hue-rotate(180deg);
}

/* 音频下载链接 */
body.dark-mode .cs-audio-download a {
    color: #64b5f6;
}

/* ========================================
   ✨ 重设计补充样式 - 2026
   提升整体UI质感
   ======================================== */

/* 消息时间戳分隔线 */
.cs-time-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    color: #b0b8c8;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    user-select: none;
}

.cs-time-divider::before,
.cs-time-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d8dfe8, transparent);
}

/* 消息间距优化 */
.cs-message-modern {
    margin-bottom: 6px;
}

/* 用户消息文字颜色强制白色 */
.bubble-user .cs-message-header,
.bubble-user .cs-message-time,
.bubble-user .cs-message-content,
.bubble-user * {
    color: rgba(255, 255, 255, 0.92);
}

/* 回复引用块：浅底深字（必须覆盖上一段 .bubble-user *，否则白字叠在浅灰引用底上看不清） */
.bubble-user .cs-message-reply-quote {
    background: #f0f2f5 !important;
    border-left: 3px solid #0084ff !important;
}
.bubble-user .cs-message-reply-quote,
.bubble-user .cs-message-reply-quote * {
    color: #1f2937 !important;
}
.bubble-user .cs-message-reply-time,
.bubble-user .admin-message-reply-time {
    color: #6b7280 !important;
}
.bubble-user .cs-message-reply-sender,
.bubble-user .admin-message-reply-sender {
    color: #111827 !important;
}
.bubble-user .cs-message-reply-jump,
.bubble-user .admin-message-reply-jump {
    color: #0d47a1 !important;
}

/* 波形上当前时间标签：深底白字（覆盖 .bubble-user * 与后台异常指针配色） */
.bubble-user .cs-waveform-attachment .cs-wave-current-time,
.bubble-user .cs-wave-current-time {
    color: #ffffff !important;
    background-color: rgba(15, 23, 42, 0.92) !important;
}

/* 波形悬停时间提示 */
.waveform-hover-time-tooltip {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
}

/* 波形音频卡片 - 在用户消息内 */
.bubble-user .cs-waveform-attachment {
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 10px !important;
}

.bubble-user .cs-audio-name {
    color: rgba(255,255,255,0.92) !important;
}

.bubble-user .cs-audio-size {
    color: rgba(255,255,255,0.65) !important;
}

/* 内联卡片 - 通用美化 */
.cs-inline-card {
    border-radius: 14px !important;
    border: 1px solid #e8edf5 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 4px 24px rgba(0,0,0,0.03) !important;
    padding: 14px 16px !important;
    background: #ffffff !important;
    overflow: hidden !important;
}

.cs-inline-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.10), 0 8px 32px rgba(0,0,0,0.05) !important;
    border-color: #d0d8e8 !important;
}

/* 卡片标题 */
.cs-inline-card-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1a1d21 !important;
}

/* 卡片元信息标签（与 customer-service-context.css 一致：浅底+描边框住文字） */
.cs-context-meta-tag {
    display: inline-flex !important;
    align-items: center !important;
    background: #e8eff7 !important;
    border: 1px solid #b8c9dc !important;
    border-radius: 6px !important;
    color: #3d4d5f !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    padding: 3px 10px !important;
    line-height: 1.35 !important;
    box-sizing: border-box !important;
}

/* 发送到对话按钮 */
.cs-inline-card-link {
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 3px 10px rgba(26, 109, 212, 0.25) !important;
}

.cs-inline-card-link:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 5px 16px rgba(26, 109, 212, 0.35) !important;
    color: #ffffff !important;
}

/* 头部 ::before：压过文件内其它重复定义，保留混合渐变光晕 */
#cs-chat-header-modern::before {
    content: '';
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    transform: none;
    opacity: 1;
    border-radius: inherit;
    transition: none;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 90% 140% at 8% 45%, rgba(6, 182, 212, 0.55) 0%, transparent 58%),
        radial-gradient(ellipse 75% 110% at 92% 18%, rgba(129, 140, 248, 0.48) 0%, transparent 52%),
        radial-gradient(ellipse 65% 95% at 55% 110%, rgba(20, 184, 166, 0.38) 0%, transparent 48%),
        linear-gradient(108deg,
            rgba(14, 165, 233, 0.32) 0%,
            rgba(59, 130, 246, 0.22) 28%,
            rgba(139, 92, 246, 0.28) 52%,
            rgba(6, 182, 212, 0.24) 78%,
            rgba(16, 185, 129, 0.16) 100%);
    mix-blend-mode: screen;
}

#cs-chat-header-modern:hover::before {
    opacity: 1;
}

/* 文件预览区域美化（旧独立条；内嵌预览用 .cs-file-preview-inline 见上文） */
#cs-file-preview.show:not(.cs-file-preview-inline) {
    display: flex;
    background: #f0f5ff;
    border: 1.5px solid #c7d9f5;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
    animation: slideInDown 0.2s ease;
}

/* 空消息状态美化 */
.cs-empty-icon {
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%) !important;
    border-radius: 20px !important;
    box-shadow: 0 6px 20px rgba(26, 109, 212, 0.25) !important;
}

.cs-empty-title {
    color: #2a3142 !important;
    font-size: 17px !important;
}

.cs-empty-desc {
    color: #8a96a8 !important;
}

/* 消息区域滚动条美化 */
#cs-messages-modern::-webkit-scrollbar {
    width: 5px;
}

#cs-messages-modern::-webkit-scrollbar-track {
    background: transparent;
}

#cs-messages-modern::-webkit-scrollbar-thumb {
    background: rgba(26, 109, 212, 0.18);
    border-radius: 3px;
}

#cs-messages-modern::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 109, 212, 0.35);
}

/* 放大/缩小按钮图标颜色 */
.chat-expand-btn svg,
.chat-newtab-btn svg,
.chat-close-btn svg {
    color: rgba(255, 255, 255, 0.85);
}

/* 文件附件按钮 SVG */
.chat-file-btn svg {
    color: inherit;
    transition: color 0.2s;
}

/* 新消息提示按钮升级 */
.cs-new-message-tip {
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(26, 109, 212, 0.35) !important;
}

.cs-new-message-tip svg,
.cs-new-message-count {
    color: #ffffff !important;
}

.cs-new-message-tip:hover {
    background: linear-gradient(135deg, #2278e0 0%, #1565c8 100%) !important;
    box-shadow: 0 6px 22px rgba(26, 109, 212, 0.45) !important;
}

/* 移动端响应式更新 */
@media (max-width: 768px) {
    #cs-chat-header-modern {
        border-radius: 0;
        padding: 12px 14px;
    }
    
    #cs-input-area-modern {
        border-radius: 0;
    }
    
    #cs-chat-window-modern {
        border-radius: 0;
    }
    
    .cs-message-bubble-modern {
        max-width: 80%;
    }
}

/* ========== 独立客服页 customer_service_standalone.php（居中卡片，非全屏） ========== */
body.cs-chat-standalone-page {
    min-height: 100vh;
    overflow-x: hidden;
    background: #ffffff;
}

body.cs-chat-standalone-page .floating-buttons {
    display: none !important;
}

/* 与参考图类似：约 65% 视口宽、居中、圆角、投影 */
body.cs-chat-standalone-page #cs-chat-window-modern {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(920px, 68vw) !important;
    max-width: 92vw !important;
    height: min(720px, 85vh) !important;
    max-height: 85vh !important;
    border-radius: 18px !important;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.14),
        0 40px 80px rgba(0, 0, 0, 0.06) !important;
}

body.cs-chat-standalone-page #cs-chat-window-modern.chat-expanded {
    width: min(1100px, 78vw) !important;
    max-width: 94vw !important;
}

body.cs-chat-standalone-page .chat-newtab-btn {
    display: none !important;
}

@media (max-width: 768px) {
    body.cs-chat-standalone-page #cs-chat-window-modern {
        left: 0 !important;
        top: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }

    body.cs-chat-standalone-page #cs-chat-window-modern.chat-expanded {
        width: 100% !important;
        max-width: 100% !important;
    }
}

html.dark-mode body.cs-chat-standalone-page {
    background: linear-gradient(160deg, #1e2230 0%, #171a24 50%, #12151c 100%);
}

