.wp-chatroom {
    max-width: 800px;
    margin: 10px auto;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 90vh;
}

.wp-chatroom h3 {
    padding: 15px;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid #eaeaea;
    font-size: 16px;
    color: #333;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(240, 240, 240, 0.9);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

/* 用户名样式 */
.chat-message .username {
    color: #666;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* 消息内容样式 */
.chat-message .message-content {
    flex: 1;
    color: #333;
    margin: 0 8px;
}

/* 时间样式 */
.chat-message .time {
    color: #999;
    font-size: 12px;
    white-space: nowrap;
}

/* 自己发送的消息 */
.chat-message.self-message {
    background: rgba(220, 248, 198, 0.9);
}

/* 管理员消息 */
.chat-message.admin-message .username::after {
    content: '管理员';
    background: #ff6b6b;
    color: white;
    font-size: 12px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
}

/* 水军消息标签 - 默认隐藏 */
.chat-message.bot-message .username::after {
    content: '水军';
    background: #8e44ad;
    color: white;
    font-size: 12px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    display: none; /* 默认隐藏 */
}

/* 仅管理员可见水军标签 */
.admin-view .chat-message.bot-message .username::after {
    display: inline-block; /* 管理员视图下显示 */
}

/* 红包消息样式 */
.chat-message.red-packet {
    background: linear-gradient(135deg, #ff4444 0%, #ff6b6b 100%);
    color: white;
    cursor: pointer;
}

.chat-message.red-packet .username,
.chat-message.red-packet .time {
    color: rgba(255, 255, 255, 0.9);
}

.red-packet-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 8px;
}

.red-packet-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.red-packet-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.red-packet-info {
    flex: 1;
}

.red-packet-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.red-packet-desc {
    font-size: 12px;
    opacity: 0.9;
}

/* 系统消息样式 */
.chat-system-message {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin: 8px 0;
    padding: 4px 0;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-message {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .chat-message .username {
        font-size: 12px;
    }
    
    .chat-message .time {
        font-size: 11px;
    }
}

.chat-input {
    padding: 12px;
    border-top: 1px solid #eaeaea;
    display: flex;
    gap: 8px;
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #eaeaea;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
}

.chat-input input:focus {
    border-color: #007bff;
}

.chat-input button {
    padding: 0 20px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.chat-input button:hover {
    background: #0056b3;
}

/* 红包按钮样式 */
.send-red-packet-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 5px;
    margin-left: 5px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-red-packet-btn .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff4444;
}

.red-packet {
    background: #ff4444 !important;
    color: #fff !important;
    cursor: pointer;
    position: relative;
    padding: 15px !important;
    border-radius: 8px;
    animation: redPacketAppear 0.3s ease-out;
}

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

.quick-messages {
    padding: 10px;
    border-top: 1px solid #eaeaea;
    background: #fff;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    bottom: 60px;
    z-index: 9;
}

.quick-message-btn {
    margin: 0;
    padding: 8px 15px;
    background: #f0f2f5;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: background-color 0.3s;
}

.quick-message-btn:hover {
    background: #e4e6eb;
}

.wp-chatroom-login-notice {
    padding: 20px;
    text-align: center;
    color: #666;
    background: #f8f9fa;
    border-radius: 12px;
}

/* 已领取的红包样式 */
.chat-message.red-packet.claimed {
    background: linear-gradient(135deg, #666666 0%, #444444 100%);
}

.chat-message.red-packet.claimed .red-packet-desc {
    color: #ccc;
}

/* 悬浮聊天窗口样式 */
.floating-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 400px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.floating-chat.active {
    display: flex;
}

.floating-chat .chat-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.floating-chat .chat-header h3 {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.floating-chat .chat-header .minimize-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.floating-chat .chat-header .minimize-btn:hover {
    opacity: 1;
}

.floating-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

.floating-chat .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.floating-chat .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.floating-chat .chat-message {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    animation: messageAppear 0.3s ease;
}

.floating-chat .chat-message .username {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-bottom: 4px;
    display: block;
}

.floating-chat .chat-message .time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    float: right;
    margin-left: 8px;
}

.floating-chat .chat-message.self-message {
    background: rgba(var(--primary-color-rgb), 0.3);
    margin-left: auto;
}

.floating-chat .chat-message.admin-message {
    background: rgba(255, 193, 7, 0.2);
}

/* 红包消息在悬浮窗中的样式 */
.floating-chat .chat-message.red-packet {
    background: linear-gradient(135deg, #ff4444 0%, #ff6b6b 100%);
    color: #fff;
    padding: 12px;
}

.floating-chat .red-packet-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.floating-chat .red-packet-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.floating-chat .red-packet-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.floating-chat .red-packet-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.floating-chat .red-packet-desc {
    font-size: 12px;
    opacity: 0.8;
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    .floating-chat {
        width: 280px;
        height: 360px;
        bottom: 16px;
        right: 16px;
    }

    .floating-chat .chat-message {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* 最小化状态 */
.floating-chat.minimized {
    height: 40px;
    width: 40px;
    border-radius: 20px;
    cursor: pointer;
}

.floating-chat.minimized .chat-messages,
.floating-chat.minimized .chat-header h3 {
    display: none;
}

.floating-chat.minimized .chat-header {
    padding: 8px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-chat.minimized .minimize-btn {
    transform: rotate(180deg);
}

/* 深色模式样式 */
.wp-chatroom.dark-mode {
    background-color: #222;
    color: #eee;
    border-color: #444;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.wp-chatroom.dark-mode h3 {
    background-color: #222;
    color: #eee;
    border-color: #444;
}

.wp-chatroom.dark-mode .chat-messages {
    background-color: #333;
}

.wp-chatroom.dark-mode .chat-message {
    background: rgba(60, 60, 60, 0.9);
}

.wp-chatroom.dark-mode .chat-message .username {
    color: #aaa;
}

.wp-chatroom.dark-mode .chat-message .message-content {
    color: #ddd;
}

.wp-chatroom.dark-mode .chat-message .time {
    color: #888;
}

.wp-chatroom.dark-mode .chat-message.self-message {
    background: rgba(50, 70, 40, 0.9);
}

.wp-chatroom.dark-mode .chat-system-message {
    color: #888;
}

.wp-chatroom.dark-mode .chat-input {
    background-color: #222;
    border-color: #444;
}

.wp-chatroom.dark-mode .chat-input input {
    background-color: #333;
    color: #eee;
    border-color: #555;
}

.wp-chatroom.dark-mode .chat-input input:focus {
    border-color: #0078d7;
}

.wp-chatroom.dark-mode .chat-input button {
    background-color: #0078d7;
}

.wp-chatroom.dark-mode .chat-input button:hover {
    background-color: #0063b1;
}

.wp-chatroom.dark-mode .quick-messages {
    background-color: #222;
    border-color: #444;
}

.wp-chatroom.dark-mode .quick-message-btn {
    background-color: #333;
    color: #ddd;
}

.wp-chatroom.dark-mode .quick-message-btn:hover {
    background-color: #444;
}

.wp-chatroom.dark-mode .wp-chatroom-login-notice {
    background-color: #333;
    color: #aaa;
}

/* 深色模式下滚动条样式 */
.wp-chatroom.dark-mode .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* 滚动条样式优化 */
.wp-chatroom.modern-theme .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.wp-chatroom.modern-theme .chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.wp-chatroom.modern-theme .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* 快捷消息样式 */
.wp-chatroom.modern-theme .quick-messages {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.wp-chatroom.modern-theme .quick-message-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
}

.wp-chatroom.modern-theme .quick-message-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 现代主题样式 */
.wp-chatroom.modern-theme {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    color: #000000;  /* 添加白色文本颜色 */
}

.wp-chatroom.modern-theme h3 {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
}

.wp-chatroom.modern-theme .chat-messages {
    background: transparent;
}

.wp-chatroom.modern-theme .chat-message {
    background: transparent;  /* 移除背景色，改为完全透明 */
    backdrop-filter: none;    /* 移除模糊效果 */
    -webkit-backdrop-filter: none;
    /* border: 1px solid rgba(255, 255, 255, 0.15);  保留边框但略微调整透明度 */
    font-size: 16px;
    padding: 10px 15px;
    font-weight: 500;
}

.wp-chatroom.modern-theme .chat-message.self-message {
    background: transparent;  /* 移除自己消息的背景色 */
    border-color: rgba(0, 123, 255, 0.25);  /* 保留蓝色边框以区分自己的消息 */
}

.wp-chatroom.modern-theme .chat-message .username {
    color:#f0440f;
    font-size: 15px;
    font-weight: 600;  /* 增加用户名字重 */
}

.wp-chatroom.modern-theme .chat-message .message-content {
    color: #e8770e;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;  /* 增加消息内容字重 */
}

.wp-chatroom.modern-theme .chat-message .time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.wp-chatroom.modern-theme .chat-system-message {
    color: rgba(255, 255, 255, 0.7);
}

.wp-chatroom.modern-theme .chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}