/* =============================================================
   TeamChat — Chat Area Styles (Flat)
   扁平化版本: 无渐变 / 无阴影 / 无入场动画 / 无气泡模式切换
   仅保留: 颜色变量、字体、箭头、功能性动画 (录音/波形)
   ============================================================= */

/* ===== Notice Bar (flat) ===== */
.notice-bar{flex-shrink:0;background:#fff8e1;border-bottom:1px solid #f0d060;padding:10px 16px;display:flex;align-items:center;gap:8px;cursor:pointer}
.notice-bar .notice-icon{font-size:16px;flex-shrink:0}
.notice-bar .notice-text{flex:1;font-size:13px;color:#8b6914;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.notice-expanded{padding:8px 16px 12px 40px;font-size:14px;color:#5d4e14;line-height:1.7;white-space:pre-wrap;word-break:break-word;max-height:200px;overflow-y:auto;background:#fff8e1;border-bottom:1px solid #f0d060}

/* ===== Messages ===== */
.messages-wrapper{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;position:relative}
.messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px;position:relative;z-index:1}
.load-more{text-align:center;padding:10px;color:#667eea;cursor:pointer;background:#fff;border-radius:8px;margin-bottom:8px;font-size:13px}
.msg{display:flex;gap:10px;align-items:flex-start;max-width:80%;padding:2px 0}
.msg.my{align-self:flex-end;flex-direction:row-reverse}
.msg-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex-shrink:0;cursor:pointer}
.msg-body{min-width:0}
.msg-sender{font-size:12px;font-weight:600;color:#667eea;margin-bottom:2px}
.msg.my .msg-sender{text-align:right;color:var(--bubble-my-color,rgba(255,255,255,.8));opacity:.8}

/* ===== Bubble (flat, opaque) =====
   底色 fallback 链: --bubble-my-bg (flat 模式 JS 注入)
                  → --bubble-my-c1 (任何模式都 JS 注入)
                  → 硬编码默认色
   这样无论用户旧外观设定是什么, 颜色都始终生效 */
.msg-bubble{padding:10px 14px;border-radius:16px;word-wrap:break-word;line-height:1.5;position:relative}
.msg.other .msg-bubble{background:var(--bubble-other-bg,var(--bubble-other-c1,#fff));color:var(--bubble-other-color,#333);border-top-left-radius:4px}
.msg.my    .msg-bubble{background:var(--bubble-my-bg,   var(--bubble-my-c1,   #667eea));color:var(--bubble-my-color,#fff);border-top-right-radius:4px}

/* ===== Bubble arrow pointing at avatar ===== */
.msg.other .msg-bubble::before{content:'';position:absolute;top:10px;left:-6px;width:0;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:6px solid var(--bubble-other-arrow,var(--bubble-other-c1,#fff))}
.msg.my    .msg-bubble::before{content:'';position:absolute;top:10px;right:-6px;width:0;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent;border-left:6px solid var(--bubble-my-arrow,var(--bubble-my-c1,#667eea))}

.msg-time{font-size:10px;opacity:.5;text-align:right;margin-top:4px}
.msg-bubble img.chat-image{max-width:240px;max-height:240px;border-radius:8px;cursor:pointer;display:block;margin-top:6px}
.msg-bubble .file-card{display:flex;align-items:center;gap:8px;padding:8px 12px;background:rgba(0,0,0,.05);border-radius:8px;margin-top:6px;cursor:pointer;font-size:13px}
.msg-bubble .reply-ref{background:rgba(0,0,0,.06);padding:4px 8px;border-radius:6px;margin-bottom:6px;font-size:12px;border-left:2px solid #667eea;color:#666;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.msg.my .msg-bubble .reply-ref{border-left-color:rgba(255,255,255,.5);color:rgba(255,255,255,.7);background:rgba(255,255,255,.15)}
.msg-content{white-space:pre-wrap;word-break:break-word}
.msg-content a{color:inherit;text-decoration:underline}

/* ===== Emoji Picker ===== */
.emoji-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;font-size:22px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;padding:0}
.emoji-btn:hover{background:rgba(0,0,0,.05)}
.emoji-picker{position:absolute;bottom:46px;right:0;width:320px;max-height:260px;background:#fff;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.18);z-index:500;overflow:hidden;display:flex;flex-direction:column}
.emoji-picker-tabs{display:flex;border-bottom:1px solid #eee;overflow-x:auto;flex-shrink:0;padding:0 4px}
.emoji-picker-tabs button{flex-shrink:0;background:none;border:none;padding:8px 10px;font-size:14px;cursor:pointer;color:#666;border-bottom:2px solid transparent;white-space:nowrap}
.emoji-picker-tabs button.active{color:#667eea;border-bottom-color:#667eea}
.emoji-picker-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;padding:8px;overflow-y:auto;flex:1}
.emoji-picker-grid span{width:36px;height:36px;display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;font-size:22px}
.emoji-picker-grid span:hover{background:#f0f2ff}
.emoji-picker-img{width:24px;height:24px;object-fit:contain;pointer-events:none}
/* Inline emoji in messages */
img.tc-emoji{display:inline-block;width:22px;height:22px;vertical-align:text-bottom;margin:0 1px;object-fit:contain}
@media(max-width:768px){
  .emoji-picker{width:280px;right:-40px}
}

/* ===== Chain Card (接龙, flat) ===== */
.chain-card{background:#eef0ff;border:1px solid #c7d2fe;border-radius:12px;padding:12px;margin-top:4px}
.msg.my .chain-card{background:rgba(255,255,255,.18);border-color:rgba(255,255,255,.3)}
.chain-header{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#4f46e5;margin-bottom:6px}
.msg.my .chain-header{color:rgba(255,255,255,.9)}
.chain-topic{font-size:15px;font-weight:600;color:#1e1b4b;margin-bottom:4px}
.msg.my .chain-topic{color:#fff}
.chain-desc{font-size:13px;color:#555;margin-bottom:8px;line-height:1.4}
.msg.my .chain-desc{color:rgba(255,255,255,.8)}
.chain-list{font-size:14px;line-height:1.8;color:#333}
.msg.my .chain-list{color:rgba(255,255,255,.95)}
.chain-seq{display:inline-block;min-width:22px;height:22px;line-height:22px;text-align:center;background:#667eea;color:#fff;border-radius:50%;font-size:11px;font-weight:700;margin-right:6px;vertical-align:middle}
.msg.my .chain-seq{background:rgba(255,255,255,.3)}
.chain-name{font-weight:600;color:#4338ca}
.msg.my .chain-name{color:rgba(255,255,255,.95)}
.chain-join-btn{display:inline-flex;align-items:center;gap:4px;margin-top:10px;padding:6px 14px;background:#667eea;color:#fff;border:none;border-radius:20px;font-size:13px;font-weight:600;cursor:pointer}
.chain-join-btn:hover{background:#5567d8}
.chain-join-btn.joined{background:#10b981;cursor:default}
.msg.my .chain-join-btn{background:rgba(255,255,255,.25)}

/* ===== Input Area (WeChat-style) ===== */
.reply-bar{background:#f0f2ff;padding:8px 16px;display:flex;align-items:center;gap:8px;font-size:13px;color:#555;border-left:3px solid #667eea;flex-shrink:0}
.reply-bar .reply-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reply-bar button{background:none;border:none;font-size:16px;cursor:pointer;color:#999;padding:0 4px}
.input-area{background:#f7f7f8;padding:10px 12px;display:flex;gap:8px;align-items:flex-end;box-shadow:0 -1px 0 rgba(0,0,0,.06);flex-shrink:0;position:relative}
.input-area textarea{flex:1;min-height:36px;max-height:120px;padding:8px 12px;border:none;border-radius:8px;font-size:15px;outline:none;resize:none;line-height:1.5;font-family:inherit;background:#fff;box-shadow:0 0 0 .5px rgba(0,0,0,.1)}
.input-area textarea:focus{box-shadow:0 0 0 .5px rgba(0,0,0,.2)}
.input-area .voice-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#666;padding:0}
.input-area .voice-btn:hover{background:rgba(0,0,0,.05)}
.input-area .emoji-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;font-size:22px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;padding:0}
.input-area .emoji-btn:hover{background:rgba(0,0,0,.05)}
.input-area .send-btn{height:36px;min-width:36px;padding:0 16px;border-radius:8px;border:none;background:#07c160;color:#fff;font-size:14px;font-weight:500;cursor:pointer;flex-shrink:0;white-space:nowrap}
.input-area .send-btn:hover{background:#06ad56}
.input-area .send-btn:disabled{opacity:.4;cursor:not-allowed;background:#07c160}
.input-area .plus-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#666;padding:0}
.input-area .plus-btn:hover{background:rgba(0,0,0,.05)}
/* Plus menu (action sheet from bottom of plus btn) */
.plus-menu{position:absolute;bottom:46px;right:0;background:#fff;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.16);z-index:500;overflow:hidden;min-width:130px;padding:4px 0}
.plus-menu-item{display:flex;align-items:center;gap:10px;padding:12px 16px;cursor:pointer;font-size:14px;color:#333;white-space:nowrap}
.plus-menu-item:hover{background:#f5f5f5}
.plus-menu-item:active{background:#ebebeb}
.plus-menu-icon{font-size:18px;width:24px;text-align:center;flex-shrink:0}
/* Legacy compat — keep rules so nothing breaks if old markup lingers */
.input-area .attach-btn,.input-area .chain-btn{width:36px;height:36px;border-radius:50%;border:none;background:transparent;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.input-area .newline-btn{display:none}

/* ===== Voice Recording Bar (functional blink kept) ===== */
.voice-recording-bar{display:flex;align-items:center;gap:10px;width:100%;min-height:36px}
.voice-cancel-btn{width:36px;height:36px;border-radius:50%;border:none;background:rgba(220,38,38,.1);color:#dc2626;font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-weight:600}
.voice-cancel-btn:hover{background:rgba(220,38,38,.2)}
.voice-rec-indicator{flex:1;display:flex;align-items:center;gap:8px;font-size:14px;color:#333;font-variant-numeric:tabular-nums}
.rec-dot{width:10px;height:10px;border-radius:50%;background:#dc2626;animation:rec-blink 1s ease-in-out infinite}
@keyframes rec-blink{0%,100%{opacity:1}50%{opacity:.3}}
.voice-send-btn{width:36px;height:36px;border-radius:50%;border:none;background:#07c160;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.voice-send-btn:hover{background:#06ad56}

/* ===== Voice Message Card (static bars, playing state just shows full opacity) ===== */
.voice-card{display:flex;align-items:center;gap:8px;min-width:160px;padding:4px 0}
.voice-play-btn{width:32px;height:32px;border-radius:50%;border:none;background:#07c160;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;padding:0;padding-left:2px}
.voice-play-btn:hover{background:#06ad56}
.voice-card.playing .voice-play-btn svg{display:none}
.voice-card.playing .voice-play-btn::after{content:'⏸';font-size:14px;padding-left:0}
.voice-card audio{display:none}
.voice-wave{display:flex;align-items:center;gap:2px;height:24px;flex:1}
.voice-wave span{width:3px;border-radius:2px;background:#07c160;opacity:.35;height:8px}
.voice-wave span:nth-child(1){height:10px}.voice-wave span:nth-child(2){height:18px}.voice-wave span:nth-child(3){height:14px}.voice-wave span:nth-child(4){height:20px}.voice-wave span:nth-child(5){height:12px}
.voice-card.playing .voice-wave span{opacity:1}
.voice-dur{font-size:12px;color:#999;flex-shrink:0;font-variant-numeric:tabular-nums}

/* ===== Context Menu ===== */
.msg-menu{position:fixed;background:#fff;border-radius:8px;box-shadow:0 4px 16px rgba(0,0,0,.15);z-index:2000;overflow:hidden;min-width:140px}
.msg-menu .menu-item{padding:10px 16px;cursor:pointer;font-size:14px}
.msg-menu .menu-item:hover{background:#f0f2ff}
.msg-menu .menu-item-danger{color:#dc2626}
.msg-menu .menu-item-danger:hover{background:#fef2f2}

/* ===== Image Preview ===== */
.image-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.85);display:flex;justify-content:center;align-items:center;z-index:2000;cursor:zoom-out}
.image-modal img{max-width:90vw;max-height:90vh;border-radius:8px}

/* ===== Kicked Overlay ===== */
.kicked-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.7);display:flex;justify-content:center;align-items:center;z-index:9999}
.kicked-card{background:#fff;padding:32px;border-radius:16px;text-align:center;max-width:360px;width:90%}
.kicked-card h3{margin-bottom:12px;color:#dc2626}
.kicked-card p{margin-bottom:20px;color:#666;font-size:14px}

/* ===== Settings: Animation toggles (kept for layout; toggle now a no-op) ===== */
.anim-toggles{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.anim-toggle-row{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#f9fafb;border-radius:8px}
.anim-toggle-row span{font-size:14px;color:#333}
.toggle-switch{position:relative;width:44px;height:24px;flex-shrink:0}
.toggle-switch input{opacity:0;width:0;height:0;position:absolute}
.toggle-switch .slider{position:absolute;cursor:pointer;inset:0;background:#ccc;border-radius:24px;transition:.2s}
.toggle-switch .slider::before{content:'';position:absolute;height:18px;width:18px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.2s}
.toggle-switch input:checked+.slider{background:#667eea}
.toggle-switch input:checked+.slider::before{transform:translateX(20px)}

/* ===== @-Mention Popup ===== */
.mention-popup{position:absolute;bottom:100%;left:12px;width:auto;min-width:120px;max-width:200px;background:#fff;border-radius:12px;box-shadow:0 -4px 20px rgba(0,0,0,.14);z-index:500;max-height:320px;overflow-y:auto;margin-bottom:6px;padding:4px 0}
.mention-item{display:flex;align-items:center;gap:8px;padding:8px 12px;cursor:pointer}
.mention-item:hover,.mention-item.active{background:#f0f2ff}
.mention-avatar{width:26px;height:26px;border-radius:50%;object-fit:cover;flex-shrink:0}
.mention-nick{font-size:14px;font-weight:500;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mention-item .ai-tag{display:inline-block;font-size:10px;color:#667eea;background:#eef;padding:1px 5px;border-radius:3px;margin-right:4px;vertical-align:middle;font-weight:500}

/* ===== @-Mention indicator (flat, thin gold outline) ===== */
.msg-bubble.mentioned{outline:1.5px solid #d4a017;outline-offset:1px}
