/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    direction: ltr;
    text-align: left;
}

/* 移动设备通用样式 */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* 禁用文本选择，改善触摸体验 */
button, input, select, textarea {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 触摸优化按钮 */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

/* Room control interface */
.room-control {
    text-align: center;
    padding: 40px 20px;
}

.room-input-group {
    margin-bottom: 20px;
    margin-top: 20px;
}

#roomIdInput {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* 全屏网址容器样式 */
.fullscreen-url-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 1000; /* 确保在最顶层 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.room-url-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* 管理员控制样式 */
.admin-controls {
  position: absolute;
  top: 70px;
  right: 20px;
  display: none; /* 默认隐藏 */
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px;
  border-radius: 10px;
  width: 300px;
  z-index: 1000;
  max-height: 60vh;
  overflow-y: auto;
}

/* 房间监控区域样式 */
.admin-monitor-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.admin-monitor-section h4 {
  margin: 0 0 10px 0;
  color: #4CAF50;
}

.admin-monitor-section .btn-primary {
  width: 100%;
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.admin-monitor-section .btn-primary:hover {
  background-color: #45a049;
}

/* 管理员控制面板网址设置样式 */
.url-settings {
  margin-top: 20px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.setting-group {
  margin-bottom: 15px;
}

.setting-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.setting-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 10px;
}

.current-url-info {
  font-size: 14px;
  color: #888;
}

.admin-controls h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #667eea;
}

.admin-controls .user-list {
    max-height: 300px;
    overflow-y: auto;
}

.admin-controls .user-item {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-controls .control-buttons {
    display: flex;
    gap: 5px;
}

.admin-controls button {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.admin-controls button:hover {
    background: #5a67d8;
}

.admin-controls button.secondary {
    background: #4a5568;
}

/* 录制控制样式 */
.recording-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.recording-controls h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #667eea;
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========== 响应式媒体查询 ========== */

/* 移动设备 (小于 768px) */
@media (max-width: 767px) {
    /* 性能优化：减少重绘和重排 */
    * {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* 容器调整 */
    .container {
        max-width: 100%;
        padding: 10px;
    }
    
    /* 登录页面适配 */
    body.login-page {
        padding: 20px;
    }
    
    .container {
        padding: 20px;
        width: 100%;
        max-width: none;
    }
    
    .container h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    /* 按钮大小调整 */
    button, .btn-primary, .btn-secondary, .control-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
        height: 32px !important;
        min-width: 50px !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        /* 移动端按钮优化 */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        will-change: transform;
    }
    
    /* 输入框适配 */
    input, select, textarea {
        font-size: 16px;
        padding: 12px;
        width: 100%;
        /* 防止iOS缩放 */
        font-size: 16px !important;
    }
    
    /* 管理员控制面板适配 */
    .admin-controls {
        width: 100%;
        right: 0;
        left: 0;
        top: 60px;
        border-radius: 0;
        /* 优化滚动性能 */
        -webkit-overflow-scrolling: touch;
    }
    
    /* 房间控制适配 */
    .room-control {
        padding: 20px 10px;
    }
    
    /* 模态框适配 */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
        /* 优化滚动性能 */
        -webkit-overflow-scrolling: touch;
    }
    
    /* 表格适配 */
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    /* 隐藏部分不重要的元素 */
    .hidden-mobile {
        display: none !important;
    }
    
    /* 视频容器优化 */
    video {
        max-width: 100%;
        height: auto;
        /* 硬件加速 */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* 减少阴影效果提升性能 */
    .container, .modal-content, button {
        box-shadow: none !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* 禁用不必要的动画 */
    * {
        animation-duration: 0.01ms !important;
        animation-delay: 0.01ms !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0.01ms !important;
    }
}

/* 小屏幕平板 (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 15px;
    }
    
    .admin-controls {
        width: 280px;
    }
}

.recording-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.recording-btn:hover {
    background: #45a049;
}

.recording-btn.recording-active {
    background: #f44336;
    animation: pulse 1.5s infinite;
}

.recording-btn.recording-active:hover {
    background: #da190b;
}

.recording-duration {
    color: #e2e8f0;
    font-size: 14px;
    text-align: center;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

.admin-controls button.secondary:hover {
    background: #2d3748;
}

#roomIdInput:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.room-hint {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}

.room-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Button styles */
.btn-primary {
    background-color: #0099ff !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.3s !important;
    font-size: 12px !important;
    height: 32px !important;
    min-width: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.btn-primary:hover {
    background-color: #007acc !important;
}

.btn-primary:disabled {
    background-color: #94a3b8 !important;
    cursor: not-allowed !important;
}

.btn-secondary {
    background-color: #0099ff !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.3s !important;
    font-size: 12px !important;
    height: 32px !important;
    min-width: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.btn-secondary:hover {
    background-color: #007acc !important;
}

.user-info {
    position: fixed;
    top: 10px;
    right: 20px;
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-logout {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 5px 12px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.btn-logout:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Top control bar */
.top-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.left-control,
.center-control,
.right-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-control {
    background-color: #64748b;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-control:hover {
    background-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn-control.active {
    background-color: #2563eb;
}

.btn-control.active:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#copyLink,
#leaveBtn {
    background-color: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

#copyLink:hover,
#leaveBtn:hover {
    background-color: #f1f5f9;
}

#cinemaBtn,
#chatRoomBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#cinemaBtn:hover,
#chatRoomBtn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

#cinemaBtn:active,
#chatRoomBtn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 电影院按钮居中容器 */
.cinema-button-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    min-height: 60vh;
    width: 100%;
}

/* 聊天室固定按钮 */
.chat-room-fixed-btn {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 9999;
}

.chat-room-fixed-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateX(-50%) translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.chat-room-fixed-btn:active {
    transform: translateX(-50%) translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 大尺寸电影院按钮 */
.cinema-large-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 80px 160px;
    font-size: 64px;
    font-weight: 700;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 16px 60px rgba(102, 126, 234, 0.5);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 4px;
}

.cinema-large-button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-10px) scale(1.04);
    box-shadow: 0 24px 80px rgba(102, 126, 234, 0.7);
}

.cinema-large-button:active {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 60px rgba(102, 126, 234, 0.5);
}

/* 电影院提示框 */
.cinema-notice {
    margin-top: 20px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: bold;
    color: #dc2626 !important;
    text-align: center;
    line-height: 1.5;
    max-width: 90%;
    width: auto;
    background: rgba(220, 38, 38, 0.05);
    border: 2px solid #dc2626;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

/* 移动端提示框样式 */
@media (max-width: 768px) {
    .cinema-notice {
        font-size: 12px;
        padding: 10px 15px;
        max-width: 95%;
        border-radius: 6px;
        line-height: 1.4;
    }
}

/* 小屏幕手机样式 */
@media (max-width: 480px) {
    .cinema-notice {
        font-size: 11px;
        padding: 8px 12px;
        max-width: 98%;
        border-radius: 4px;
        line-height: 1.3;
    }
}

/* 未读消息徽章 */
.unread-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53e3e;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Video area */
.video-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.video-container {
    position: relative;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.video-container:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
    background-color: #000;
}

.username-label {
    background-color: #2563eb;
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: 14px;
}

.remote-videos {
    display: contents;
}

/* Fullscreen video */
.video-fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#fullscreenVideo {
    max-width: 90%;
    max-height: 90%;
}

.btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.btn-close:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Bottom area */
.bottom-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.chat-area,
.whiteboard-area {
    flex: 1;
    min-width: 300px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    position: relative;
}

.chat-window {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.chat-window .chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    max-width: 100%;
}

.chat-window .chat-message.self {
    flex-direction: row-reverse;
}

.chat-window .chat-message.other {
    flex-direction: row;
}

.chat-window .chat-message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    margin: 0 10px;
}

.chat-window .chat-message .bubble {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    max-width: 70%;
    word-wrap: break-word;
}

.chat-window .chat-message.self .bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-window .chat-message.other .bubble {
    background: white;
    color: #1a202c;
}

.chat-window .chat-message .sender {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #4a5568;
}

.chat-window .chat-message.self .sender {
    text-align: right;
}

.chat-window .chat-message .time {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 4px;
}

.chat-window .chat-message .content {
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-window .chat-message .content img:not(.message-emoji) {
    max-width: 100%;
    border-radius: 8px;
}

.chat-window .chat-message .content video {
    max-width: 100%;
    border-radius: 8px;
}

.chat-input {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#chat-input {
    flex: 4;
    width: 300px;
    padding: 12px 16px !important;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-size: 16px !important;
    min-height: 30px !important;
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
}

#chat-send {
    padding: 4px 10px !important;
    font-size: 13px !important;
    min-height: 30px !important;
    white-space: nowrap !important;
    width: auto;
    min-width: 50px;
}

#chat-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* 聊天消息气泡样式 */
.message-bubble {
    display: flex;
    margin: 10px;
    max-width: 70%;
    flex-direction: column;
}

.self-message {
    align-self: flex-end;
    margin-left: auto;
}

.self-message .message-content {
    background-color: #95ec69;
    /* 微信风格绿色 */
    color: #000;
    border-radius: 8px 8px 0 8px;
    padding: 8px 12px;
    position: relative;
}

.self-message .message-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: -8px;
    border-left: 8px solid #95ec69;
    border-bottom: 8px solid transparent;
}

.other-message {
    align-self: flex-start;
    margin-right: auto;
}

.other-message .message-content {
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px 8px 8px 0;
    padding: 8px 12px;
    position: relative;
}

.other-message .message-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -8px;
    border-right: 8px solid #ffffff;
    border-bottom: 8px solid transparent;
    border-right-color: #ffffff;
    border-left-color: transparent;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.self-message .message-header {
    flex-direction: row-reverse;
    /* 自己消息反转用户名和时间 */
}

.message-header .username {
    font-weight: bold;
    color: #1e293b;
}

.self-message .username {
    color: #000;
}

.message-header .timestamp {
    color: #64748b;
}

.message-text {
    font-size: 14px;
    word-break: break-word;
}

.message-content {
}

.system-message {
    margin: 10px auto;
    padding: 6px 12px;
    background-color: #dfe4ea;
    color: #1e293b;
    border-radius: 12px;
    font-size: 12px;
    text-align: center;
    max-width: 80%;
    display: inline-block;
}

/* Whiteboard area */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn-tool {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.btn-tool:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#whiteboard {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 100%;
}

/* Member list */
.member-list {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    min-width: 150px;
}

.member-header {
    padding: 10px;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.members {
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.member-item {
    padding: 5px 10px;
    background-color: #e2e8f0;
    margin: 5px 0;
    border-radius: 4px;
}

/* Prompt overlay */
.prompt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.prompt-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.prompt-title {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #1e293b;
}

.prompt-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.prompt-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.prompt-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

#adminChatModal .modal-content {
    position: fixed !important;
    top: 10% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 70vh !important;
    min-width: 300px !important;
    min-height: 400px !important;
    background: white !important;
    border-radius: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    cursor: move !important;
}

#adminChatModal .modal-header {
    cursor: move !important;
    user-select: none !important;
}

#adminChatModal .modal-content.dragging {
    opacity: 0.8 !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4) !important;
}

@media (max-width: 768px) {
    #adminChatModal .modal-content {
        width: 95% !important;
        max-width: none !important;
        top: 5% !important;
        max-height: 85vh !important;
        min-height: 300px !important;
    }
}

@media (max-width: 480px) {
    #adminChatModal .modal-content {
        width: 98% !important;
        top: 2% !important;
        max-height: 90vh !important;
        min-height: 250px !important;
    }
}

.close-btn {
    float: right;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
}

.close-btn:hover {
    color: #1e293b;
}

.history-list-container {
    margin-top: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

#historyTable {
    width: 100%;
    border-collapse: collapse;
}

#historyTable th,
#historyTable td {
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: center;
    min-width: 100px;
    /* 确保列宽足够 */
}

#historyTable th {
    background-color: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 10;
}

#historyTable tbody tr:hover {
    background-color: #f1f5f9;
    cursor: pointer;
}

/* Login and Register Pages */
.container.login-container,
.container.register-container {
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.container.login-container h2,
.container.register-container h2 {
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
}

#loginForm,
#registerForm {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* 减小间距以适配移动端 */
}

#loginForm input,
#registerForm input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#loginForm input:focus,
#registerForm input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

#loginForm button,
#registerForm button {
    background-color: #2563eb;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

#loginForm button:hover,
#registerForm button:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

#loginForm button:disabled,
#registerForm button:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#loginForm p,
#registerForm p {
    text-align: center;
    color: #64748b;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.5;
}

#loginForm a,
#registerForm a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.3s ease;
}

#loginForm a:hover,
#registerForm a:hover {
    color: #1d4ed8;
}

/* Responsive design */
@media (max-width: 768px) {
    .video-area {
        grid-template-columns: 1fr;
    }

    .chat-area,
    .whiteboard-area {
        width: 100%;
    }

    #whiteboard {
        width: 100%;
        height: 400px;
    }

    .container.login-container,
    .container.register-container {
        width: 100%;
        max-width: 90%;
        margin: 15px auto;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        /* 减弱阴影 */
    }

    #loginForm input,
    #registerForm input {
        padding: 8px;
        font-size: 14px;
        /* 减小字体 */
    }

    #loginForm button,
    #registerForm button {
        padding: 10px;
        font-size: 14px;
    }

    #loginForm p,
    #registerForm p {
        font-size: 12px;
        margin-top: 10px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-list-container {
        max-height: 60vh;
    }

    .message-bubble {
        max-width: 85%;
        /* 小屏幕上气泡更宽 */
    }

    .chat-input-controls {
        gap: 6px;
    }

    .chat-input-buttons {
        gap: 6px;
        margin-top: 6px;
        padding-top: 6px;
        flex: 0 0 auto;
        background-color: #ffffff;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 10px 15px;
    }

    .chat-input-area {
        gap: 6px;
        padding: 8px;
    }

    .chat-input-buttons-area {
        gap: 6px;
        padding: 6px 8px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 延迟显示样式 */
.latency-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    transition: color 0.3s;
}

/* 根据延迟值动态调整颜色 */
.latency-low {
    color: #28a745;
    /* 绿色，延迟 < 100ms */
}

.latency-medium {
    color: #ffc107;
    /* 黄色，100ms ≤ 延迟 ≤ 300ms */
}

.latency-high {
    color: #dc3545;
    /* 红色，延迟 > 300ms */ }

/* styles.css */

/* 遮罩层 */
#custom-alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
}

/* 弹窗容器 */
#custom-alert-box {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 8px;
    width: 320px;
    max-width: 80%;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    font-family: "Helvetica Neue", Arial, sans-serif;
}

/* 标题 */
#custom-alert-title {
    margin: 0 0 12px;
    font-size: 18px;
    color: #333333;
}

/* 消息文本 */
#custom-alert-message {
    font-size: 14px;
    color: #444444;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* 按钮区域 */
#custom-alert-box>div {
    text-align: right;
}

/* 确定按钮 */
#custom-alert-ok {
    background-color: #007bff;
    /* 主色，可改成你页面的主题色 */
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

#custom-alert-ok:hover {
    background-color: #0056b3;
    /* 悬浮颜色 */
}

#custom-alert-ok:active {
    background-color: #004085;
    /* 点击颜色 */
}

#custom-alert-ok:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5);
}

/* 历史记录详情模态框 */
#historyDetailModal .modal-content {
    max-width: 900px;
    padding: 20px;
}

.history-detail-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-detail-info {
    background-color: #f1f5f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.history-detail-info p {
    margin: 5px 0;
    font-size: 14px;
}

.history-detail-info strong {
    color: #1e293b;
}

.history-detail-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#historyChatWindow {
    height: 300px;
    overflow-y: auto;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 10px;
}

#historyWhiteboard {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #historyDetailModal .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    #historyChatWindow {
        height: 200px;
    }

    #historyWhiteboard {
        width: 100%;
        height: 300px;
    }

    /* 聊天窗口移动端优化 */
    #chatRoomWindow .chat-message .bubble {
        max-width: 85%;
        padding: 8px 12px;
        font-size: 14px;
        direction: ltr;
        text-align: left;
    }

    #chatRoomWindow .chat-message .avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    #chatRoomWindow .chat-messages {
        padding: 10px;
    }

    #chatRoomWindow .chat-input-area {
        padding: 10px;
        gap: 8px;
    }

    #chatRoomWindow .chat-input-buttons-area {
        padding: 8px 10px;
        gap: 8px;
    }

    #chatRoomWindow #chatRoomInput {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 30px;
        flex: 4;
        width: 300px;
    }

    #chatRoomWindow .chat-send-btn {
        padding: 4px 10px;
        font-size: 13px;
        min-height: 30px;
        flex: 0 0 auto;
        white-space: nowrap;
        width: auto;
        min-width: 50px;
    }

    #chatRoomWindow .chat-input-buttons-area button {
        padding: 10px 16px;
        font-size: 20px;
        min-height: 52px;
        min-width: 44px;
    }

    .chat-input-buttons {
        margin-top: 8px;
        padding-top: 8px;
        gap: 8px;
    }

    .chat-input-buttons button {
        padding: 10px 16px;
        font-size: 20px;
        min-height: 52px;
        min-width: 44px;
    }

    .chat-input-controls input[type="text"],
    .chat-input-area input[type="text"] {
        font-size: 16px;
        padding: 12px 14px;
        min-height: 52px;
        flex: 1;
    }

    .message-image {
        max-width: 200px;
        max-height: 150px;
    }

    .message-video {
        max-width: 250px;
        max-height: 200px;
    }

    .message-emoji {
        width: 60px !important;
        height: 60px !important;
        max-width: 60px !important;
        max-height: 60px !important;
    }

    /* 聊天窗口移动端优化 */
    #chatRoomWindow {
        width: 95vw;
        height: 80vh;
        max-width: 95vw;
        max-height: 85vh;
    }

    .chat-area,
    .whiteboard-area {
        padding: 10px;
    }
}

/* 首页关闭提示样式 */
.homepage-closed-notice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.notice-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.notice-content h2 {
    color: #e53e3e;
    margin-bottom: 15px;
    font-size: 24px;
}

.notice-content p {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.5;
}

/* 聊天室窗口样式 */
#chatRoomWindow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 95vw;
    height: 500px;
    max-height: 85vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

#chatRoomWindow .cinema-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    color: #fff;
}

#chatRoomWindow .cinema-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#chatRoomWindow .cinema-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

#chatRoomWindow .cinema-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#chatRoomWindow .cinema-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

#chatRoomWindow .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
}

#chatRoomWindow .chat-input-area {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    border-top: 1px solid #e2e8f0;
}

#chatRoomWindow .chat-input-buttons-area {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    border-top: 1px solid #e2e8f0;
}

#chatRoomWindow .chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    max-width: 100%;
}

#chatRoomWindow .chat-message.self {
    flex-direction: row-reverse;
}

#chatRoomWindow .chat-message.other {
    flex-direction: row;
}

#chatRoomWindow .chat-message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
    margin: 0 10px;
}

#chatRoomWindow .chat-message.self .avatar {
    background: #95ec69;
}

#chatRoomWindow .chat-message .bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
    overflow-x: hidden;
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

#chatRoomWindow .chat-message .bubble img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

#chatRoomWindow .chat-message .bubble audio {
    max-width: 250px;
    height: 40px;
    display: block;
}

#chatRoomWindow .chat-message .bubble video {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

#chatRoomWindow .chat-message.self .bubble {
    background: #95ec69;
    color: white;
    border-radius: 8px 8px 0 8px;
}

#chatRoomWindow .chat-message.self .bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #95ec69;
}

#chatRoomWindow .chat-message.other .bubble {
    background: white;
    color: #333;
    border-radius: 8px 8px 8px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#chatRoomWindow .chat-message.other .bubble::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid white;
}

#chatRoomWindow .chat-message .sender {
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
    font-size: 12px;
}

#chatRoomWindow .chat-message .time {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    text-align: right;
}

#chatRoomWindow .chat-message.pending .bubble {
    opacity: 0.6;
    border-left: 2px dashed #95ec69;
}

#chatRoomWindow .chat-message.sent .bubble {
    opacity: 1;
    border-left: 2px solid #95ec69;
}

#chatRoomWindow .chat-message.failed .bubble {
    opacity: 1;
    border-left: 2px solid #e53e3e;
    background: #fed7d7;
}

#chatRoomWindow .chat-message .content {
    color: #333;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    direction: ltr;
    text-align: left;
}

#chatRoomWindow #chatRoomInput {
    flex: 4;
    width: 300px;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px !important;
    outline: none;
    transition: border-color 0.3s;
    min-height: 30px !important;
}

#chatRoomWindow #chatRoomInput:focus {
    border-color: #667eea;
}

#chatRoomWindow .chat-send-btn {
    margin-left: 10px;
    padding: 6px 12px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 30px !important;
    flex: 0 0 auto;
    white-space: nowrap;
    width: auto;
    min-width: 50px;
}

#chatRoomWindow .chat-send-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#chatRoomWindow .chat-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* 聊天输入控件样式 */
.chat-input-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.chat-input-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
}

.chat-input-buttons-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid #e2e8f0;
}

.chat-input-controls input[type="text"],
.chat-input-area input[type="text"] {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
  min-height: 52px;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.chat-input-controls button,
.chat-input-area button {
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  min-height: 52px;
  white-space: nowrap;
  flex: 1;
}

.chat-input-buttons button,
.chat-input-buttons-area button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.file-upload {
  cursor: pointer;
}

/* 消息中的媒体样式 */
.message-image {
  max-width: 300px;
  max-height: 200px;
  border-radius: 4px;
}

.message-video {
  max-width: 400px;
  max-height: 300px;
  border-radius: 4px;
}

.message-emoji {
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  max-height: 60px !important;
  border-radius: 4px;
  display: block;
  object-fit: contain;
}

/* 表情选择器样式 */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 10px;
  z-index: 1000;
  max-width: 280px;
  max-height: 250px;
  overflow-y: auto;
}

.emoji-picker #emojiGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 6px;
}

.emoji-item:hover {
  background: #f1f5f9;
}

.emoji-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.message-emoji {
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  max-height: 60px !important;
}

@media (max-width: 768px) {
  .emoji-picker {
    max-width: 250px;
  }
  .emoji-item {
    width: 36px;
    height: 36px;
  }
  .emoji-item img {
    width: 28px;
    height: 28px;
  }
}

.floating-chat-notify {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  cursor: pointer;
  z-index: 99999;
  animation: notify-pulse 1.5s ease-in-out infinite;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

:fullscreen .floating-chat-notify,
:-webkit-full-screen .floating-chat-notify,
:-moz-full-screen .floating-chat-notify,
:-ms-fullscreen .floating-chat-notify {
  position: fixed !important;
  z-index: 99999 !important;
}

.floating-chat-notify:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

@keyframes notify-pulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(102, 126, 234, 0.8), 0 0 20px rgba(102, 126, 234, 0.6);
  }
}

.floating-chat-notify .notify-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  animation: icon-bounce 2s ease-in-out infinite;
}

@keyframes icon-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.floating-chat-notify .notify-close {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 20px;
  height: 20px;
  background: #ff4757;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.floating-chat-notify .notify-close:hover {
  opacity: 1;
}

.floating-chat-notify .notify-content {
  display: flex;
  flex-direction: column;
}

.floating-chat-notify .notify-title {
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.floating-chat-notify .notify-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat-notify .notify-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  font-size: 12px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.floating-chat-window {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  height: 450px;
  max-height: 80vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: window-slide-up 0.3s ease;
}

:fullscreen .floating-chat-window,
:-webkit-full-screen .floating-chat-window,
:-moz-full-screen .floating-chat-window,
:-ms-fullscreen .floating-chat-window {
  position: fixed !important;
  z-index: 100000 !important;
  max-height: 70vh;
}

@keyframes window-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.floating-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.floating-chat-title {
  color: white;
  font-weight: bold;
  font-size: 16px;
}

.floating-chat-header-btns {
  display: flex;
  gap: 8px;
}

.floating-chat-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.floating-chat-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.floating-chat-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
}

.floating-chat-messages {
  height: 100%;
  min-height: 200px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

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

.floating-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.floating-chat-messages .chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 85%;
}

.floating-chat-messages .chat-message.self {
  flex-direction: row-reverse;
  margin-left: auto;
}

.floating-chat-messages .chat-message .avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.floating-chat-messages .chat-message.self .avatar {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.floating-chat-messages .chat-message .message-content {
  background: white;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.floating-chat-messages .chat-message.self .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.floating-chat-messages .chat-message .message-sender {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
}

.floating-chat-messages .chat-message.self .message-sender {
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
}

.floating-chat-messages .chat-message img {
  max-width: 200px;
  border-radius: 8px;
  cursor: pointer;
}

.floating-chat-footer {
  padding: 12px;
  background: white;
  border-top: 1px solid #e2e8f0;
  position: relative;
  flex-shrink: 0;
}

.floating-chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.floating-chat-input-wrapper textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  outline: none;
  font-family: inherit;
}

.floating-chat-input-wrapper textarea:focus {
  border-color: #667eea;
}

.floating-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-chat-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.floating-chat-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 8px;
}

.floating-toolbar-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
}

.floating-toolbar-btn:hover {
  background: #667eea;
  color: white;
}

.floating-toolbar-btn.active {
  background: #667eea;
  color: white;
}

.floating-emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.floating-emoji-item {
  font-size: 20px;
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  text-align: center;
  transition: background 0.2s ease;
}

.floating-emoji-item:hover {
  background: #f1f5f9;
}

.floating-voice-recorder {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.voice-recorder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.voice-recorder-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.voice-recorder-icon:hover {
  transform: scale(1.1);
}

.voice-recorder-icon.recording {
  background: #ef4444;
  animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
  }
}

.voice-recorder-text {
  font-size: 12px;
  color: #64748b;
}

.voice-recorder-time {
  font-size: 18px;
  font-weight: bold;
  color: #1e293b;
  font-family: monospace;
}

@media (max-width: 400px) {
  .floating-chat-window {
    width: calc(100% - 20px);
    right: 10px;
    bottom: 10px;
    height: 400px;
  }

  .floating-chat-notify {
    right: 10px;
    bottom: 80px;
    padding: 10px 16px;
  }

  .floating-chat-notify .notify-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

