/* public/assets/css/social_office/walkie-talkie.css */
:root {
    --primary: #6366f1; --secondary: #a855f7; --success: #10b981; --warning: #f59e0b; --danger: #ef4444;
    --bg: #ffffff; --card: #f8fafc; --text-main: #0f172a; --text-sub: #64748b;
    --border: #e2e8f0; --shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

.chat-wrapper { 
    width: 100%; max-width: 1100px; margin: 0 auto;
    background: var(--bg); border-radius: 20px; overflow: hidden; 
    border: 1px solid var(--border); box-shadow: var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-main);
    display: flex; flex-direction: column;
}
.chat-wrapper *, .chat-wrapper *::before, .chat-wrapper *::after { box-sizing: border-box; }

.chat-header { padding: 24px; text-align: center; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-title { margin: 0 0 10px 0; font-size: 1.7rem; font-weight: 800; color: var(--text-main); }
.chat-subtitle { margin: 0 auto; max-width: 800px; font-size: 0.95rem; color: var(--text-sub); line-height: 1.6; }
.chat-workspace { padding: 24px; flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-layout { display: flex; gap: 24px; align-items: stretch; height: 60vh; min-height: 450px; max-height: 700px; flex: 1; }

.chat-sys-panel { width: 340px; flex-shrink: 0; background: #0f172a; border-radius: 16px; border: 2px solid #1e293b; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: inset 0 5px 20px rgba(0,0,0,0.5); overflow-y: auto; }
.chat-sys-panel::-webkit-scrollbar { width: 4px; }
.chat-sys-panel::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.chat-panel-title { font-size: 1.05rem; font-weight: 800; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #334155; padding-bottom: 12px; font-family: monospace; margin-bottom: 0; }
.id-display-card { background: #1e293b; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid #334155; }
.id-label { font-size: 12px; color: #94a3b8; letter-spacing: 1px; margin-bottom: 12px; font-weight: bold; }
.id-number { font-size: 42px; font-weight: 900; color: var(--primary); font-family: 'Consolas', monospace; letter-spacing: 8px; text-shadow: 0 2px 10px rgba(99, 102, 241, 0.3); line-height: 1;}
.pc-qr-box { display: flex; justify-content: center; background: white; padding: 10px; border-radius: 12px; margin: 0 auto 15px; width: fit-content; min-height: 130px; align-items: center; }
.mobile-qr-btn { display: none !important; }
.id-actions { display: flex; gap: 10px; margin-top: 15px; }
.id-actions .btn { flex: 1; border-radius: 8px; }
.dial-card { background: #1e293b; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid #334155; }
.qr-label { font-size: 13px; color: #cbd5e1; margin-bottom: 15px; font-weight: 600; }
.dial-input { width: 100%; padding: 14px; border-radius: 8px; border: 2px solid #334155; font-size: 20px; text-align: center; font-family: 'Consolas', monospace; font-weight: 900; color: #f8fafc; background: #0f172a; outline: none; transition: 0.2s; letter-spacing: 4px; }
.dial-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
.btn-connect-action { width: 100%; margin-top: 15px; font-size: 16px; padding: 12px; border-radius: 8px; }
.connection-status-card { display: flex; align-items: center; gap: 10px; background: #1e293b; border-radius: 8px; padding: 12px 16px; border: 1px solid #334155; font-size: 13px; color: #cbd5e1; font-weight: 600; margin-top: auto; flex-wrap: wrap; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.status-dot.active { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

.chat-msg-panel { flex: 1; background: #f8fafc; border-radius: 16px; border: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; position: relative;}

/* =========================================================
   对讲机 核心大按钮布局
   ========================================================= */
.ptt-workspace { 
    position: relative; width: 100%; height: 100%; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
    overflow: hidden;
}

.board-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(248,250,252,0.95); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.board-overlay i { font-size: 60px; color: #cbd5e1; margin-bottom: 20px; }
.board-overlay p { font-size: 16px; font-weight: 600; color: #64748b; margin: 0; letter-spacing: 1px;}
.chat-wrapper.is-connected .board-overlay { display: none; }

.ptt-container {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 300px; height: 300px;
}

/* 信号波纹层 (默认隐藏) */
.ptt-ripple-layer {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 180px; height: 180px; border-radius: 50%;
    background: var(--primary);
    opacity: 0; pointer-events: none; z-index: 1;
}

/* 我正在讲话时的红色波纹 */
.ptt-container.talking .ptt-ripple-layer {
    background: var(--danger);
    animation: pttPulse 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* 对方讲话时的绿色波纹 */
.ptt-container.receiving .ptt-ripple-layer {
    background: var(--success);
    animation: pttPulse 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes pttPulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* 核心硬核大圆按钮 */
.ptt-btn {
    position: relative; z-index: 10;
    width: 180px; height: 180px; border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 8px solid #334155;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.2),
        inset 0 4px 10px rgba(255,255,255,0.1),
        inset 0 -10px 20px rgba(0,0,0,0.5);
    color: #cbd5e1; font-size: 60px;
    cursor: pointer; transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; justify-content: center;
    
    /* 移动端核心：关闭一切浏览器默认行为，防止长按弹出菜单或选中文本 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    outline: none;
}

/* 悬停微提 */
.ptt-btn:hover { transform: translateY(-4px); box-shadow: 0 25px 50px rgba(0,0,0,0.25), inset 0 4px 10px rgba(255,255,255,0.1), inset 0 -10px 20px rgba(0,0,0,0.5); border-color: #475569; color: #f8fafc;}

/* 按下：变红，下沉，内阴影加深 */
.ptt-container.talking .ptt-btn {
    transform: scale(0.95) translateY(4px);
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border-color: #fca5a5; color: #ffffff;
    box-shadow: 
        0 5px 15px rgba(239, 68, 68, 0.4),
        inset 0 10px 25px rgba(0,0,0,0.4);
}

/* 接收态：变绿，按钮不可被自己按下干预 */
.ptt-container.receiving .ptt-btn {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    border-color: #6ee7b7; color: #ffffff;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3), inset 0 -10px 20px rgba(0,0,0,0.3);
    pointer-events: none; /* 接收时禁止打断 */
}

/* 状态文字 */
.ptt-status-text {
    position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%);
    font-size: 18px; font-weight: 800; letter-spacing: 2px;
    color: #64748b; transition: 0.3s; white-space: nowrap;
    font-family: 'Consolas', monospace;
}

.ptt-container.talking .ptt-status-text { color: var(--danger); }
.ptt-container.receiving .ptt-status-text { color: var(--success); animation: blink 1s infinite alternate; }

@keyframes blink { from { opacity: 0.4; } to { opacity: 1; } }

/* 弹窗通用样式 */
.overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); z-index: 99999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-box { background: var(--card); padding: 30px; border-radius: 24px; text-align: center; width: 85%; max-width: 340px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); border: 1px solid var(--border); }
.ringing-animation { font-size: 40px; margin-bottom: 15px; animation: bounce 1s infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } }

.btn { border: none; padding: 10px 16px; border-radius: 8px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; font-size: 14px; color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: var(--success); }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }

#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100000; pointer-events: none; }
.toast { background: rgba(0,0,0,0.85); color: white; padding: 10px 24px; border-radius: 25px; font-size: 13px; margin-bottom: 10px; box-shadow: var(--shadow); }

@media (max-width: 850px) { 
    .desktop-only { display: none !important; }
    .pc-qr-box { display: none !important; }
    .mobile-qr-btn { display: inline-flex !important; } 

    .chat-wrapper { height: auto; min-height: calc(100vh - 80px); display: flex; flex-direction: column; }
    .chat-header { padding: 16px 12px; flex-shrink: 0; }
    .chat-title { font-size: 1.4rem; }
    .chat-workspace { padding: 10px; display: flex; flex-direction: column; }
    .chat-layout { flex-direction: column; height: auto; min-height: 500px; gap: 10px; } 
    
    .chat-sys-panel { width: 100%; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow: hidden; border-radius: 12px; flex-shrink: 0; }
    .chat-panel-title { display: none; }
    
    .id-display-card, .dial-card { padding: 10px; margin: 0; display: flex; flex-direction: column; justify-content: center; }
    .id-label, .qr-label { font-size: 10px; margin-bottom: 4px; }
    .id-number { font-size: 22px; letter-spacing: 2px; }
    .id-actions { margin-top: 8px; gap: 6px; }
    .id-actions .btn { font-size: 12px; padding: 6px; }
    .id-actions .btn span, .btn-connect-action span { display: none; }
    .dial-input { font-size: 18px; padding: 6px; margin-bottom: 0; text-align: center; }
    .btn-connect-action { font-size: 13px; padding: 6px; margin-top: 8px; }
    .connection-status-card { grid-column: 1 / 3; margin-top: 0; padding: 8px 12px; }
    
    .chat-wrapper.is-connected .chat-sys-panel { display: flex; padding: 8px; border-bottom: none; box-shadow: none; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .chat-wrapper.is-connected .chat-sys-panel .id-display-card,
    .chat-wrapper.is-connected .chat-sys-panel .dial-card { display: none; }
    .chat-wrapper.is-connected .connection-status-card { margin: 0; width: 100%; }
    .chat-wrapper.is-connected .chat-msg-panel { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: -10px; }
    
    .chat-msg-panel { padding: 0; flex: 1; display: flex; flex-direction: column; }
    
    /* 移动端按钮稍微缩小以适应屏幕 */
    .ptt-btn { width: 150px; height: 150px; border-width: 6px; font-size: 50px; }
    .ptt-ripple-layer { width: 150px; height: 150px; }
    .ptt-status-text { bottom: -50px; font-size: 16px; }
}

[data-theme="dark"]:root { --bg: #1e293b; --card: #0f172a; --text-main: #f8fafc; --text-sub: #94a3b8; --border: #334155; }
[data-theme="dark"] .chat-msg-panel { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .ptt-workspace { background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); }
[data-theme="dark"] .board-overlay { background: rgba(15,23,42,0.9); }
[data-theme="dark"] .ptt-btn { box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 4px 10px rgba(255,255,255,0.05), inset 0 -10px 20px rgba(0,0,0,0.8); }
[data-theme="dark"] .btn-secondary { background: #334155; color: #f8fafc; border: 1px solid #475569; }
[data-theme="dark"] .btn-secondary:hover { background: #475569; }