/* ============================================================
   远程协助管理系统 - 全局样式
   ============================================================ */
:root {
    --bg-dark: #0f1923;
    --bg-sidebar: #1a2332;
    --bg-main: #151d2b;
    --bg-card: #1e2d3d;
    --bg-input: #0d1520;
    --border-color: #2a3a4e;
    --text-primary: #e1e8ed;
    --text-secondary: #8899a6;
    --accent: #1da1f2;
    --accent-hover: #0d8ecf;
    --danger: #e0245e;
    --danger-hover: #c91d4f;
    --success: #17bf63;
    --warning: #ffad1f;
    --bubble-sent: #1da1f2;
    --bubble-recv: #253341;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.2);
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; background: var(--bg-dark); color: var(--text-primary); font-size: 14px; }

/* ---- 布局 ---- */
.app-container { display: flex; height: 100vh; }

/* ---- 侧边栏 ---- */
.sidebar {
    width: 320px; min-width: 320px; background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color); display: flex; flex-direction: column;
    transition: margin-left var(--transition), min-width var(--transition), width var(--transition);
}
.sidebar.collapsed { margin-left: -320px; min-width: 0; width: 0; overflow: hidden; }
.sidebar-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.sidebar-header h2 { font-size: 16px; font-weight: 600; }
.sidebar-actions { display: flex; gap: 4px; }
.sidebar-search { padding: 8px 16px; }
.sidebar-search input { width: 100%; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius); color: var(--text-primary); outline: none; font-size: 13px; }
.sidebar-search input:focus { border-color: var(--accent); }
.group-filter { padding: 0 16px 8px; }
.group-filter select { width: 100%; padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius); color: var(--text-primary); font-size: 13px; }
.device-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.device-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-radius: var(--radius); cursor: pointer; transition: background var(--transition);
    border-bottom: 1px solid transparent;
}
.device-item:hover { background: var(--bg-card); }
.device-item.active { background: var(--bg-card); border-bottom-color: var(--accent); }
.device-avatar { width: 44px; height: 44px; border-radius: 6px; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; position: relative; }
.device-avatar .status-dot { position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg-sidebar); }
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-secondary); }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); text-align: center; }
.online-badge { background: var(--success); color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }

/* ---- 主内容 ---- */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-main); }

/* ---- 顶部栏 ---- */
.top-bar { display: flex; align-items: center; padding: 12px 20px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color); gap: 12px; min-height: 56px; }
.current-device { display: flex; align-items: center; gap: 8px; flex: 1; }
.device-icon { font-size: 20px; }
.current-device-name { font-weight: 600; font-size: 15px; }
.status-badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.status-badge.online { background: rgba(23,191,99,0.15); color: var(--success); }
.status-badge.offline { background: rgba(136,153,166,0.15); color: var(--text-secondary); }
.top-bar-actions { display: flex; align-items: center; gap: 8px; }
.user-info { font-size: 13px; color: var(--text-secondary); }

/* ---- 按钮 ---- */
.btn { padding: 8px 16px; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 13px; transition: all var(--transition); white-space: nowrap; }
.btn:hover { opacity: 0.85; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #000; }
.btn-lg { padding: 12px 32px; font-size: 15px; }
.icon-btn { width: 32px; height: 32px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; border-radius: var(--radius); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--bg-card); color: var(--text-primary); }

/* ---- 工具栏标签 ---- */
.toolbar { padding: 0 20px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color); }
.toolbar-tabs { display: flex; gap: 0; overflow-x: auto; }
.toolbar-tabs .tab { padding: 10px 18px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; transition: all var(--transition); white-space: nowrap; }
.toolbar-tabs .tab:hover { color: var(--text-primary); }
.toolbar-tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ---- 面板 ---- */
.panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.panel.active { display: flex; }
.panel-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.panel-toolbar input, .panel-toolbar select { padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius); color: var(--text-primary); font-size: 13px; }

/* ---- 聊天面板 ---- */
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.message { display: flex; flex-direction: column; max-width: 70%; }
.message.sent { align-self: flex-end; align-items: flex-end; }
.message.received { align-self: flex-start; align-items: flex-start; }
.message .bubble {
    padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
    word-break: break-word; max-width: 100%; position: relative;
}
.message.sent .bubble { background: var(--bubble-sent); color: #fff; border-bottom-right-radius: 4px; }
.message.received .bubble { background: var(--bubble-recv); color: var(--text-primary); border-bottom-left-radius: 4px; }
.message .bubble.image-bubble { padding: 4px; background: transparent; }
.message .bubble.image-bubble img { max-width: 100%; border-radius: 12px; cursor: pointer; }
.message .msg-time { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.message .msg-action { font-size: 11px; color: var(--accent); margin-bottom: 2px; }
.system-notice { text-align: center; padding: 6px 16px; font-size: 12px; color: var(--text-secondary); background: var(--bg-card); border-radius: 12px; align-self: center; }

.chat-input-area { padding: 12px 20px; border-top: 1px solid var(--border-color); background: var(--bg-sidebar); }
.quick-actions { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.quick-btn { padding: 4px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; color: var(--text-secondary); cursor: pointer; font-size: 12px; transition: all var(--transition); }
.quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 20px; color: var(--text-primary); font-size: 14px; outline: none; }
.chat-input-row input:focus { border-color: var(--accent); }

/* ---- 数据表格 ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.data-table th { background: var(--bg-card); color: var(--text-secondary); font-weight: 500; position: sticky; top: 0; z-index: 1; }
.data-table tbody tr:hover { background: rgba(29,161,242,0.05); }
.data-table .file-icon { font-size: 18px; margin-right: 8px; }
.data-table .action-btns { display: flex; gap: 4px; }
.file-list, .process-table-wrap { flex: 1; overflow: auto; }
.breadcrumb { font-size: 13px; color: var(--text-secondary); flex: 1; }
.breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.breadcrumb span { margin: 0 4px; }

/* ---- Shell ---- */
.shell-output { flex: 1; overflow-y: auto; padding: 16px 20px; background: #0a0e14; font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.shell-output .cmd-line { color: var(--accent); }
.shell-output .cmd-result { color: #c5d0dc; }
.shell-output .cmd-error { color: var(--danger); }
.shell-input-row { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: #0a0e14; border-top: 1px solid var(--border-color); }
.shell-prompt { color: var(--success); font-family: monospace; font-size: 13px; white-space: nowrap; }
.shell-input-row input { flex: 1; padding: 6px 10px; background: transparent; border: none; color: #c5d0dc; font-family: monospace; font-size: 13px; outline: none; }

/* ---- 截图区域 ---- */
.screenshot-area { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.screenshot-area img { max-width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; }
.screenshot-history { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; }
.screenshot-history img { width: 150px; height: auto; border-radius: 4px; cursor: pointer; opacity: 0.8; transition: opacity var(--transition); }
.screenshot-history img:hover { opacity: 1; }
.empty-state { text-align: center; color: var(--text-secondary); padding: 60px 20px; font-size: 15px; }

/* ---- 系统控制 ---- */
.system-controls { padding: 20px; display: flex; justify-content: center; }
.control-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; text-align: center; max-width: 500px; width: 100%; }
.control-card h3 { font-size: 18px; margin-bottom: 12px; }
.control-warning { color: var(--warning); font-size: 13px; margin-bottom: 20px; }
.control-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- 弹窗 ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--bg-sidebar); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.5); max-width: 900px; width: 90%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 1000px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 24px; cursor: pointer; padding: 0 4px; }
.modal-body { flex: 1; overflow: auto; padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border-color); }

/* ---- 进度条 ---- */
.progress-bar { height: 4px; background: var(--bg-input); border-radius: 2px; overflow: hidden; margin: 4px 0; }
.progress-bar .fill { height: 100%; background: var(--accent); transition: width 0.3s; border-radius: 2px; }

/* ---- 文件搜索 ---- */
.file-search { display: flex; gap: 8px; padding: 8px 20px; border-top: 1px solid var(--border-color); }
.file-search input { flex: 1; }

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d5068; }

/* ---- 响应式 ---- */
.mobile-only { display: none !important; }
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 100; height: 100%; width: 300px; min-width: 300px; }
    .sidebar.collapsed { margin-left: -300px; }
    .mobile-only { display: flex !important; }
    .message { max-width: 85%; }
    .top-bar-actions .btn span.hide-mobile { display: none; }
    .toolbar-tabs .tab { padding: 8px 12px; font-size: 12px; }
}
