/* chat.css - 通用样式 + 桌面端 */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }

body { 
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; 
    background: #1a1a2e; color: #eee; 
    height: 100dvh; 
    max-height: 100dvh;
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* ===== 顶部栏 ===== */
.top-bar { 
    background: #16213e; 
    padding: 8px 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 2px solid #e94560; 
    flex-wrap: wrap; 
    gap: 8px; 
    flex-shrink: 0; 
}
.top-bar h1 { color: #e94560; font-size: 18px; }
.top-bar .info { font-size: 12px; color: #aaa; }
.top-bar .info span { margin-left: 12px; }
.top-bar button { background: #e94560; color: #fff; border: none; padding: 5px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* ===== 开奖结果横幅 ===== */
.result-banner { 
    background: #0a1a2e; 
    padding: 8px 15px; 
    border-bottom: 1px solid #333; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-shrink: 0; 
    flex-wrap: wrap; 
}
.result-banner .label { font-size: 12px; color: #e94560; font-weight: bold; white-space: nowrap; }
.result-banner .balls { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.ball { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; color: #fff; flex-shrink: 0; }
.ball.red { background: #e74c3c; }
.ball.blue { background: #3498db; }
.ball.green { background: #2ecc71; }
.ball.special { border: 2px solid gold; box-shadow: 0 0 6px gold; }
.result-banner .meta { font-size: 11px; color: #aaa; }
.result-banner .no-result { color: #666; font-size: 12px; }

/* ===== 房间标签栏 ===== */
.room-tabs { 
    display: flex; 
    background: #0f3460; 
    padding: 0 15px; 
    border-bottom: 1px solid #333; 
    overflow-x: auto; 
    flex-shrink: 0; 
}
.room-tab { padding: 8px 16px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13px; transition: all 0.2s; }
.room-tab:hover { background: #16213e; }
.room-tab.active { border-bottom-color: #e94560; color: #e94560; font-weight: bold; }
.room-tab .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.room-tab .status-dot.open { background: #2ecc71; }
.room-tab .status-dot.closed { background: #e74c3c; }
.room-tab .status-dot.drawn { background: #f39c12; }

/* ===== 模式切换栏（桌面端显示） ===== */
.mode-bar { 
    display: flex; 
    background: #0a1a2e; 
    padding: 6px 15px; 
    border-bottom: 1px solid #333; 
    align-items: center; 
    gap: 15px; 
    flex-shrink: 0; 
}
.mode-group { display: flex; align-items: center; gap: 6px; }
.mode-group .label { font-size: 11px; color: #888; }
.mode-btn { padding: 5px 12px; border: 1px solid #333; background: #16213e; color: #aaa; border-radius: 4px; cursor: pointer; font-size: 12px; transition: all 0.2s; }
.mode-btn:hover { border-color: #e94560; }
.mode-btn.active { background: #e94560; color: #fff; border-color: #e94560; }
.mode-hint { font-size: 11px; color: #f39c12; margin-left: auto; }

/* ===== 手机端功能菜单栏（替代模式栏） ===== */
.mobile-menu-bar {
    display: none;
    background: #0a1a2e;
    padding: 6px 10px;
    border-bottom: 1px solid #333;
    gap: 6px;
    flex-shrink: 0;
    overflow-x: auto;
}
.mobile-menu-bar::-webkit-scrollbar { display: none; }
.mobile-menu-btn {
    padding: 5px 10px;
    border: 1px solid #e94560;
    background: #16213e;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: #e94560; }

/* ===== 主区域 ===== */
.main { 
    display: flex; 
    flex: 1; 
    overflow: hidden; 
    min-height: 0; 
    position: relative;
}

/* 侧边栏 */
.sidebar { width: 200px; background: #0f3460; padding: 12px; overflow-y: auto; flex-shrink: 0; }
.sidebar h3 { color: #e94560; margin-bottom: 8px; font-size: 13px; }
.sidebar .menu-btn { display: block; width: 100%; padding: 8px; margin-bottom: 6px; background: #16213e; border: 1px solid #e94560; color: #fff; border-radius: 4px; cursor: pointer; text-align: left; font-size: 12px; }
.sidebar .menu-btn:hover { background: #e94560; }

/* 聊天区域 */
.chat-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: #1a1a2e; 
    min-width: 0; 
    min-height: 0; 
    overflow: hidden;
    position: relative;
}

/* 倒计时条 */
.timer-bar { 
    background: #16213e; 
    padding: 6px 15px; 
    border-bottom: 1px solid #333; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0; 
}
.timer-bar .label { font-size: 11px; color: #aaa; }
.timer-bar .time { font-size: 16px; color: #e94560; font-weight: bold; font-family: monospace; }
.timer-bar .time.urgent { color: #e74c3c; animation: blink 1s infinite; }

/* 消息区域 */
.messages { 
    flex: 1; 
    overflow-y: auto; 
    padding: 12px; 
    min-height: 0;
    padding-right: 50px;
}
.msg { margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; max-width: 85%; word-break: break-all; font-size: 13px; }
.msg .user { font-size: 11px; color: #e94560; margin-bottom: 2px; }
.msg .time { font-size: 10px; color: #888; margin-left: 6px; }
.msg-text { background: #16213e; }
.msg-bet { background: #0f3460; border-left: 3px solid #e94560; }
.msg-bot { background: #1a472a; border-left: 3px solid #2ecc71; }
.msg-system { background: #4a1a1a; text-align: center; max-width: 100%; }
.msg-cancel { background: #4a1a1a; border-left: 3px solid #f39c12; }
.msg-self { border: 1px solid #e94560; }
.msg-hidden { display: none !important; }

/* ===== bet 消息点击提示 ===== */
.msg-bet-text { cursor: pointer; }
.msg-bet-text:hover { opacity: 0.85; }

/* ===== 右侧悬浮按钮（手机端模式/显示切换） ===== */
.float-actions {
    display: none;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}
.float-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e94560;
    background: #16213e;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.1;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.float-btn.active {
    background: #e94560;
    border-color: #e94560;
}
.float-btn:hover {
    background: #e94560;
}

/* ===== 输入区域 ===== */
.input-area { 
    display: flex; 
    padding: 10px 12px; 
    background: #16213e; 
    border-top: 1px solid #333; 
    flex-shrink: 0; 
}
.input-area textarea { 
    flex: 1; 
    padding: 10px 14px; 
    border: 1px solid #333; 
    background: #1a1a2e; 
    color: #fff; 
    border-radius: 4px; 
    outline: none; 
    font-size: 16px; 
    resize: none;
    min-height: 42px;
    max-height: 200px;
    line-height: 1.4;
    font-family: inherit;
    overflow-y: hidden;
}
.input-area textarea.bet-mode { border-color: #e94560; }
.input-area textarea.bet-mode::placeholder { color: #e94560; }
.input-area button { 
    margin-left: 8px; 
    padding: 10px 20px; 
    background: #e94560; 
    color: #fff; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 14px; 
    white-space: nowrap; 
}

/* ===== 右侧面板 ===== */
.right-panel { width: 260px; background: #0f3460; padding: 12px; overflow-y: auto; flex-shrink: 0; }
.bet-panel h3 { color: #e94560; margin-bottom: 8px; font-size: 13px; }
.bet-group { margin-bottom: 12px; }
.bet-group label { display: block; font-size: 11px; color: #aaa; margin-bottom: 4px; }
.bet-group select, .bet-group input { width: 100%; padding: 7px; background: #16213e; border: 1px solid #333; color: #fff; border-radius: 4px; margin-bottom: 4px; font-size: 14px; }
.bet-group button { width: 100%; padding: 10px; background: #e94560; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.bet-group button:disabled { background: #555; cursor: not-allowed; }

/* ===== 弹窗 ===== */
.modal-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.7); z-index:100; justify-content:center; align-items:center; }
.modal { background: #16213e; padding: 20px; border-radius: 8px; width: 420px; max-width: 92%; max-height: 80vh; overflow-y: auto; }
.modal h2 { color: #e94560; margin-bottom: 12px; font-size: 18px; }
.modal input { width: 100%; padding: 10px; margin-bottom: 10px; background: #1a1a2e; border: 1px solid #333; color: #fff; border-radius: 4px; font-size: 16px; }
.modal button { width: 100%; padding: 12px; background: #e94560; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 6px; font-size: 14px; }
.modal .link { color: #3498db; cursor: pointer; text-align: center; display: block; margin-top: 8px; font-size: 13px; }
.modal table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.modal th, .modal td { padding: 6px; border-bottom: 1px solid #333; text-align: left; }
.modal th { background: #0f3460; color: #e94560; }

.bet-list-item { padding: 6px; border-bottom: 1px solid #333; font-size: 12px; }
.bet-list-item .cancel-btn { background: #e74c3c; color: #fff; border: none; padding: 3px 8px; border-radius: 3px; cursor: pointer; font-size: 11px; }
.bet-list-item .cancel-btn:disabled { background: #555; cursor: not-allowed; }

.report-card { background: #16213e; padding: 12px; border-radius: 6px; margin-bottom: 8px; }
.report-card .title { color: #e94560; font-size: 13px; margin-bottom: 6px; }
.report-card .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; border-bottom: 1px solid #333; }
.report-card .row:last-child { border-bottom: none; }
.report-card .row .val { color: #2ecc71; }
.report-card .row .val.negative { color: #e74c3c; }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ===== 解析确认弹窗 ===== */
.parse-modal-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.8); z-index:200; justify-content:center; align-items:center; }
.parse-modal { background: #16213e; padding: 24px; border-radius: 10px; width: 460px; max-width: 92%; border: 1px solid #e94560; }
.parse-modal h3 { color: #e94560; margin-bottom: 16px; font-size: 18px; text-align: center; }
.parse-detail { background: #0f3460; padding: 14px; border-radius: 6px; margin-bottom: 16px; }
.parse-detail .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #333; font-size: 13px; }
.parse-detail .row:last-child { border-bottom: none; }
.parse-detail .row .label { color: #aaa; }
.parse-detail .row .val { color: #fff; font-weight: bold; }
.parse-detail .row .val.nums { color: #2ecc71; }
.parse-detail .row .val.amount { color: #e94560; }
.parse-detail .raw-text { color: #888; font-size: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #333; }
.parse-modal .btn-group { display: flex; gap: 10px; }
.parse-modal .btn-group button { flex: 1; padding: 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.parse-modal .btn-confirm { background: #e94560; color: #fff; }
.parse-modal .btn-confirm:hover { background: #d63a54; }
.parse-modal .btn-cancel { background: #555; color: #fff; }
.parse-modal .btn-cancel:hover { background: #666; }

/* ===== 批量解析确认弹窗 ===== */
#multi-parse-modal .parse-modal { width: 520px; max-height: 85vh; display: flex; flex-direction: column; }

/* ===== 图片消息 ===== */
.image-msg { max-width: 200px; max-height: 200px; border-radius: 6px; cursor: pointer; border: 1px solid #333; display: block; }
.image-msg:hover { border-color: #e94560; }
.image-preview-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.9); z-index:500; justify-content:center; align-items:center; }
.image-preview-overlay img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.image-preview-overlay .close-preview { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 30px; cursor: pointer; }

/* ===== 用户菜单 ===== */
#user-menu { display: none; position: fixed; background: #16213e; border: 1px solid #e94560; border-radius: 6px; padding: 6px 0; z-index: 300; min-width: 160px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
#user-menu .menu-header { padding: 8px 14px; color: #e94560; font-size: 12px; border-bottom: 1px solid #333; font-weight: bold; }
#user-menu .menu-item { padding: 10px 14px; cursor: pointer; color: #fff; font-size: 13px; transition: background 0.15s; }
#user-menu .menu-item:hover { background: #e94560; }

/* ===== 联系人面板（桌面端） ===== */
.contacts-panel h3 { color: #e94560; margin-bottom: 8px; font-size: 13px; }
.contact-item { display: flex; align-items: center; padding: 8px; border-bottom: 1px solid #333; cursor: pointer; transition: background 0.15s; }
.contact-item:hover { background: #16213e; }
.contact-item .avatar { width: 28px; height: 28px; border-radius: 50%; background: #e94560; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; margin-right: 8px; flex-shrink: 0; }
.contact-item .info { flex: 1; min-width: 0; }
.contact-item .name { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-item .name .remark { color: #aaa; font-size: 11px; }
.contact-item .remove { color: #888; font-size: 11px; padding: 2px 6px; cursor: pointer; border-radius: 3px; }
.contact-item .remove:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }
.contact-item .badge { background: #e94560; color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 8px; margin-left: 6px; }
.contact-item .auto-del { color: #f39c12; font-size: 10px; margin-left: 4px; }
.search-result-item { display: flex; align-items: center; padding: 8px; border-bottom: 1px solid #333; }
.search-result-item .add-btn { margin-left: auto; background: #2ecc71; color: #fff; border: none; padding: 3px 10px; border-radius: 3px; cursor: pointer; font-size: 11px; }

/* ===== 自动删除设置弹窗 ===== */
.del-opt { padding: 10px 14px; background: #0f3460; border-radius: 4px; margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; }
.del-opt:hover { border-color: #e94560; }
.del-opt.active { border-color: #e94560; background: #16213e; }
.del-opt .title { color: #fff; font-size: 13px; }
.del-opt .desc { color: #888; font-size: 11px; margin-top: 2px; }

/* ===== 私聊弹窗（修复版） ===== */
#private-chat-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 150;
    justify-content: center;
    align-items: center;
}

.private-chat-box {
    width: 520px;
    max-width: 95%;
    height: 85vh;
    max-height: 720px;
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #e94560;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.private-chat-header {
    background: #0f3460;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.private-chat-header h3 {
    color: #e94560;
    margin: 0;
    font-size: 15px;
}

.private-chat-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.private-chat-actions button {
    background: none;
    border: 1px solid #e94560;
    color: #e94560;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
}

.private-chat-actions .close-chat-btn {
    border: none;
    color: #fff;
    font-size: 26px;
    padding: 0 4px;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#private-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 2px;
}

.private-msg {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    max-width: 78%;
    animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.private-msg.self {
    align-self: flex-end;
    align-items: flex-end;
}

.private-msg.other {
    align-self: flex-start;
    align-items: flex-start;
}

.private-msg .bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    word-break: break-all;
    line-height: 1.5;
    max-width: 100%;
}

.private-msg.self .bubble {
    background: #e94560;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.private-msg.other .bubble {
    background: #16213e;
    color: #eee;
    border-bottom-left-radius: 4px;
    border: 1px solid #2a2a4a;
}

.private-msg .bubble img.image-msg {
    max-width: 180px;
    max-height: 180px;
    border: none;
    border-radius: 8px;
}

.private-msg .meta {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.read-status {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 500;
}

.read-status.read {
    color: #2ecc71;
}

.read-status.unread {
    color: #f39c12;
}

.private-input-area {
    padding: 12px 14px;
    background: #16213e;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    align-items: center;
}

.private-input-area .img-btn {
    background: #0f3460;
    border: 1px solid #e94560;
    color: #fff;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    height: 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.private-input-area textarea {
    flex: 1;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #fff;
    border-radius: 8px;
    resize: none;
    height: 44px;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    overflow-y: hidden;
}
    flex: 1;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #fff;
    border-radius: 8px;
    resize: none;
    height: 44px;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
}

.private-input-area textarea:focus {
    border-color: #e94560;
}

.private-input-area button {
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    height: 44px;
    font-weight: 500;
}

/* ===== 号码统计面板 ===== */
.number-stats-panel {
    margin-bottom: 12px;
}
.number-stats-panel h3 {
    color: #e94560;
    margin-bottom: 8px;
    font-size: 13px;
}
.number-stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #0f3460;
    border-radius: 4px;
}
.number-stats-summary span {
    color: #fff;
    font-weight: bold;
}
.number-stats-scroll {
    max-height: 55vh;
    overflow-y: auto;
    background: #16213e;
    border-radius: 4px;
    border: 1px solid #333;
}
.number-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.number-stats-table th {
    background: #0f3460;
    color: #e94560;
    padding: 5px 4px;
    text-align: center;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.number-stats-table td {
    padding: 3px 4px;
    text-align: center;
    border-bottom: 1px solid #222;
    color: #ccc;
    font-size: 11px;
}
.number-stats-table tr:hover {
    background: #1a2a4a;
}
.num-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #fff;
    font-weight: bold;
    border-radius: 3px;
    padding: 2px 6px;
    min-width: 48px;
    font-size: 12px;
}
.num-cell.red { background: #c0392b; }
.num-cell.blue { background: #2980b9; }
.num-cell.green { background: #27ae60; }
.text-red { color: #e94560; font-weight: bold; }
.text-green { color: #2ecc71; font-weight: bold; }
