/**
 * 客服上下文卡片样式
 * 文件：css/web/customer-service-context.css
 * 用途：配合 js/web/customer-service-context.js 使用
 * 版本：v2.0 - 独立文件版本
 */

/* ========================================
   客服上下文卡片样式 - 简洁卡片风格
   参考设计：样音卡片布局
   ======================================== */

/* 上下文卡片容器 - 默认样式（已发送的卡片）- ✨ 重设计 */
.cs-context-card {
    background: #ffffff;
    border-radius: 18px;
    margin: 10px;
    padding: 16px 18px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07), 0 4px 24px rgba(0, 0, 0, 0.04);
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0,0,0,0.06);
}

.cs-context-card-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ✨ 重设计 - 输入框上方的预览卡片（发送前）- 独立悬浮 */
#cs-chat-window-modern > #cs-context-card {
    position: fixed;
    z-index: 100000;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%) translateY(-10px);
    margin: 0;
    width: 380px;
    max-width: none;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.12),
        0 16px 48px rgba(0, 0, 0, 0.16),
        0 0 0 1px rgba(0,0,0,0.04);
    backdrop-filter: blur(8px);
}

#cs-chat-window-modern > #cs-context-card.cs-context-card-visible {
    transform: translateX(-50%) translateY(0);
}

/* ========== 顶部信息区域 ========== */
.cs-context-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    position: relative;
}

/* 头像 */
.cs-context-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
    transition: all 0.3s;
}

.cs-context-avatar-link:hover .cs-context-avatar img {
    transform: scale(1.05);
}

.cs-context-avatar {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-context-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    display: block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
}

/* 信息区域 */
.cs-context-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.cs-context-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1d21;
    line-height: 1.45;
    margin-bottom: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    letter-spacing: 0.01em;
}

.cs-context-name-link {
    text-decoration: none;
    display: block;
    transition: all 0.2s;
}

.cs-context-name-link:hover .cs-context-title,
.cs-context-name-link:hover .cs-context-name {
    color: #1a6dd4;
}

.cs-context-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1d21;
    line-height: 1.45;
    margin-bottom: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* 标签信息 - 胶囊样式标签（浅底 + 描边，框住文字） */
.cs-context-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.cs-context-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: #e8eff7;
    border: 1px solid #b8c9dc;
    border-radius: 6px;
    color: #3d4d5f;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.35;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cs-context-meta-tag:hover {
    background: #dbe7f5;
    border-color: #9eb5d0;
    color: #1a4d7a;
}

/* 标签分隔符 - 竖线样式（全局） */
.cs-context-meta-separator,
.cs-context-meta .cs-context-meta-separator,
.cs-inline-card-meta .cs-context-meta-separator {
    display: inline;
    color: #999;
    margin: 0 4px;
    font-weight: 300;
    font-size: 12px;
    background: none;
    padding: 0;
    border: none;
}

/* 关闭按钮 - 右上角 - ✨ 重设计 */
.cs-context-close {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f0f2f7;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.cs-context-close:hover {
    background: #e8edf6;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cs-context-close svg {
    stroke: #6b7a99;
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

/* ========== 播放器区域 - 全新简洁设计 ========== */
.cs-context-body {
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* 引用卡内波形区须铺满卡片宽（覆盖 chat.css 的 280px 固定宽） */
#cs-context-card .cs-context-body,
.cs-context-card .cs-context-body,
#cs-context-card .cs-waveform-attachment,
.cs-context-card .cs-waveform-attachment,
.cs-inline-card .cs-waveform-attachment {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    box-shadow: none;
}

/* 上下文卡片中的波形播放器边框 - 移除硬编码样式，使用后台配置 */
.cs-context-body .cs-waveform-attachment,
.cs-inline-card .cs-waveform-attachment {
    box-sizing: border-box;
}

/* 客服引用卡：全站 unified_player 组件 + 下载按钮横排，铺满整行 */
.cs-unified-player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100% !important;
    max-width: 100% !important;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    box-sizing: border-box;
}

.cs-unified-player-row .unified-player-wrapper,
.cs-unified-player-row .cs-chat-unified-player {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
}

.cs-unified-player-row .cs-wave-download-btn {
    flex: 0 0 auto;
    margin-left: 0;
}

.cs-unified-player-row .unified-player-container {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box;
}

#cs-context-card .unified-player-container .waveform,
#cs-context-card .unified-player-container .waveform.eager,
#cs-context-card .unified-player-container .waveform.lazy,
.cs-context-card .unified-player-container .waveform,
.cs-context-card .unified-player-container .waveform.eager,
.cs-context-card .unified-player-container .waveform.lazy,
.player-surface-light .unified-player-container .waveform {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}


.cs-context-player {
    /* 移除硬编码样式，播放器容器样式由后台配置控制 */
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.cs-context-player:hover {
    /* 移除硬编码的 border-color */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 播放按钮 - 参考声音列表样式 */
.cs-player-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.cs-player-btn:hover {
    border-color: #ff9800;
    background: #ff9800;
}

.cs-player-btn:active {
    transform: scale(0.95);
}

/* 播放图标 - 黑色三角形 */
.cs-player-btn svg {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 11px;
    border-color: transparent transparent transparent #000000;
    background: none;
    position: absolute;
    top: 50%;
    left: 52%;
    transform: translate(-50%, -50%);
    margin-left: 1px;
    fill: none;
}

.cs-player-btn:hover svg {
    border-left-color: #ffffff;
}

/* 播放时 - 橙色背景 + 白色暂停图标 */
.cs-player-btn.playing {
    background: #ff9800;
    border-color: #ff9800;
}

.cs-player-btn.playing svg {
    width: 10px;
    height: 12px;
    border: none;
    background: none;
    left: 50%;
    margin-left: 0;
    transform: translate(-50%, -50%);
}

/* 暂停图标的两个白色竖条 */
.cs-player-btn.playing svg::before,
.cs-player-btn.playing svg::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 12px;
    background: #ffffff;
    border-radius: 0.5px;
    top: 0;
}

.cs-player-btn.playing svg::before {
    left: 0;
}

.cs-player-btn.playing svg::after {
    right: 0;
}

/* 播放信息区域 - 水平布局 */
.cs-player-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

/* 时间显示 - 通用样式（跟随后台播放器配置） */
.cs-player-time {
    font-size: var(--pointer-font-size, 12px);  /* 跟随后台配置 */
    color: var(--pointer-text-color, #666);     /* 跟随后台配置 */
    font-weight: 500;
    min-width: 40px;
    max-width: 50px;
    flex-shrink: 0;
    flex-grow: 0;
    display: block;
    visibility: visible;
    opacity: 1;
    white-space: nowrap;
    line-height: 1;
}

/* 时间显示 - 左侧（当前时间）*/
.cs-player-time.current-time {
    order: 1;
    text-align: right;
}

/* 进度条 - 居中占据剩余空间 */
.cs-player-progress {
    order: 2;
    position: relative;
    flex: 1;
    height: 4px;
    background: #e8e8e8;
    border-radius: 2px;
    cursor: pointer;
}

.cs-player-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #ff9800;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

/* 时间显示 - 右侧（总时长）- 隐藏 */
.cs-player-time.total-time {
    order: 3;
    text-align: left;
    display: none;
}

/* 隐藏原生音频 */
.cs-context-player audio {
    display: none;
}

/* 🎵 内联卡片中的播放器 */
.cs-inline-card-player {
    padding: 12px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.cs-inline-card-player .cs-audio-player {
    width: 100%;
    height: 32px;
    border-radius: 16px;
    outline: none;
}

/* 统一的音频播放器样式 */
.cs-audio-player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cs-audio-player::-webkit-media-controls-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cs-audio-player::-webkit-media-controls-play-button,
.cs-audio-player::-webkit-media-controls-mute-button {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}

.cs-audio-player::-webkit-media-controls-current-time-display,
.cs-audio-player::-webkit-media-controls-time-remaining-display {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ========== 操作按钮区域 - ✨ 重设计 ========== */
.cs-context-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0;
}

/* 图标按钮样式 - ✨ 重设计 */
.cs-action-btn {
    flex: 1;
    max-width: 160px;
    height: 42px;
    border-radius: 12px;
    background: #f5f7fb;
    border: 1.5px solid #e4e9f2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    padding: 6px 12px;
}

.cs-action-btn:hover {
    background: #eef2fb;
    border-color: #1a6dd4;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26, 109, 212, 0.14);
}

.cs-action-btn svg {
    width: 17px;
    height: 17px;
    stroke: #6b7a99;
    fill: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cs-action-btn:hover svg {
    stroke: #1a6dd4;
}

.cs-action-btn-label {
    font-size: 13px;
    color: #5a6478;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.cs-action-btn:hover .cs-action-btn-label {
    color: #1a6dd4;
}

/* 主要操作按钮（发送）- ✨ 重设计 */
.cs-action-btn-primary {
    background: linear-gradient(135deg, #1a6dd4 0%, #1253b5 100%);
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(26, 109, 212, 0.30);
}

.cs-action-btn-primary svg {
    stroke: #fff;
}

.cs-action-btn-primary .cs-action-btn-label {
    color: #fff;
}

.cs-action-btn-primary:hover {
    background: linear-gradient(135deg, #2278e0 0%, #1565c8 100%);
    border-color: transparent;
    box-shadow: 0 5px 18px rgba(26, 109, 212, 0.40);
    transform: translateY(-1px);
}

.cs-action-btn-primary:hover svg {
    stroke: #fff;
}

.cs-action-btn-primary:hover .cs-action-btn-label {
    color: #fff;
}

/* 旧版按钮样式（保留兼容） */
.cs-btn-secondary,
.cs-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: none;
    flex: 1;
    white-space: nowrap;
}

.cs-btn-secondary {
    background: #fff;
    color: #666;
    border: 1.5px solid #e0e0e8;
}

.cs-btn-secondary:hover {
    background: #f8f8f8;
    border-color: #0f766e;
    color: #0f766e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.18);
}

.cs-btn-primary {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    color: #fff;
    border: 1.5px solid transparent;
}

.cs-btn-primary:hover {
    background: linear-gradient(135deg, #115e59 0%, #134e4a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.32);
}

.cs-btn-secondary svg,
.cs-btn-primary svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* 聊天消息中的内联卡片 */
.cs-inline-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    /* 🎯 统一卡片宽度（PC端固定，移动端自适应） */
    width: 280px;
    max-width: 100%;
    box-sizing: border-box;
}

/* 📱 移动端卡片自适应 - 宽度100%跟随气泡 */
@media (max-width: 768px) {
    .cs-inline-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

.cs-inline-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

/* ========== 引用消息中的内联卡片样式 ========== */
/* 确保引用消息中的卡片正常显示 */
.cs-message-reply-content .cs-inline-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    gap: 12px;
    max-width: 100%;
    transform: scale(0.95);
    transform-origin: left top;
    /* pointer-events: none; 移除，允许链接点击 */
    opacity: 0.9; /* 稍微透明，表示是引用 */
}

/* 引用区中的链接和头像可点击 */
.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],
.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] {
    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-inline-card-title,
.cs-message-reply-content .cs-context-name-link:hover .cs-context-title,
.cs-message-reply-content .cs-context-name-link:hover .cs-context-name,
.cs-message-reply-quote .cs-inline-card-title-link:hover .cs-inline-card-title,
.cs-message-reply-quote .cs-context-name-link:hover .cs-context-title,
.cs-message-reply-quote .cs-context-name-link:hover .cs-context-name {
    color: #0f766e;
    transition: color 0.2s;
}

.cs-message-reply-content .cs-inline-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cs-message-reply-content .cs-inline-card-avatar {
    display: block;
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-message-reply-content .cs-inline-card-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    background: #ffffff;
}

.cs-message-reply-content .cs-inline-card-info {
    display: block;
    flex: 1;
    min-width: 0;
}

.cs-message-reply-content .cs-inline-card-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-message-reply-content .cs-inline-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.cs-message-reply-content .cs-inline-card-meta .cs-context-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: #e8eff7;
    border: 1px solid #b8c9dc;
    border-radius: 6px;
    color: #3d4d5f;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.35;
    box-sizing: border-box;
}

/* 引用区中的分隔符样式 */
.cs-message-reply-content .cs-inline-card-meta .cs-context-meta-separator,
.cs-message-reply-content .cs-context-meta .cs-context-meta-separator {
    display: inline;
    color: #999;
    margin: 0 4px;
    font-weight: 300;
    font-size: 12px;
}

/* 引用区中的播放按钮和波形 */
.cs-message-reply-content .cs-audio-player-row {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: visible;
}

.cs-message-reply-content .cs-wave-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid #333;
    flex-shrink: 0;
}

.cs-message-reply-content .cs-wave-play-btn .play-icon,
.cs-message-reply-content .cs-wave-play-btn .pause-icon {
    display: block;
}

.cs-message-reply-content .cs-waveform-attachment {
    display: block;
    flex: 1;
    min-width: 0;
}

.cs-message-reply-content .cs-waveform-attachment canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* 引用区中的波形容器 */
.cs-message-reply-content .cs-waveform-container {
    display: block;
    flex: 1;
    min-width: 100px; /* 确保有最小宽度，避免被认为不可见 */
    position: relative;
    overflow: visible;
}

.cs-message-reply-content .cs-waveform {
    display: block;
    width: 100%;
    height: 40px;
    min-width: 100px;
    position: relative;
    overflow: visible;
}

.cs-message-reply-content .cs-waveform canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* 引用区中的波形图子元素 */
.cs-message-reply-content .cs-waveform > div {
    display: block;
    width: 100%;
    height: 100%;
}

/* 引用区波形的时间指针（隐藏，避免干扰） */
.cs-message-reply-content .cs-wave-time-pointer,
.cs-message-reply-content .cs-wave-current-time {
    display: none;
}

/* 引用区中的WaveSurfer元素 */
.cs-message-reply-content div[class*="wavesurfer"] {
    display: block;
}

.cs-message-reply-content .cs-waveform > div,
.cs-message-reply-content .cs-waveform > div > * {
    display: block;
    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-inline-card-actions,
.cs-message-reply-content .cs-card-actions,
.cs-message-reply-content .cs-wave-download-btn,
.cs-message-reply-content .cs-context-body,
.cs-message-reply-content audio {
    display: none;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    opacity: 0;
}

/* 更强的全局隐藏规则 - 针对引用消息中的所有音频播放器 */
.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-inline-card-actions,
.cs-message-reply-quote .cs-card-actions,
.cs-message-reply-quote .cs-wave-download-btn,
.cs-message-reply-quote .cs-context-body,
.cs-message-reply-quote audio {
    display: none;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    opacity: 0;
}

/* 针对上下文卡片在引用区的隐藏 */
.cs-message-reply-content .cs-context-card .cs-context-body,
.cs-message-reply-quote .cs-context-card .cs-context-body {
    display: none;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
}

/* 针对内联卡片在引用区的隐藏 */
.cs-message-reply-content .cs-inline-card .cs-waveform-attachment,
.cs-message-reply-quote .cs-inline-card .cs-waveform-attachment {
    display: none;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
}

 

/* 老师卡片内的头部样式（使用上下文卡片的布局）*/
.cs-inline-card-teacher .cs-context-header {
    margin-bottom: 12px;
}

.cs-inline-card-teacher .cs-context-avatar {
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-inline-card-teacher .cs-context-avatar img {
    width: 100%;
    height: 100%;
    background: #ffffff;
}

/* 内联卡片头部（头像+信息）- 与弹窗保持一致 */
.cs-inline-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cs-inline-card-avatar-link {
    flex-shrink: 0;
    text-decoration: none;
    transition: all 0.2s;
}

.cs-inline-card-avatar-link:hover .cs-inline-card-avatar img {
    transform: scale(1.05);
    border-color: #0f766e;
}

.cs-inline-card-avatar {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-inline-card-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    transition: all 0.2s;
    background: #ffffff;
}

.cs-inline-card-info {
    flex: 1;
    min-width: 0;
}

.cs-inline-card-title-link {
    text-decoration: none;
    display: block;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-inline-card-title-link:hover .cs-inline-card-title {
    color: #0f766e;
}

.cs-inline-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    transition: color 0.2s;
}

.cs-inline-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* 聊天框内联卡片：与上下文预览卡同一套标签样式 */
.cs-inline-card-meta .cs-context-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: #e8eff7;
    border: 1px solid #b8c9dc;
    border-radius: 6px;
    color: #3d4d5f;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.35;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cs-inline-card-meta .cs-context-meta-tag:hover {
    background: #dbe7f5;
    border-color: #9eb5d0;
    color: #1a4d7a;
}

/* 内联卡片中的分隔符样式 */
.cs-inline-card-meta .cs-context-meta-separator {
    display: inline;
    color: #999;
    margin: 0 4px;
    font-weight: 300;
    font-size: 12px;
}

/* 查看详情链接容器 */
.cs-inline-card-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.cs-inline-card-link {
    color: #0f766e;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cs-inline-card-link:hover {
    color: #388E3C;
}

/* 旧版兼容（如果有用到） */
.cs-inline-card-body {
    flex: 1;
    min-width: 0;
}

.cs-inline-card-action {
    color: #2196F3;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

.cs-inline-card-action:hover {
    color: #1976D2;
    text-decoration: underline;
}

.cs-message-text {
    margin-bottom: 4px;
    color: #333;
    font-size: 13px;
    line-height: 1.5;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .cs-context-card {
        margin: 8px;
        padding: 16px;
        border-radius: 16px;
    }
    
    .cs-context-header {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    /* 🎯 统一头像大小为45px，白色背景 */
    .cs-context-avatar img {
        width: 45px;
        height: 45px;
        background: #ffffff;
    }
    
    .cs-context-title,
    .cs-context-name {
        font-size: 13px;
    }
    
    .cs-context-meta {
        gap: 5px;
    }
    
 
    
    .cs-context-player {
        padding: 10px;
        gap: 10px;
    }
    
    .cs-player-btn {
        width: 32px;
        height: 32px;
    }
    
    .cs-player-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .cs-player-time {
        font-size: 10px;
    }
    
   
    
    .cs-action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .cs-action-btn-label {
        font-size: 13px;
    }
    
    .cs-inline-card {
        padding: 8px;
        gap: 8px;
    }
    
    .cs-inline-card-avatar,
    .cs-context-avatar {
        width: 45px;
        height: 45px;
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .cs-inline-card-avatar img,
    .cs-context-avatar img {
        width: 45px;
        height: 45px;
        background: #ffffff;
    }
}

/* ========================================
   🔥 全局头像样式统一（最高优先级）
   ======================================== */
#cs-chat-window-modern .cs-context-avatar,
#cs-chat-window-modern .cs-inline-card-avatar,
.cs-message-modern .cs-context-avatar,
.cs-message-modern .cs-inline-card-avatar {
    width: 45px;
    height: 45px;
    overflow: hidden;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#cs-chat-window-modern .cs-context-avatar img,
#cs-chat-window-modern .cs-inline-card-avatar img,
.cs-message-modern .cs-context-avatar img,
.cs-message-modern .cs-inline-card-avatar img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    background: #ffffff;
}

/* 打印样式 */
@media print {
    .cs-context-card {
        display: none;
    }
}

/* ========== 暗黑模式：引用卡保持浅色底，标题/播放键用深色（覆盖 dark-mode-unified 全局白字白图标） ========== */
body.dark-mode #cs-context-card,
body.dark-mode #cs-chat-window-modern > .cs-context-card,
body.dark-mode .bubble-user .cs-context-card,
body.dark-mode .bubble-user .cs-inline-card {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    color: #1a1d21 !important;
}

body.dark-mode #cs-context-card .cs-context-title,
body.dark-mode #cs-context-card .cs-context-name,
body.dark-mode #cs-context-card .cs-context-name-link,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-context-title,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-context-name,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-context-name-link,
body.dark-mode .bubble-user .cs-context-card .cs-context-title,
body.dark-mode .bubble-user .cs-context-card .cs-context-name,
body.dark-mode .bubble-user .cs-inline-card .cs-inline-card-title,
body.dark-mode .bubble-user .cs-inline-card .cs-inline-card-name {
    color: #1a1d21 !important;
}

body.dark-mode #cs-context-card .cs-context-meta-tag,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-context-meta-tag,
body.dark-mode .bubble-user .cs-context-card .cs-context-meta-tag,
body.dark-mode .bubble-user .cs-inline-card .cs-inline-card-tag {
    background: #e8eff7 !important;
    border-color: #b8c9dc !important;
    color: #3d4d5f !important;
}

/* 引用卡内 unified_player：颜色/边框由 applyButtonStyle 内联样式（浅色模式配置）控制 */
#cs-context-card .unified-player-wrapper,
.cs-context-card .unified-player-wrapper,
.player-surface-light {
    width: 100%;
}


body.dark-mode #cs-context-card .cs-wave-download-btn,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-wave-download-btn,
body.dark-mode .bubble-user .cs-context-card .cs-wave-download-btn,
body.dark-mode .bubble-user .cs-inline-card .cs-wave-download-btn {
    color: #64748b !important;
}

body.dark-mode #cs-context-card .cs-wave-download-btn:hover,
body.dark-mode #cs-chat-window-modern > .cs-context-card .cs-wave-download-btn:hover {
    color: #1a1d21 !important;
    background: rgba(15, 23, 42, 0.06) !important;
}

body.dark-mode #cs-context-card .cs-context-close {
    background: #f0f2f7 !important;
}

body.dark-mode #cs-context-card .cs-context-close svg {
    stroke: #6b7a99 !important;
}

body.dark-mode #cs-context-card .cs-action-btn:not(.cs-action-btn-primary) {
    background: #f5f7fb !important;
    border-color: #e4e9f2 !important;
    color: #3d4d5f !important;
}

body.dark-mode #cs-context-card .cs-action-btn:not(.cs-action-btn-primary):hover {
    background: #e8ecf4 !important;
    border-color: #d0d8e8 !important;
    color: #1a1d21 !important;
}
