/**
 * 陶小站科技（吉林）有限公司
 * 版权所有 © 2025
 * 
 * 文件名：chat.css
 * 描述：聊天室样式文件 - 仿QQ风格设计
 * 版本：2.0
 * 最后更新：2025-10-31
 */

/* ==================== 全局样式 ==================== */

/* 重置默认样式 */
 *, ::before, ::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Remix Icon 图标优化 */
i[class^="ri-"], i[class*=" ri-"] {
    font-style: normal;
    vertical-align: middle;
    line-height: 1;
    display: inline-block;
}

/* 定义CSS变量（亮色主题） */
:root {
    /* 主色调 */
    --primary-color: #07c160;
    --primary-light: #4cd787;
    --primary-dark: #05a850;
    
    /* 背景色 */
    --bg-color: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-hover: #f0f0f0;
    
    /* 文字颜色 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    
    /* 消息气泡颜色 */
    --bubble-self: #95ec69;
    --bubble-other: #ffffff;
    --bubble-system: #e8e8e8;
    
    /* 边框颜色 */
    --border-color: #e6e6e6;
    --border-dark: #d0d0d0;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* 过渡动画 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 暗色主题 */
body.dark-theme {
    --bg-color: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --bg-hover: #3a3a3a;
    
    --text-primary: #e8e8e8;
    --text-secondary: #b8b8b8;
    --text-light: #888888;
    
    --bubble-self: #07c160;
    --bubble-other: #3a3a3a;
    --bubble-system: #2d2d2d;
    
    --border-color: #3a3a3a;
    --border-dark: #4a4a4a;
}

/* HTML和Body基础设置 */
html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", 
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: var(--transition);
}

/* 主容器 */
body {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-color);
    position: relative;
}

/* ==================== 顶部导航栏 ==================== */

.top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: 800px;
    margin: 0 auto;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.top .logo {
    font-size: 24px;
    margin-right: 8px;
}

.top .name {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.online-count {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    margin-right: 8px;
    transition: var(--transition);
    user-select: none;
    background: var(--bg-hover);
}

.online-count:hover {
    background: var(--primary-light);
    color: #fff;
    transform: scale(1.05);
}

.theme-toggle {
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    user-select: none;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ==================== 登录界面 ==================== */

.login {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 9999;
    overflow: auto;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 420px;
    text-align: center;
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@keyframes slideIn {
    from {
	opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    font-size: 64px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.login-box h2 {
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.5px;
}

.login-box .subtitle {
    margin-bottom: 30px;
    font-size: 14px;
    color: #7f8c8d;
}

.login-box .input-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-box .input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.login-box input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8ecef;
    border-radius: 12px;
    font-size: 15px;
    background: #f8f9fa;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.login-box input:focus {
    outline: none;
    border-color: #07c160;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.08);
    transform: translateY(-2px);
}

.login-box input::placeholder {
    color: #adb5bd;
}

.login-box .login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #07c160 0%, #05a850 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(7, 193, 96, 0.3);
}

.login-box .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(7, 193, 96, 0.4);
}

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

.login-box .tips {
    margin-top: 20px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    font-size: 12px;
    color: #856404;
    text-align: left;
}

.login-box .error-tip {
    margin-top: 10px;
    padding: 10px;
    background: #ffe5e5;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    font-size: 13px;
    color: #d63031;
    display: none;
}

.login-box .error-tip.show {
    display: block;
    animation: shake 0.5s ease;
}

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

/* ==================== 聊天消息区域 ==================== */

.mk-chat-box {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 135px;
    max-width: 800px;
    margin: 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: var(--bg-color);
    scroll-behavior: smooth;
}

/* 消息容器 */
.mk-chat-box .msg {
    margin: 12px 0;
    position: relative;
    min-height: 40px;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
    gap: 0;
}

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

/* 右侧消息（自己发送的） */
.mk-chat-box .right {
    flex-direction: row-reverse;
    margin-left: 64px;
}

/* 左侧消息（他人发送的） */
.mk-chat-box .left {
    flex-direction: row;
    margin-right: 64px;
}

/* 头像样式 */
.mk-chat-box img.head {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    user-select: none;
    transition: var(--transition);
    /* 让头像与消息气泡顶部对齐，而不是和用户名对齐 */
    /* 用户名高度：font-size(12px) * line-height(1.4) + margin-bottom(4px) ≈ 21px */
    margin-top: calc(12px * 1.4 + 4px);
    align-self: flex-start;
}

.mk-chat-box img.head:hover {
    transform: scale(1.1);
}

.mk-chat-box .right img.head {
    margin-left: 12px;
}

.mk-chat-box .left img.head {
    margin-right: 12px;
}

/* 消息内容包装器 */
.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    flex: 1;
    min-width: 0;
}

.mk-chat-box .right .msg-wrapper {
    align-items: flex-end;
}

.mk-chat-box .left .msg-wrapper {
    align-items: flex-start;
}

/* 昵称显示 */
.mk-chat-box .name {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
    position: relative;
    display: inline-block;
    line-height: 1.4;
}

/* 右侧消息的昵称（右对齐） */
.mk-chat-box .right .name {
    text-align: right;
    padding-right: 0;
    padding-left: 8px;
}

/* 左侧消息的昵称（左对齐） */
.mk-chat-box .left .name {
    text-align: left;
    padding-left: 0;
    padding-right: 8px;
}

/* 撤回按钮 */
.recall-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    user-select: none;
    vertical-align: middle;
    line-height: 1.2;
}

.recall-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

body.dark-theme .recall-btn {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .recall-btn:hover {
    background: var(--primary-color);
}

/* ==================== 撤回消息样式（QQ风格） ==================== */

/* 已撤回消息容器 */
.msg.recalled .content {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* 撤回消息文本容器 */
.recalled-msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 撤回图标 */
.recalled-icon {
    font-size: 14px;
    opacity: 0.7;
}

/* 撤回文本 */
.recalled-text {
    color: var(--text-light);
    font-size: 13px;
}

/* 自己撤回的消息样式 */
.recalled-msg.recalled-self {
    background: rgba(149, 236, 105, 0.2);
}

/* 管理员撤回的消息（红色警告样式） */
.recalled-msg:has(.recalled-icon:contains("🚫")) {
    background: rgba(255, 76, 76, 0.1);
}

.recalled-msg:has(.recalled-icon:contains("🚫")) .recalled-text {
    color: #ff4c4c;
}

/* 暗色主题下的撤回消息 */
body.dark-theme .recalled-msg {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .recalled-msg.recalled-self {
    background: rgba(149, 236, 105, 0.15);
}

body.dark-theme .recalled-text {
    color: rgba(255, 255, 255, 0.5);
}

/* 撤回消息动画效果 */
.msg.recalled {
    animation: recallFade 0.3s ease-in-out;
}

@keyframes recallFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== 消息气泡容器 ==================== */

/* 消息气泡容器 */
.mk-chat-box .content {
    word-break: break-all;
    word-wrap: break-word;
    position: relative;
    display: inline-block;
    font-size: 15px;
    padding: 10px 14px;
    line-height: 1.6;
    border-radius: var(--radius-md);
    max-width: 100%;
    width: fit-content;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

/* 右侧消息气泡（自己发送的） */
.mk-chat-box .right .content {
    background: var(--bubble-self);
    color: #000;
    border-top-right-radius: 4px;
}

/* 左侧消息气泡（他人发送的） */
.mk-chat-box .left .content {
    background: var(--bubble-other);
    color: var(--text-primary);
    border-top-left-radius: 4px;
    border: 1px solid var(--border-color);
}

/* 消息气泡箭头 */
.mk-chat-box .content::before {
    content: "";
    position: absolute;
    top: 10px;
    width: 0;
    height: 0;
    border-style: solid;
}

.mk-chat-box .right .content::before {
    right: -8px;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent var(--bubble-self);
}

.mk-chat-box .left .content::before {
    left: -8px;
    border-width: 6px 8px 6px 0;
    border-color: transparent var(--bubble-other) transparent transparent;
}

body.dark-theme .mk-chat-box .left .content::before {
    border-color: transparent var(--bubble-other) transparent transparent;
}

/* 消息中的图片 */
.mk-chat-box .content img,
.mk-chat-box .content .chat-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
    margin: 4px 0;
    cursor: pointer;
    transition: var(--transition);
}

.mk-chat-box .content img:hover,
.mk-chat-box .content .chat-image:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* 消息中的视频 */
.mk-chat-box .content video {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 4px 0;
}

/* 消息中的链接 */
.mk-chat-box .content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid var(--primary-light);
}

.mk-chat-box .content a:hover {
    color: var(--primary-dark);
}

/* @提醒样式 */
.mk-chat-box .content .mention {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(7, 193, 96, 0.15);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.mk-chat-box .content .mention:hover {
    background: rgba(7, 193, 96, 0.25);
    transform: scale(1.05);
}

body.dark-theme .mk-chat-box .content .mention {
    background: rgba(7, 193, 96, 0.2);
}

body.dark-theme .mk-chat-box .content .mention:hover {
    background: rgba(7, 193, 96, 0.3);
}

/* ==================== 系统提示消息 ==================== */

.mk-chat-box .tips {
    margin: 16px 0;
    text-align: center;
    font-size: 12px;
    animation: fadeIn 0.3s ease;
}

.mk-chat-box .tips span {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bubble-system);
    color: var(--text-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.mk-chat-box .tips .tips-primary {
    background: #428bca;
    color: #fff;
}

.mk-chat-box .tips .tips-success {
    background: #07c160;
    color: #fff;
}

.mk-chat-box .tips .tips-info {
    background: #5bc0de;
    color: #fff;
}

.mk-chat-box .tips .tips-warning {
    background: #f0ad4e;
    color: #fff;
}

.mk-chat-box .tips .tips-danger {
    background: #d9534f;
    color: #fff;
}

/* ==================== 输入区域 ==================== */

.talk.write {
    position: fixed;
    bottom: 2px;
    left: 0;
    right: 0;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 10000;
    padding-bottom: 12px;
}

.input-container {
    padding: 12px 16px;
}

/* 禁言通知 */
.silence-notice {
    padding: 8px 16px;
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    border-bottom: 1px solid #ffc107;
    margin-bottom: 8px;
}

.silence-notice-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #856404;
    font-size: 13px;
    font-weight: 500;
}

.silence-notice-content i {
    font-size: 16px;
    color: #ff4c4c;
}

body.dark-theme .silence-notice {
    background: rgba(255, 193, 7, 0.15);
    border-top-color: #ffc107;
    border-bottom-color: #ffc107;
}

body.dark-theme .silence-notice-content {
    color: #ffc107;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.tool-btn {
    padding: 8px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.tool-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

/* 输入框区域 */
.input-container textarea {
    width: calc(100% - 80px);
    min-height: 60px;
    max-height: 120px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition);
    float: left;
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

/* 发送按钮 */
.send {
    float: right;
    width: 70px;
    height: 60px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.send:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.send.disabled {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== 在线用户列表 ==================== */

.online-panel {
    position: fixed;
    top: 56px;
    right: 0;
    width: 280px;
    max-width: 90%;
    height: calc(100% - 56px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    animation: slideInRight 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.online-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.online-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-secondary);
    user-select: none;
}

.close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.online-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.online-user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.online-user-item:hover {
    background: var(--bg-hover);
}

.online-user-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid var(--border-color);
}

.online-user-info {
    flex: 1;
}

.online-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.online-user-status {
    font-size: 12px;
    color: var(--text-light);
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

/* ==================== 表情面板 ==================== */

.emoji-panel {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    max-height: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

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

.emoji-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    padding: 16px;
}

.emoji-item {
    font-size: 24px;
    text-align: center;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* ==================== 页脚 ==================== */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 800px;
    margin: 0 auto;
    padding: 8px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    display: none; /* 默认隐藏，登录后显示 */
}

/* ==================== 滚动条美化 ==================== */

.mk-chat-box::-webkit-scrollbar,
.emoji-panel::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.mk-chat-box::-webkit-scrollbar-track,
.emoji-panel::-webkit-scrollbar-track {
    background: transparent;
}

.mk-chat-box::-webkit-scrollbar-thumb,
.emoji-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.mk-chat-box::-webkit-scrollbar-thumb:hover,
.emoji-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-theme .mk-chat-box::-webkit-scrollbar-thumb,
body.dark-theme .emoji-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-theme .mk-chat-box::-webkit-scrollbar-thumb:hover,
body.dark-theme .emoji-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 600px) {
    .top {
        height: 50px;
        padding: 0 12px;
    }
    
    .top .name {
        font-size: 16px;
    }
    
    .mk-chat-box {
        top: 50px;
        bottom: 160px;
        padding: 12px;
    }
    
    .talk.write {
        bottom: 8px;
        padding-bottom: 8px;
    }
    
    .mk-chat-box .right {
        margin-left: 40px;
    }
    
    .mk-chat-box .left {
        margin-right: 40px;
    }
    
    .mk-chat-box img.head {
        width: 36px;
        height: 36px;
    }
    
    .input-container {
        padding: 8px 12px;
    }
    
    .input-container textarea {
        min-height: 50px;
    }
    
    .send {
        height: 50px;
        width: 60px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
}

/* ==================== 图片预览（全屏） ==================== */

.image-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-preview-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.image-preview-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* ==================== 加载动画 ==================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(7, 193, 96, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 辅助类 ==================== */

.hidden {
    display: none !important;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 防止文本选择（用户体验优化） */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 平滑滚动 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* ==================== 切换房间功能 ==================== */

.switch-room-btn {
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: transparent;
    transition: var(--transition);
    user-select: none;
    margin-right: 8px;
}

.switch-room-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.switch-room-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.switch-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.switch-room-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.switch-room-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

.switch-room-content .input-group {
    padding: 24px;
}

.switch-room-content .input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.switch-room-content input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.switch-room-content input:focus {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.switch-btn {
    width: calc(100% - 48px);
    margin: 0 24px 24px 24px;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.switch-btn i {
    color: white;
    transition: all 0.3s ease;
}

.switch-btn:hover {
    background: var(--primary-dark);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.switch-btn:hover i {
    color: white !important;
}

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

.switch-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

#switchErrorTip {
    padding: 0 24px 16px 24px;
    font-size: 13px;
    color: var(--danger-color);
}

/* 当前房间信息 */
.current-room-info {
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.current-room-info .info-label {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.current-room-info .info-value {
    font-size: 18px;
    font-weight: 600;
    padding-left: 22px;
}

/* 切换房间区域 */
.switch-room-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary-color);
}

.switch-room-section .input-group {
    padding: 0;
    margin-bottom: 16px;
}

.switch-room-section .switch-btn {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.switch-room-section .switch-btn i {
    color: inherit;
}

/* 退出房间区域 */
.exit-room-section {
    padding: 24px;
    background: var(--bg-color);
}

.exit-tip {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    padding: 12px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--warning-color);
    border-radius: var(--radius-sm);
}

.exit-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.exit-btn i {
    color: inherit;
    transition: all 0.3s ease;
}

.exit-btn:hover {
    background: var(--danger-color);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.exit-btn:hover i {
    color: white !important;
}

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

/* ==================== HLS视频播放器样式 ==================== */

/* 视频容器 */
.hls-video-wrapper {
    display: inline-block !important;
    max-width: 100%;
    margin: 8px 0;
    vertical-align: top;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.hls-video-wrapper:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 视频播放器 */
.hls-video-player {
    display: block !important;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: var(--radius-md);
    outline: none;
    object-fit: contain;
}

/* 视频加载状态 */
.hls-video-player:not([data-hls-initialized]) {
    opacity: 0.5;
    cursor: wait;
}

.hls-video-player[data-hls-initialized="true"] {
    opacity: 1;
    cursor: pointer;
}

/* 视频控制条样式优化 */
.hls-video-player::-webkit-media-controls-panel {
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .hls-video-wrapper {
        max-width: 100% !important;
        margin: 4px 0;
    }
    
    .hls-video-player {
        height: auto !important;
        max-height: 300px;
    }
}

/* 消息内容区域的视频样式 */
.content .hls-video-wrapper {
    display: inline-block !important;
    vertical-align: top !important;
    max-width: 100% !important;
}

/* 确保视频在消息气泡中正确显示 */
.msg .content {
    display: block !important;
    overflow: visible !important;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
}

/* 防止视频导致布局错误 */
.msg-wrapper {
    max-width: 100%;
    overflow: visible;
}

.left .content .hls-video-wrapper,
.right .content .hls-video-wrapper {
    display: block !important;
    margin: 4px 0;
}

/* 视频标题样式 */
.hls-video-wrapper > span:last-child {
    display: block;
    padding: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* 暗黑模式下的视频样式 */
[data-theme="dark"] .hls-video-wrapper {
    background: #1a1a1a;
}

[data-theme="dark"] .hls-video-wrapper > span:last-child {
    background: #2a2a2a;
    color: var(--text-light);
}
