/* public/assets/css/social_office/p2p-file.css */
.chat-wrapper { 
    --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);
    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; }

/* PC 布局 */
.chat-layout { display: flex; gap: 24px; align-items: stretch; height: 75vh; min-height: 650px; max-height: 900px; 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: #6366f1; 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: var(--card); border-radius: 16px; border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 20px; min-width: 0; min-height: 0; overflow: hidden; }
.chat-msg-panel .chat-panel-title { color: var(--text-main); border-bottom-color: var(--border); flex-shrink: 0; margin-bottom: 0; }

.transfer-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; flex-shrink: 0; }
.spec-item { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); min-width: 0; }
.spec-item i { font-size: 18px; background: var(--card); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0; }
.spec-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.spec-text strong { font-size: 13px; color: var(--text-main); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-text span { font-size: 11px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 拖拽热区 */
.drop-zone { border: 2px dashed var(--border); border-radius: 16px; background: var(--bg); padding: 30px 20px; text-align: center; cursor: pointer; transition: 0.3s; flex-shrink: 0; opacity: 0.6; pointer-events: none; }
.chat-wrapper.is-connected .drop-zone { opacity: 1; pointer-events: auto; }
.chat-wrapper.is-connected .drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.drop-icon { font-size: 40px; color: var(--primary); margin-bottom: 12px; transition: transform 0.3s; }
.drop-zone:hover .drop-icon { transform: translateY(-5px); }
.drop-title { font-size: 16px; font-weight: 700; color: var(--text-main); margin: 0 0 8px 0; }
.drop-desc { font-size: 12px; color: var(--text-sub); margin: 0; }

/* 传输列表区 */
.file-list-container { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow-y: auto; padding: 16px; }
.file-list-container::-webkit-scrollbar { width: 6px; }
.file-list-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sub); font-size: 14px; opacity: 0.6; }
.empty-state i { font-size: 36px; margin-bottom: 12px; color: #cbd5e1; }

.file-item { position: relative; display: flex; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); margin-bottom: 12px; transition: 0.2s; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.file-item:last-child { margin-bottom: 0; }
.file-icon-box { width: 42px; height: 42px; background: #f1f5f9; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #64748b; margin-right: 14px; flex-shrink: 0; }
[data-theme="dark"] .file-icon-box { background: #1e293b; }
.file-info-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.file-name { font-size: 14px; font-weight: 700; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.file-meta-row { display: flex; align-items: center; font-size: 11.5px; color: var(--text-sub); flex-wrap: wrap; gap: 8px; }
.file-speed-text { color: var(--primary); font-family: 'Consolas', monospace; font-weight: 800; }
.file-status { font-weight: 700; }
.status-sending { color: var(--primary); }
.status-success { color: var(--success); }

.progress-track { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: transparent; transition: opacity 0.3s; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.1s linear; }

.file-action-box { margin-left: 12px; flex-shrink: 0; }
.btn-download-icon { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(16, 185, 129, 0.15); color: var(--success); text-decoration: none; transition: 0.2s; font-size: 14px; }
.btn-download-icon:hover { background: var(--success); color: white; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2); }

/* =========================================================
   【更新】底部的优雅 Bento Grid (便当盒) - 图标同行模式
   ========================================================= */
.chat-features-bento {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 0 24px 24px 24px;
}

.bento-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    gap: 10px; /* 减小间距使整体更紧凑 */
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

/* 将图标和标题组合在一行 */
.bento-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 缩小独立成行的图标，适配文本同行显示 */
.bento-icon {
    width: 36px;
    height: 36px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.bento-card.privacy .bento-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.bento-card.size .bento-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.bento-card.batch .bento-icon { background: rgba(168, 85, 247, 0.1); color: var(--secondary); }

.bento-card h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.bento-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.6;
}

/* 通用弹窗组件 */
.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: 10000; 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 { padding: 10px; margin: 0; display: flex; flex-direction: column; justify-content: center; }
    .id-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 { display: none; }

    .dial-card { padding: 10px; margin: 0; display: flex; flex-direction: column; justify-content: center; }
    .qr-label { font-size: 10px; margin-bottom: 4px; }
    .dial-input { font-size: 18px; padding: 6px; margin-bottom: 0; text-align: center; }
    .btn-connect-action { font-size: 13px; padding: 6px; margin-top: 8px; }
    .btn-connect-action span { display: none; }
    
    .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-left-radius: 0; border-bottom-right-radius: 0; border-bottom: none; box-shadow: none; }
    .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: 10px; gap: 10px; flex: 1; display: flex; flex-direction: column; }
    
    .transfer-specs { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; margin-bottom: 4px; }
    .transfer-specs::-webkit-scrollbar { height: 0; display: none; }
    .spec-item { flex: 0 0 85%; scroll-snap-align: center; padding: 8px; gap: 8px; border-radius: 8px;}
    .spec-item i { font-size: 18px; width: 32px; height: 32px; border-radius: 8px;}
    
    .drop-zone { padding: 12px 10px; display: flex; flex-direction: column; justify-content: center; min-height: 70px; }
    .drop-icon { font-size: 24px; margin-bottom: 4px; }
    .drop-title { font-size: 13px; margin-bottom: 0; }
    .drop-desc { display: none; } 
    
    .file-list-container { max-height: 350px; overflow-y: auto; padding: 8px; }
    
    .file-item { padding: 10px; margin-bottom: 8px; border-radius: 10px; }
    .file-icon-box { width: 32px; height: 32px; font-size: 14px; margin-right: 10px; border-radius: 8px; }
    .file-name { font-size: 13px; }
    .file-meta-row { font-size: 10.5px; gap: 6px; }
    .file-action-box { margin-left: 8px; }
    .btn-download-icon { width: 28px; height: 28px; font-size: 12px; }

    /* Bento Grid 移动端自适应排版 (图标同行模式) */
    .chat-features-bento { grid-template-columns: 1fr; padding: 0 10px 20px 10px; gap: 12px; }
    .bento-card { padding: 16px; gap: 8px; border-radius: 12px; }
    .bento-header { gap: 10px; }
    .bento-icon { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
    .bento-card h3 { font-size: 0.95rem; }
}

/* =========================================================
   暗色模式适配 (Dark Mode)
   ========================================================= */
[data-theme="dark"] .chat-wrapper { --bg: #1e293b; --card: #0f172a; --text-main: #f8fafc; --text-sub: #94a3b8; --border: #334155; }
[data-theme="dark"] .chat-msg-panel .chat-panel-title { color: #f8fafc; }
[data-theme="dark"] .file-item { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .btn-secondary { background: #334155; color: #f8fafc; border: 1px solid #475569; }
[data-theme="dark"] .btn-secondary:hover { background: #475569; }
[data-theme="dark"] .bento-card { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bento-card:hover { border-color: var(--primary); }