/* ============================================================
   ClawBot PC端 - 专业科技风 / 玻璃拟态
   ============================================================ */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(0, 212, 255, 0.15);
  --accent-cyan: #00d4ff;
  --accent-purple: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #00d4ff, #7c3aed);
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --bubble-out: linear-gradient(135deg, #00d4ff22, #7c3aed22);
  --bubble-in: rgba(31, 41, 55, 0.8);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* 动态蜘蛛网背景 */
#spiderweb-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; opacity: 0.4;
}

.hidden { display: none !important; }

/* ==================== 玻璃拟态基础 ==================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

/* ==================== 登录页 ==================== */
.login-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.login-glass {
  width: 420px; padding: 48px 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 60px rgba(0, 212, 255, 0.1);
  text-align: center;
}
.login-logo { margin-bottom: 20px; }
.login-title {
  font-size: 32px; font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin: 8px 0 32px; }
.login-form .input-group { margin-bottom: 16px; }
.login-form input {
  width: 100%; padding: 14px 18px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 15px;
  outline: none; transition: all 0.3s;
}
.login-form input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}
.btn-login {
  width: 100%; padding: 14px; margin-top: 8px;
  background: var(--accent-gradient);
  border: none; border-radius: var(--radius-sm);
  color: white; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.3s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3); }
.login-footer { margin-top: 24px; font-size: 12px; color: var(--text-muted); }

/* ==================== 主界面布局 ==================== */
.main-app {
  position: relative; z-index: 1;
  height: 100vh; display: flex; flex-direction: column;
}

/* 顶部导航 */
.top-bar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; margin: 12px; margin-bottom: 0;
  border-radius: var(--radius);
}
.top-left { display: flex; align-items: center; gap: 24px; }
.app-icon { display: flex; align-items: center; }
.app-name { font-size: 18px; font-weight: 700; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: transparent; border: none;
  color: var(--text-secondary); font-size: 14px; cursor: pointer;
  border-radius: var(--radius-sm); transition: all 0.2s;
}
.nav-tab:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.nav-tab.active { color: var(--accent-cyan); background: rgba(0, 212, 255, 0.1); }
.top-right { display: flex; align-items: center; gap: 12px; }
.status-indicator { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; border-radius: 50%; transition: all 0.2s;
}
.icon-btn:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }

/* 页面内容 */
.page-content { flex: 1; padding: 12px; overflow: auto; }

/* ==================== 聊天布局 ==================== */
.chat-layout {
  display: grid; grid-template-columns: 280px 1fr 280px;
  gap: 12px; height: calc(100vh - 92px);
}

/* 侧边栏 */
.sidebar { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-header { padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.search-input {
  width: 100%; padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
  outline: none; margin-bottom: 10px;
}
.search-input:focus { border-color: var(--accent-cyan); }
.filter-tabs { display: flex; gap: 6px; }
.filter-tab {
  flex: 1; padding: 6px; background: transparent; border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary); font-size: 12px; cursor: pointer; border-radius: 6px;
}
.filter-tab.active { color: var(--accent-cyan); border-color: var(--accent-cyan); background: rgba(0, 212, 255, 0.08); }
.customer-list { flex: 1; overflow-y: auto; padding: 8px; }
.customer-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
  margin-bottom: 4px;
}
.customer-item:hover { background: rgba(255, 255, 255, 0.04); }
.customer-item.active { background: rgba(0, 212, 255, 0.1); border: 1px solid rgba(0, 212, 255, 0.2); }
.customer-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-gradient); display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: white; position: relative;
}
.customer-avatar.online::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%; background: var(--success);
  border: 2px solid var(--bg-secondary);
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; }
.customer-time { font-size: 11px; color: var(--text-muted); }
.customer-msg { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.customer-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: white; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* 聊天区 */
.chat-area { display: flex; flex-direction: column; overflow: hidden; }
.chat-header {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.back-btn { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; }
.chat-user-name { font-size: 16px; font-weight: 600; }
.chat-user-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chat-header-right { display: flex; gap: 8px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.empty-chat { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 16px; }
.msg-time-sep { text-align: center; margin: 12px 0; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.msg-row { display: flex; gap: 10px; margin-bottom: 4px; max-width: 75%; }
.msg-row.out { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
}
.msg-row.in .msg-avatar { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }
.msg-row.out .msg-avatar { background: var(--accent-gradient); color: white; }
.msg-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6;
  word-break: break-word; position: relative;
}
.msg-row.in .msg-bubble { background: var(--bubble-in); border: 1px solid rgba(255, 255, 255, 0.06); border-top-left-radius: 4px; }
.msg-row.out .msg-bubble { background: var(--bubble-out); border: 1px solid rgba(0, 212, 255, 0.2); border-top-right-radius: 4px; }
.msg-bubble img { max-width: 240px; border-radius: 8px; cursor: pointer; }
.msg-bubble .file-item { display: flex; align-items: center; gap: 10px; padding: 8px; }
.msg-bubble .file-icon { width: 40px; height: 40px; background: rgba(0, 212, 255, 0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.msg-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-align: right; }

/* 输入区 */
.chat-input-area {
  border-top: 1px solid rgba(255, 255, 255, 0.06); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.input-tools { display: flex; gap: 4px; }
.tool-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary); cursor: pointer;
  border-radius: 8px; transition: all 0.2s;
}
.tool-btn:hover { color: var(--accent-cyan); background: rgba(0, 212, 255, 0.08); }
.message-input {
  width: 100%; min-height: 60px; max-height: 150px; resize: none;
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
  padding: 12px; outline: none; font-family: inherit;
}
.message-input:focus { border-color: var(--accent-cyan); }
.send-btn {
  align-self: flex-end; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-gradient); border: none; color: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3); }

/* 信息面板 */
.info-panel { padding: 20px; overflow-y: auto; }
.info-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); gap: 12px; }
.info-section { margin-bottom: 24px; }
.info-section h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.info-row .label { color: var(--text-secondary); }
.info-row .value { color: var(--text-primary); font-weight: 500; }

/* ==================== 仪表盘 ==================== */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { padding: 24px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.stat-icon.users { background: rgba(0, 212, 255, 0.15); }
.stat-icon.online { background: rgba(16, 185, 129, 0.15); }
.stat-icon.messages { background: rgba(124, 58, 237, 0.15); }
.stat-icon.unread { background: rgba(239, 68, 68, 0.15); }
.stat-value { font-size: 28px; font-weight: 700; display: block; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.chart-card { padding: 24px; }
.chart-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ==================== 推送/保活列表 ==================== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.btn-primary {
  padding: 10px 20px; background: var(--accent-gradient); border: none;
  border-radius: var(--radius-sm); color: white; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3); }
.push-list, .keepalive-list { display: flex; flex-direction: column; gap: 12px; }
.push-item, .keepalive-item {
  padding: 20px; display: flex; justify-content: space-between; align-items: center;
}
.push-item-info h4, .keepalive-item-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.push-item-info p, .keepalive-item-info p { font-size: 13px; color: var(--text-secondary); }
.push-item-actions, .keepalive-item-actions { display: flex; gap: 8px; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.1); background: transparent; color: var(--text-secondary); cursor: pointer; }
.btn-sm:hover { color: var(--text-primary); border-color: var(--accent-cyan); }
.btn-sm.danger:hover { color: var(--danger); border-color: var(--danger); }
.status-tag { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.status-tag.pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-tag.running { background: rgba(0, 212, 255, 0.15); color: var(--accent-cyan); }
.status-tag.completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-tag.failed { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ==================== 设置页 ==================== */
.settings-layout { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.setting-section { padding: 24px; }
.setting-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.setting-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.setting-row label { font-size: 14px; color: var(--text-secondary); min-width: 80px; }
.setting-row input, .setting-row select {
  flex: 1; padding: 10px 14px; background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; outline: none;
}
.setting-row input:focus, .setting-row select:focus { border-color: var(--accent-cyan); }

/* ==================== 弹窗 ==================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
}
.modal-box {
  width: 480px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 28px;
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.modal-message { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.btn-cancel { padding: 10px 20px; background: transparent; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; }
.btn-confirm { padding: 10px 20px; background: var(--accent-gradient); border: none; border-radius: var(--radius-sm); color: white; cursor: pointer; }
.modal-form .form-group { margin-bottom: 16px; }
.modal-form label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.modal-form input, .modal-form textarea, .modal-form select {
  width: 100%; padding: 10px 14px; background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; outline: none; font-family: inherit;
}
.modal-form textarea { min-height: 80px; resize: vertical; }

/* ==================== Toast ==================== */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px;
  z-index: 300; animation: toastIn 0.3s ease;
}
.toast-info { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-primary); }
.toast-success { background: rgba(16, 185, 129, 0.2); border: 1px solid var(--success); color: var(--success); }
.toast-error { background: rgba(239, 68, 68, 0.2); border: 1px solid var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ==================== 表情面板 ==================== */
.emoji-panel {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  width: 400px; max-height: 250px; overflow-y: auto; padding: 16px;
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: 12px; z-index: 150; display: grid;
  grid-template-columns: repeat(10, 1fr); gap: 4px;
}
.emoji-panel span { font-size: 20px; text-align: center; cursor: pointer; padding: 4px; border-radius: 6px; }
.emoji-panel span:hover { background: rgba(255, 255, 255, 0.1); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
