/* ========================================
   聊天室样式 - 商业级现代设计
   适配 Zibll 深色主题
======================================== */

/* CSS变量定义 */
:root {
    --chat-primary: #1890ff;
    --chat-primary-hover: #40a9ff;
    --chat-primary-active: #096dd9;
    --chat-success: #52c41a;
    --chat-warning: #faad14;
    --chat-error: #ff4d4f;
    --chat-bg-1: #ffffff;
    --chat-bg-2: #fafafa;
    --chat-bg-3: #f5f5f5;
    --chat-border: #e8e8e8;
    --chat-border-light: #f0f0f0;
    --chat-text-1: #262626;
    --chat-text-2: #595959;
    --chat-text-3: #8c8c8c;
    --chat-text-4: #bfbfbf;
    --chat-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --chat-shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --chat-shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --chat-radius-sm: 4px;
    --chat-radius-md: 8px;
    --chat-radius-lg: 12px;
    --chat-msg-self-bg: #1890ff;
    --chat-msg-other-bg: #ffffff;
}

/* 深色主题 - 适配Zibll */
.dark-theme,
body.dark-theme {
    --chat-primary: #1890ff;
    --chat-primary-hover: #40a9ff;
    --chat-primary-active: #096dd9;
    --chat-bg-1: #1f1f1f;
    --chat-bg-2: #2a2a2a;
    --chat-bg-3: #323232;
    --chat-border: #3a3a3a;
    --chat-border-light: #2f2f2f;
    --chat-text-1: #e8e8e8;
    --chat-text-2: #b8b8b8;
    --chat-text-3: #8c8c8c;
    --chat-text-4: #5c5c5c;
    --chat-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --chat-shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --chat-shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --chat-msg-other-bg: #2a2a2a;
}

/* ========================================
   基础容器
======================================== */
.knn-chat {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.knn-chat.pos-right { right: 20px; }
.knn-chat.pos-left { left: 20px; }

/* ========================================
   悬浮按钮
======================================== */
.chat-btn {
    width: 54px;
    height: 54px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.chat-btn:hover {
    background: var(--chat-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-lg);
}
.chat-btn:active {
    transform: translateY(0);
}
.chat-btn i {
    color: #fff;
    font-size: 22px;
}
.chat-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--chat-error);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--chat-bg-1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ========================================
   聊天窗口主体 - 居中弹窗式
======================================== */
.chat-box {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 550px;
    height: 550px;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-lg);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chat-border);
    z-index: 99998;
}
.chat-box.open {
    display: flex;
    animation: chatBoxIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatBoxIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 遮罩层 */
.chat-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99997;
    backdrop-filter: blur(2px);
}
.chat-backdrop.open {
    display: block;
    animation: backdropFadeIn 0.3s ease;
}
@keyframes backdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   头部区域
======================================== */
.chat-head {
    padding: 14px 16px;
    background: var(--chat-bg-1);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-head span {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-1);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-head span i {
    color: var(--chat-primary);
    font-size: 18px;
}
.chat-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--chat-text-3);
}
.chat-close:hover {
    background: var(--chat-bg-3);
    color: var(--chat-text-1);
}
.chat-close i {
    font-size: 16px;
}

/* 在线人数 */
.online-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--chat-text-3);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.online-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-success);
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* ========================================
   消息区域
======================================== */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--chat-bg-2);
}
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-4);
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

/* 消息项 */
.chat-msg {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    animation: msgSlideIn 0.3s ease;
}
/* 初始批量加载时禁用动画 + 隐藏内容，避免滚动跳动闪烁 */
#chat-body.no-anim .chat-msg {
    animation: none !important;
}
#chat-body.loading {
    visibility: hidden;
}
@keyframes msgSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border-light);
}

.chat-msg .content {
    max-width: calc(100% - 50px);
    display: flex;
    flex-direction: column;
}

.chat-msg .head {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 6px;
}

.chat-msg .name {
    font-size: 12px;
    font-weight: 500;
    color: var(--chat-text-2);
}
/* 可点击的用户名（点击回复） */
.msg-name-link {
    cursor: pointer;
    transition: color 0.15s;
}
.msg-name-link:hover {
    color: var(--chat-primary);
    text-decoration: underline;
}

.chat-msg .time {
    font-size: 11px;
    color: var(--chat-text-3);
}

.chat-msg .text {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    position: relative;
    border-radius: var(--chat-radius-md);
}

.chat-msg .del {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px 6px;
    border-radius: var(--chat-radius-sm);
}
.chat-msg:hover .del { opacity: 1; }
.chat-msg .del:hover { background: var(--chat-error); }

/* 别人的消息 */
.chat-msg.other {
    flex-direction: row;
}
.chat-msg.other .avatar {
    margin-right: 10px;
}
.chat-msg.other .text {
    background: var(--chat-msg-other-bg);
    color: var(--chat-text-1);
    border: 1px solid var(--chat-border-light);
    border-radius: 0 var(--chat-radius-md) var(--chat-radius-md) var(--chat-radius-md);
}
.chat-msg.other .del {
    right: -30px;
}

/* 自己的消息 */
.chat-msg.self {
    flex-direction: row-reverse;
}
.chat-msg.self .avatar {
    margin-left: 10px;
}
.chat-msg.self .content {
    align-items: flex-end;
}
.chat-msg.self .text {
    background: var(--chat-msg-self-bg);
    color: #fff;
    border-radius: var(--chat-radius-md) 0 var(--chat-radius-md) var(--chat-radius-md);
}
.chat-msg.self .del {
    left: -30px;
}

/* ========================================
   底部输入区
======================================== */
.chat-foot {
    padding: 10px 12px 10px;
    background: var(--chat-bg-1);
    border-top: 1px solid var(--chat-border);
    flex-shrink: 0;
    position: relative;
}

/* 输入框区域 */
.chat-foot-inner {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 8px;
}
.chat-foot textarea {
    flex: 1;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    padding: 9px 12px;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 80px;
    min-height: 36px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--chat-text-1);
    background: var(--chat-bg-2);
    width: 100%;
    box-sizing: border-box;
}
.chat-foot textarea:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}
.chat-foot textarea::placeholder {
    color: var(--chat-text-4);
    font-size: 13px;
}

/* 工具栏 */
.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.chat-tools-left {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.chat-tools-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.tool-btn {
    height: 32px;
    padding: 0 7px;
    background: transparent;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--chat-text-2);
    transition: all 0.2s;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    flex-shrink: 0;
}
.tool-btn i {
    font-size: 14px;
    flex-shrink: 0;
}
.tool-btn span {
    font-size: 11px;
}
.tool-btn:hover {
    background: var(--chat-bg-3);
    color: var(--chat-primary);
}
.tool-btn:active {
    transform: scale(0.95);
}

/* 语音按钮 - 绿色 */
.tool-btn-voice {
    background: #52c41a;
    color: #fff !important;
    border-radius: var(--chat-radius-sm);
    padding: 0 8px;
}
.tool-btn-voice:hover {
    background: #73d13d !important;
    color: #fff !important;
}
.tool-btn-voice:active {
    background: #389e0d !important;
}

/* 发送按钮 - 橙色 */
.chat-send-btn {
    height: 32px;
    padding: 0 10px;
    background: #ff7a00;
    color: #fff;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.chat-send-btn i {
    font-size: 13px;
}
.chat-send-btn:hover {
    background: #ff9520;
}
.chat-send-btn:active {
    background: #e06800;
}
.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* 兼容旧的 #chat-send 选择器 */
.chat-foot button#chat-send {
    height: 32px;
    padding: 0 10px;
    background: #ff7a00;
    color: #fff;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.chat-foot button#chat-send:hover {
    background: #ff9520;
}
.chat-foot button#chat-send:active {
    background: #e06800;
}
.chat-foot button#chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 登录提示 */
.chat-tip {
    text-align: center;
    padding: 12px;
    color: var(--chat-text-3);
    font-size: 13px;
}
.chat-tip a {
    color: var(--chat-primary);
    text-decoration: none;
    font-weight: 500;
}
.chat-tip a:hover {
    text-decoration: underline;
}

/* ========================================
   卡片消息
======================================== */
.msg-card {
    display: flex;
    background: var(--chat-bg-1);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    max-width: 240px;
}
.msg-card:hover {
    box-shadow: var(--chat-shadow-sm);
    transform: translateY(-1px);
    border-color: var(--chat-primary);
}
.card-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--chat-bg-3);
}
.card-info {
    flex: 1;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-text-1);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-desc {
    font-size: 11px;
    color: var(--chat-text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 4px 0;
}
.card-foot {
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #fff;
    border-radius: var(--chat-radius-sm);
    font-weight: 500;
}
.card-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-error);
}

/* ========================================
   图片消息
======================================== */
.msg-image {
    max-width: 200px;
    border-radius: var(--chat-radius-md);
    overflow: hidden;
    cursor: zoom-in;
    transition: all 0.2s;
}
.msg-image:hover {
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-sm);
}
.msg-image img {
    display: block;
    max-width: 100%;
    border-radius: var(--chat-radius-md);
    background: var(--chat-bg-3);
}

/* 视频消息 */
.msg-video {
    max-width: 260px;
    border-radius: var(--chat-radius-md);
    overflow: hidden;
}
.msg-video video {
    display: block;
    max-width: 100%;
    border-radius: var(--chat-radius-md);
    background: #000;
}

/* 语音消息 */
.msg-voice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--chat-bg-2);
    border-radius: 20px;
    cursor: pointer;
    min-width: 80px;
    max-width: 220px;
    transition: background 0.2s;
    user-select: none;
}
.msg-voice:hover {
    background: var(--chat-bg-3);
}
.msg-voice.playing {
    background: rgba(24,144,255,0.12);
}
.msg-voice .fa-volume-up {
    color: var(--chat-primary);
    font-size: 16px;
    flex-shrink: 0;
}
.msg-voice.playing .fa-volume-up {
    animation: voicePulse 0.8s ease-in-out infinite alternate;
}
@keyframes voicePulse {
    from { opacity: 0.5; transform: scale(0.9); }
    to   { opacity: 1;   transform: scale(1.1); }
}
.voice-bar {
    display: inline-block;
    height: 4px;
    background: var(--chat-primary);
    border-radius: 2px;
    opacity: 0.6;
    flex-shrink: 0;
}
.voice-dur {
    font-size: 12px;
    color: var(--chat-text-3);
    white-space: nowrap;
}
.msg-voice audio {
    display: none;
}

/* 语音录制激活状态 */
#chat-voice-btn.recording {
    color: #ff4d4f;
    animation: recordPulse 1s ease-in-out infinite alternate;
}
@keyframes recordPulse {
    from { opacity: 0.7; }
    to   { opacity: 1; box-shadow: 0 0 0 4px rgba(255,77,79,0.2); }
}

/* ========================================
   微信风格语音录制弹窗
======================================== */
.voice-record-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100010;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.voice-record-modal.open {
    display: flex;
    animation: voiceModalIn 0.25s cubic-bezier(0.4,0,0.2,1);
}
@keyframes voiceModalIn {
    from { opacity:0; transform: scale(0.85); }
    to   { opacity:1; transform: scale(1); }
}
.voice-record-content {
    width: 260px;
    background: var(--chat-bg-1);
    border-radius: 20px;
    padding: 32px 24px 24px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
/* 麦克风图标圈圈 */
.voice-record-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #52c41a, #73d13d);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 0 0 rgba(82,196,26,0.4);
    animation: voicePing 1.5s ease-in-out infinite;
}
@keyframes voicePing {
    0%   { box-shadow: 0 0 0 0 rgba(82,196,26,0.45); }
    70%  { box-shadow: 0 0 0 18px rgba(82,196,26,0); }
    100% { box-shadow: 0 0 0 0 rgba(82,196,26,0); }
}
.voice-record-icon > i {
    font-size: 34px;
    color: #fff;
    z-index: 1;
}
/* 音波动画 */
.voice-wave {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
}
.voice-wave span {
    display: inline-block;
    width: 4px;
    border-radius: 2px;
    background: #52c41a;
    animation: waveBar 0.8s ease-in-out infinite alternate;
}
.voice-wave span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 18px; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 12px; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 6px;  animation-delay: 0.4s; }
@keyframes waveBar {
    from { transform: scaleY(0.4); opacity: 0.5; }
    to   { transform: scaleY(1.0); opacity: 1; }
}
/* 计时数字 */
.voice-record-time {
    font-size: 42px;
    font-weight: 700;
    color: var(--chat-text-1);
    line-height: 1;
    letter-spacing: 1px;
    margin-top: 12px;
}
/* 提示文字 */
.voice-record-tip {
    font-size: 13px;
    color: var(--chat-text-3);
}
/* 操作按钮行 */
.voice-record-actions {
    display: flex;
    gap: 16px;
    width: 100%;
    margin-top: 4px;
}
.voice-cancel-btn,
.voice-stop-btn {
    flex: 1;
    height: 42px;
    border: none;
    border-radius: 21px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.voice-cancel-btn {
    background: var(--chat-bg-3);
    color: var(--chat-text-2);
}
.voice-cancel-btn:hover {
    background: #ff4d4f;
    color: #fff;
}
.voice-stop-btn {
    background: #52c41a;
    color: #fff;
}
.voice-stop-btn:hover {
    background: #73d13d;
}

/* 图片灯箱 */
.chat-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100002;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    backdrop-filter: blur(4px);
}
.chat-lightbox.open { display: flex; }
.chat-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--chat-radius-md);
    object-fit: contain;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.25);
}

/* ========================================
   红包卡片样式
======================================== */
.msg-red-packet {
    width: 260px;
    border-radius: var(--chat-radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}
.msg-red-packet:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

.rp-card-top {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}
.rp-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}
.rp-icon i {
    color: #ffd700;
    font-size: 22px;
}
.rp-info {
    flex: 1;
    min-width: 0;
}
.rp-greeting {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rp-status-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    margin-top: 4px;
}
.rp-card-bottom {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    backdrop-filter: blur(10px);
}

/* 红包状态样式 */
.msg-red-packet.rp-active {
    animation: rp-pulse 2s ease-in-out infinite;
}
@keyframes rp-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.6);
    }
}
.msg-red-packet.rp-claimed,
.msg-red-packet.rp-self {
    opacity: 0.8;
}
.msg-red-packet.rp-finished,
.msg-red-packet.rp-expired {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    opacity: 0.75;
}
.msg-red-packet.rp-finished .rp-icon i,
.msg-red-packet.rp-expired .rp-icon i {
    color: #d1d5db;
}

/* 领取动画 */
.rp-claim-anim {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #ffd700;
    font-size: 28px;
    font-weight: 700;
    padding: 20px 40px;
    border-radius: var(--chat-radius-lg);
    z-index: 100001;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.5);
}
.rp-claim-anim.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ========================================
   红包弹窗样式
======================================== */
/* 发送红包弹窗 */
.rp-modal,
.rp-detail-modal,
.rp-open-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.rp-modal.open,
.rp-detail-modal.open,
.rp-open-modal.open {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rp-modal-content {
    width: 360px;
    max-width: 90vw;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rp-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #fff;
}
.rp-modal-head span {
    font-size: 16px;
    font-weight: 600;
}
.rp-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--chat-radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s;
}
.rp-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rp-modal-body {
    padding: 20px;
}
.rp-form-group {
    margin-bottom: 16px;
}
.rp-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--chat-text-1);
    margin-bottom: 8px;
}
.rp-form-group select,
.rp-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    font-size: 14px;
    background: var(--chat-bg-1);
    color: var(--chat-text-1);
    box-sizing: border-box;
    transition: all 0.2s;
}
.rp-form-group select:focus,
.rp-form-group input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}
.rp-summary {
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(255, 107, 107, 0.08);
    border-radius: var(--chat-radius-md);
    font-size: 13px;
    color: var(--chat-text-2);
    text-align: center;
    line-height: 1.6;
    border: 1px solid rgba(255, 107, 107, 0.15);
}
.rp-send-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #fff;
    border: none;
    border-radius: var(--chat-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.rp-send-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.rp-send-btn:active {
    transform: translateY(0);
}
.rp-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   红包详情弹窗
======================================== */
.rp-detail-content {
    width: 360px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rp-detail-head {
    padding: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: #fff;
    flex-shrink: 0;
}
.rp-detail-sender {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.rp-detail-sender img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}
.rp-detail-name {
    font-size: 16px;
    font-weight: 600;
}
.rp-detail-greeting {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}
.rp-detail-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    opacity: 0.95;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    gap: 8px;
}
.rp-detail-info span {
    flex: 1;
}
.rp-detail-status {
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 11px;
    white-space: nowrap;
}
.rp-detail-remaining {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    padding-top: 8px;
    text-align: center;
}

.rp-detail-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    max-height: 320px;
}
.rp-detail-list::-webkit-scrollbar {
    width: 6px;
}
.rp-detail-list::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}
.rp-detail-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    gap: 12px;
    border-bottom: 1px solid var(--chat-border-light);
}
.rp-detail-item:last-child {
    border-bottom: none;
}
.rp-detail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border-light);
}
.rp-detail-item-info {
    flex: 1;
    min-width: 0;
}
.rp-detail-item-info span:first-child {
    font-size: 14px;
    font-weight: 500;
    color: var(--chat-text-1);
}
.rp-detail-time {
    font-size: 11px;
    color: var(--chat-text-3);
    margin-left: 8px;
}
.rp-detail-amount {
    font-size: 15px;
    font-weight: 600;
    color: #ff6b6b;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.rp-best-luck {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    background: #ffd700;
    color: #8b4513;
    border-radius: var(--chat-radius-sm);
    font-weight: 600;
}
.rp-detail-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--chat-text-3);
    font-size: 13px;
}
.rp-detail-close {
    margin: 12px 20px 16px;
    padding: 10px;
    background: var(--chat-bg-3);
    border: none;
    border-radius: var(--chat-radius-md);
    color: var(--chat-text-1);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.rp-detail-close:hover {
    background: var(--chat-border);
}

/* ========================================
   拆红包弹窗（微信风格）
======================================== */
.rp-open-content {
    width: 300px;
    background: linear-gradient(180deg, #d84a3e 0%, #e85b4f 40%, #d84a3e 100%);
    border-radius: var(--chat-radius-lg);
    text-align: center;
    padding: 32px 24px 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: rp-open-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes rp-open-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.rp-open-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}
.rp-open-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.rp-open-sender {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}
.rp-open-sender img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.rp-open-sender span {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.rp-open-greeting {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.5;
    min-height: 24px;
}

.rp-open-btn-wrap {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.rp-open-btn {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f7c948, #e8a820);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 32px;
    color: #d84a3e;
    box-shadow: 0 4px 20px rgba(232, 168, 32, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}
.rp-open-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(232, 168, 32, 0.7);
}
.rp-open-btn:active {
    transform: scale(1.02);
}
.rp-open-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.rp-open-btn.rp-opening {
    animation: rp-spin 0.8s linear infinite;
}
@keyframes rp-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rp-open-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #d84a3e;
    font-size: 22px;
    font-weight: 700;
    pointer-events: none;
    z-index: 2;
}

.rp-open-footer {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* ========================================
   表情选择器
======================================== */
.emoji-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    width: 320px;
    background: var(--chat-bg-1);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-lg);
    z-index: 100001;
}
.emoji-picker.open {
    display: block;
    animation: emojiPickerIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes emojiPickerIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.emoji-picker-content {
    display: flex;
    flex-direction: column;
    max-height: 300px;
}
.emoji-picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--chat-border);
    padding: 8px;
    gap: 4px;
    background: var(--chat-bg-2);
    border-radius: var(--chat-radius-lg) var(--chat-radius-lg) 0 0;
}
.emoji-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--chat-radius-sm);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.emoji-tab:hover {
    background: var(--chat-bg-3);
}
.emoji-tab.active {
    background: var(--chat-primary);
}
.emoji-tab:active {
    transform: scale(0.95);
}
.emoji-picker-body {
    padding: 12px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 240px;
}
.emoji-picker-body::-webkit-scrollbar {
    width: 6px;
}
.emoji-picker-body::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}
.emoji-item {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: var(--chat-radius-sm);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.emoji-item:hover {
    background: var(--chat-bg-3);
    transform: scale(1.2);
}
.emoji-item:active {
    transform: scale(1.1);
}

/* ========================================
   管理员标识
======================================== */
.admin-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1.4;
}

/* ========================================
   头部按钮组（在线用户按钮）
======================================== */
.chat-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-head-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 10px;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-sm);
    color: var(--chat-text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chat-head-btn:hover {
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    color: #fff;
}
.chat-head-btn i { font-size: 13px; }

/* ========================================
   置顶公告栏
======================================== */
.chat-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(24,144,255,0.08), rgba(24,144,255,0.04));
    border-bottom: 1px solid rgba(24,144,255,0.2);
    font-size: 13px;
    color: var(--chat-text-1);
    flex-shrink: 0;
    animation: noticeSlideDown 0.3s ease;
}
@keyframes noticeSlideDown {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}
.chat-notice > i.fa-bullhorn {
    color: var(--chat-primary);
    font-size: 14px;
    flex-shrink: 0;
}
.chat-notice-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-notice-del {
    background: transparent;
    border: none;
    color: var(--chat-text-3);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-notice-del:hover { color: var(--chat-error); background: rgba(255,77,79,0.08); }

/* ========================================
   引用回复预览条
======================================== */
.chat-reply-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(24,144,255,0.06);
    border-top: 1px solid rgba(24,144,255,0.15);
    border-left: 3px solid var(--chat-primary);
    font-size: 12px;
    color: var(--chat-text-2);
    flex-shrink: 0;
    animation: replyBarIn 0.2s ease;
}
@keyframes replyBarIn {
    from { opacity:0; transform:translateY(4px); }
    to   { opacity:1; transform:translateY(0); }
}
.chat-reply-bar > i { color: var(--chat-primary); flex-shrink:0; }
.reply-bar-user { font-weight:600; color: var(--chat-primary); flex-shrink:0; }
.reply-bar-text { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color: var(--chat-text-3); }
.reply-bar-cancel {
    background: transparent;
    border: none;
    color: var(--chat-text-3);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.reply-bar-cancel:hover { color: var(--chat-error); }

/* ========================================
   消息回复引用气泡
======================================== */
.msg-reply-quote {
    padding: 6px 10px;
    background: var(--chat-bg-3);
    border-left: 3px solid var(--chat-primary);
    border-radius: 0 var(--chat-radius-sm) var(--chat-radius-sm) 0;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--chat-text-3);
    max-width: 220px;
    overflow: hidden;
}
/* 可点击的引用块 */
.msg-reply-quote-link {
    cursor: pointer;
    transition: background 0.15s;
}
.msg-reply-quote-link:hover {
    background: rgba(24,144,255,0.12);
    color: var(--chat-text-2);
}
/* 消息高亮闪烁动画 */
@keyframes msgHighlight {
    0%   { background: transparent; }
    20%  { background: rgba(24,144,255,0.2); }
    80%  { background: rgba(24,144,255,0.2); }
    100% { background: transparent; }
}
.chat-msg.msg-highlight {
    animation: msgHighlight 1.8s ease;
    border-radius: var(--chat-radius-md);
}
.reply-quote-user { font-weight:600; color: var(--chat-primary); margin-right:2px; }
.reply-quote-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   在线用户侧边面板（聊天窗内部左侧覆盖）
======================================== */
.chat-online-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 100%;
    background: var(--chat-bg-1);
    border-right: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-lg) 0 0 var(--chat-radius-lg);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}
.chat-online-panel.open {
    transform: translateX(0);
}
.online-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--chat-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-text-1);
    flex-shrink: 0;
    background: var(--chat-bg-1);
}
.online-panel-close {
    background: transparent;
    border: none;
    color: var(--chat-text-3);
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    border-radius: 3px;
    transition: all 0.2s;
}
.online-panel-close:hover { color: var(--chat-text-1); background: var(--chat-bg-3); }
.online-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.online-panel-list::-webkit-scrollbar { width: 4px; }
.online-panel-list::-webkit-scrollbar-thumb { background: var(--chat-border); border-radius: 2px; }
.online-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--chat-radius-sm);
    transition: background 0.15s;
}
.online-user-item:hover { background: var(--chat-bg-2); }
.online-user-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border-light);
}
.online-user-av-def {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--chat-bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--chat-text-4);
    font-size: 14px;
    border: 1px solid var(--chat-border-light);
}
.online-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.online-user-name {
    font-size: 12px;
    color: var(--chat-text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.online-admin-mark {
    display: inline-block;
    font-size: 9px;
    padding: 1px 4px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    border-radius: 3px;
    flex-shrink: 0;
    font-weight: 600;
}
.online-loading, .online-empty {
    text-align: center;
    padding: 20px 12px;
    color: var(--chat-text-3);
    font-size: 12px;
}

/* ========================================
   发布公告弹窗
======================================== */
.notice-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100005;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.notice-modal.open {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}
.notice-modal-content {
    width: 380px;
    max-width: 90vw;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.notice-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--chat-primary), #40a9ff);
    color: #fff;
}
.notice-modal-head span { font-size: 15px; font-weight: 600; }
.notice-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: var(--chat-radius-sm);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; transition: all 0.2s;
}
.notice-modal-close:hover { background: rgba(255,255,255,0.3); }
.notice-modal-body { padding: 18px; }
.notice-modal-body textarea,
.notice-textarea {
    width: 100%;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    padding: 10px 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    max-height: 160px;
    box-sizing: border-box;
    font-family: inherit;
    color: var(--chat-text-1);
    background: var(--chat-bg-2);
    outline: none;
    transition: border-color 0.2s;
}
.notice-modal-body textarea:focus,
.notice-textarea:focus { border-color: var(--chat-primary); box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.notice-textarea {
    display: block;
    margin: 0 18px 0;
}
.notice-modal-foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 0 18px 16px;
}
.notice-cancel-btn {
    padding: 7px 16px;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-sm);
    font-size: 13px; cursor: pointer; color: var(--chat-text-1);
    transition: all 0.2s;
}
.notice-cancel-btn:hover { background: var(--chat-border); }
.notice-submit-btn {
    padding: 7px 16px;
    background: var(--chat-primary);
    border: none;
    border-radius: var(--chat-radius-sm);
    font-size: 13px; cursor: pointer; color: #fff; font-weight: 500;
    transition: all 0.2s;
}
.notice-submit-btn:hover { background: var(--chat-primary-hover); }
.notice-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 公告工具按鈕样式 */
.tool-btn-notice { color: var(--chat-primary) !important; }
.tool-btn-notice:hover { background: rgba(24,144,255,0.08) !important; }

/* 公告栏可点击样式 */
.chat-notice {
    cursor: pointer;
    transition: background 0.2s;
}
.chat-notice:hover {
    background: linear-gradient(135deg, rgba(24,144,255,0.14), rgba(24,144,255,0.08));
}

/* 公告详情弹窗 */
.notice-detail-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100006;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.notice-detail-modal.open {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}
.notice-detail-content {
    width: 420px;
    max-width: 90vw;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.notice-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--chat-primary), #40a9ff);
    color: #fff;
}
.notice-detail-head span {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.notice-detail-body {
    padding: 20px 18px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--chat-text-1);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
    overflow-y: auto;
}

/* 空消息提示 */
.chat-empty-tip {
    text-align: center;
    padding: 40px 20px;
    color: var(--chat-text-3);
    font-size: 14px;
}

/* ========================================
   响应式设计
======================================== */
@media (max-width: 480px) {
    .knn-chat {
        bottom: 16px;
    }
    .knn-chat.pos-right { right: 16px; }
    .knn-chat.pos-left { left: 16px; }
    .chat-box {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        max-height: none;
    }

    /* 底部输入区紧凑 */
    .chat-foot {
        padding: 8px 10px 8px;
    }
    .chat-foot-inner {
        margin-bottom: 6px;
    }
    .chat-foot textarea {
        padding: 7px 10px;
        font-size: 13px;
        min-height: 32px;
    }

    /* 工具栏：隐藏左侧工具按鈕文字，只保留图标 */
    .chat-tools-left .tool-btn span {
        display: none;
    }
    .tool-btn {
        height: 30px;
        padding: 0 6px;
        min-width: 30px;
        justify-content: center;
    }
    .tool-btn i {
        font-size: 15px;
    }
    .tool-btn-voice {
        padding: 0 10px;
        height: 30px;
        font-size: 12px;
    }
    .tool-btn-voice i {
        font-size: 14px;
    }
    /* 发送按鈕稍小 */
    .chat-send-btn,
    .chat-foot button#chat-send {
        height: 30px;
        padding: 0 12px;
        font-size: 12px;
    }

    .msg-red-packet { width: 220px; }
    .msg-image { max-width: 160px; }
    .msg-card { max-width: 200px; }
    .rp-modal-content,
    .rp-detail-content,
    .rp-open-content {
        width: calc(100vw - 32px);
    }
}

/* ========================================
   禁言管理功能样式
======================================== */
/* 禁言管理按钮 */
.tool-btn-ban { color: #ff4d4f !important; }
.tool-btn-ban:hover { background: rgba(255,77,79,0.08) !important; }

/* 禁言管理面板 */
.ban-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100005;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.ban-modal.open { display: flex; animation: modalFadeIn 0.2s ease; }
.ban-modal-content {
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ban-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
    color: #fff;
    flex-shrink: 0;
}
.ban-modal-head span {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ban-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: var(--chat-radius-sm);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; transition: all 0.2s;
}
.ban-modal-close:hover { background: rgba(255,255,255,0.3); }
.ban-modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}

/* 全员禁言开关 */
.ban-global-mute {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255,77,79,0.06);
    border-radius: var(--chat-radius-md);
    margin-bottom: 18px;
    border: 1px solid rgba(255,77,79,0.15);
}
.ban-global-mute-info { display: flex; flex-direction: column; gap: 2px; }
.ban-global-mute-title { font-size: 14px; font-weight: 600; color: var(--chat-text-1); }
.ban-global-mute-desc { font-size: 12px; color: var(--chat-text-3); }

/* 开关样式 */
.ban-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.ban-switch input { opacity: 0; width: 0; height: 0; }
.ban-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--chat-border);
    transition: .3s;
    border-radius: 24px;
}
.ban-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.ban-switch input:checked + .ban-slider { background-color: #ff4d4f; }
.ban-switch input:checked + .ban-slider:before { transform: translateX(20px); }

/* 搜索用户区域 */
.ban-search-section { margin-bottom: 18px; }
.ban-search-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-text-1);
    margin-bottom: 10px;
}
.ban-search-box {
    display: flex;
    gap: 8px;
}
.ban-search-box input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    font-size: 13px;
    background: var(--chat-bg-2);
    color: var(--chat-text-1);
    outline: none;
    transition: border-color 0.2s;
}
.ban-search-box input:focus { border-color: #ff4d4f; }
.ban-search-btn {
    padding: 0 14px;
    background: #ff4d4f;
    border: none;
    border-radius: var(--chat-radius-md);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
.ban-search-btn:hover { background: #ff7875; }
.ban-search-results {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
}

/* 搜索结果项 */
.ban-search-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--chat-radius-sm);
    transition: background 0.15s;
    gap: 10px;
}
.ban-search-item:hover { background: var(--chat-bg-2); }
.ban-search-item-info { flex: 1; min-width: 0; }
.ban-search-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--chat-text-1);
    display: block;
}
.ban-search-item-email {
    font-size: 11px;
    color: var(--chat-text-3);
    display: block;
}
.ban-user-status {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(255,77,79,0.12);
    color: #ff4d4f;
    border-radius: 3px;
    flex-shrink: 0;
}
.ban-action-btn {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-sm);
    font-size: 11px;
    color: var(--chat-text-2);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.ban-action-btn:hover {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

/* 已禁言用户列表 */
.ban-list-section { }
.ban-list-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-text-1);
    margin-bottom: 10px;
}
.ban-list { max-height: 200px; overflow-y: auto; }
.ban-list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--chat-radius-sm);
    background: var(--chat-bg-2);
    margin-bottom: 6px;
    gap: 10px;
}
.ban-list-item-info { flex: 1; min-width: 0; }
.ban-list-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--chat-text-1);
    display: block;
}
.ban-list-item-desc {
    font-size: 11px;
    color: var(--chat-text-3);
    display: block;
}
.ban-unban-btn {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid #52c41a;
    border-radius: var(--chat-radius-sm);
    font-size: 11px;
    color: #52c41a;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ban-unban-btn:hover {
    background: #52c41a;
    color: #fff;
}
.ban-loading, .ban-empty {
    text-align: center;
    padding: 16px;
    color: var(--chat-text-3);
    font-size: 12px;
}

/* 禁言用户操作弹窗 */
.ban-user-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100006;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.ban-user-modal.open { display: flex; animation: modalFadeIn 0.2s ease; }
.ban-user-content {
    width: 340px;
    max-width: 90vw;
    background: var(--chat-bg-1);
    border-radius: var(--chat-radius-lg);
    overflow: hidden;
    box-shadow: var(--chat-shadow-lg);
    animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ban-user-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ff4d4f, #ff7875);
    color: #fff;
}
.ban-user-head span { font-size: 14px; font-weight: 600; }
.ban-user-body { padding: 16px; }
.ban-form-group { margin-bottom: 14px; }
.ban-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--chat-text-2);
    margin-bottom: 6px;
}
.ban-form-group input,
.ban-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-md);
    font-size: 13px;
    background: var(--chat-bg-2);
    color: var(--chat-text-1);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.ban-form-group input:focus,
.ban-form-group select:focus { border-color: #ff4d4f; }
.ban-user-foot {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
    justify-content: flex-end;
}
.ban-cancel-btn {
    padding: 7px 16px;
    background: var(--chat-bg-3);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-sm);
    font-size: 13px;
    cursor: pointer;
    color: var(--chat-text-1);
    transition: all 0.2s;
}
.ban-cancel-btn:hover { background: var(--chat-border); }
.ban-confirm-btn {
    padding: 7px 16px;
    background: #ff4d4f;
    border: none;
    border-radius: var(--chat-radius-sm);
    font-size: 13px;
    cursor: pointer;
    color: #fff;
    font-weight: 500;
    transition: all 0.2s;
}
.ban-confirm-btn:hover { background: #ff7875; }
.ban-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 操作提示 */
.ban-tip {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #52c41a;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--chat-radius-md);
    font-size: 13px;
    z-index: 100010;
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(82,196,26,0.4);
}
.ban-tip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ban-tip i { margin-right: 6px; }

/* 禁言状态 - 输入框禁用 */
#chat-input:disabled {
    background: var(--chat-bg-3);
    color: var(--chat-text-4);
    cursor: not-allowed;
    opacity: 0.7;
}
#chat-input:disabled::placeholder {
    color: var(--chat-error);
    opacity: 0.8;
}
#chat-send.disabled,
#chat-send:disabled {
    background: var(--chat-bg-3) !important;
    color: var(--chat-text-4) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 右键禁言菜单 */
#ban-context-menu {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#ban-context-menu .ban-menu-header {
    user-select: none;
}
#ban-context-menu .ban-menu-item:last-child {
    border-top: 1px solid #eee;
    margin-top: 4px;
    padding-top: 12px;
}

/* 系统消息样式 */
.chat-msg.system {
    display: block;
    text-align: center;
    margin: 12px 0;
}
.chat-msg.system .system-msg {
    display: inline-block;
    background: rgba(0, 0, 0, 0.05);
    color: var(--chat-text-3);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 12px;
    max-width: 80%;
    word-break: break-word;
}
.dark-theme .chat-msg.system .system-msg {
    background: rgba(255, 255, 255, 0.08);
    color: var(--chat-text-3);
}
