/* help来了 后台管理系统 - 样式 */
:root {
  --primary: #FF8C42;
  --primary-dark: #e67320;
  --primary-light: #fff3e8;
  --sidebar-bg: #2d3748;
  --sidebar-hover: #4a5568;
  --bg: #f7f8fc;
  --card-bg: #fff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --success: #48bb78;
  --danger: #f56565;
  --warning: #ed8936;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.text-muted { color: var(--text-light); font-size: 13px; }
.text-center { text-align: center; }

/* 登录页 */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #f6a355 0%, #FF8C42 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-logo { font-size: 48px; margin-bottom: 10px; }
.login-header h1 { font-size: 24px; color: var(--text); }
.login-header p { font-size: 14px; color: var(--text-light); margin-top: 4px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-group input, .form-input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,140,66,0.1); }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 20px; }
.form-result { margin-top: 12px; font-size: 13px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px;
  border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: all 0.2s;
  font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e53e3e; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #38a169; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* 管理后台布局 */
.admin-app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 18px; }
.sidebar-header p { font-size: 11px; opacity: 0.6; margin-top: 2px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-item {
  display: flex; align-items: center; padding: 12px 20px; cursor: pointer; transition: all 0.2s;
  font-size: 14px; color: rgba(255,255,255,0.8); border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--primary); }
.nav-icon { margin-right: 10px; font-size: 16px; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); display: flex;
  justify-content: space-between; align-items: center;
}
.admin-info { display: flex; flex-direction: column; font-size: 12px; }
.admin-role { opacity: 0.6; font-size: 11px; }

/* 主内容 */
.main-content { margin-left: 240px; flex: 1; padding: 24px; }

/* 页面 */
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; }
.page-desc { font-size: 13px; color: var(--text-light); }

/* 卡片 */
.card { background: var(--card-bg); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 15px; }
.card-body { padding: 20px; }

/* 统计网格 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin: 8px 0 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat-card.stat-orange { border-left: 4px solid var(--primary); }
.stat-card.stat-green { border-left: 4px solid var(--success); }
.stat-card.stat-red { border-left: 4px solid var(--danger); }
.stat-card.stat-blue { border-left: 4px solid #4299e1; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; font-size: 12px; color: var(--text-light); border-bottom: 2px solid var(--border); font-weight: 600; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table tr:hover td { background: #fafafa; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-success { background: #c6f6d5; color: #22543d; }
.badge-danger { background: #fed7d7; color: #9b2c2c; }
.badge-warning { background: #feebc8; color: #7b341e; }
.badge-info { background: #bee3f8; color: #2a4365; }

/* 模态框 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 12px; padding: 24px; z-index: 1001; min-width: 400px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; }
.modal-close { font-size: 24px; cursor: pointer; color: var(--text-light); }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* 日志条目 */
.log-entry { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-entry:last-child { border-bottom: none; }
.log-time { color: var(--text-light); font-size: 11px; }
.log-user { font-weight: 500; }

/* 工具栏 */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; }
.search-box input { width: 220px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.search-box input:focus { border-color: var(--primary); }
.filter-box { display: flex; gap: 6px; }
.form-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff; cursor: pointer; }
.form-select:focus { border-color: var(--primary); }

/* 表格容器 */
.table-wrapper { overflow-x: auto; padding: 0; }
.table { min-width: 800px; }

/* 危险行 */
.row-danger td { background: #fff5f5; }
.row-danger:hover td { background: #ffe0e0 !important; }

/* 趋势图 */
.trend-container { padding: 10px 0; }
.trend-legend { display: flex; gap: 20px; margin-bottom: 16px; font-size: 13px; }
.legend-order::before { content: '▮'; color: var(--primary); margin-right: 4px; }
.legend-user::before { content: '▮'; color: #4299e1; margin-right: 4px; }
.trend-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 0 10px; }
.trend-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.trend-bar {
  width: 60%; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px;
  transition: height 0.3s; position: relative; margin-bottom: 2px;
}
.trend-bar-user { background: #4299e1; }
.trend-value { font-size: 10px; color: var(--text-light); position: absolute; top: -16px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.trend-label { font-size: 10px; color: var(--text-light); text-align: center; margin-top: 4px; }

/* 超级管理员专属 */
.badge-default { background: #e2e8f0; color: #4a5568; }
.stat-danger { border-left: 4px solid #e53e3e; }
.stat-info { border-left: 4px solid #805ad5; }
.text-muted small { font-size: 11px; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .sidebar-header p, .nav-item span:not(.nav-icon), .admin-info { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-footer { flex-direction: column; gap: 8px; }
  .main-content { margin-left: 60px; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { width: 90%; margin: 20px; }
  .modal { min-width: auto; width: 90%; }
}

/* Tab按钮 */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn { padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; color: var(--text-light); transition: all 0.2s; }
.tab-btn:hover { color: var(--text); background: #f7f8fc; }
.tab-btn.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: #f0f5ff; font-weight: 600; }

/* 原生时间输入框 */
input[type="date"] { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
input[type="date"]:focus { border-color: var(--primary); }

/* 侧边栏新消息徽章 */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  margin-left: auto;
}

/* 限制徽章 */
.limit-badge {
  display: inline-block; padding: 2px 8px; background: #ebf8ff; color: #2b6cb0;
  border-radius: 12px; font-size: 12px; font-weight: 600;
}
.limit-badge:hover { background: #bee3f8; }

/* 客服对话布局 */
.cs-chat-layout { display: flex; height: calc(100vh - 160px); gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.cs-user-list { width: 260px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: #fafafa; }
.cs-user-list-header { padding: 14px 16px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border); background: #fff; }
.cs-users { flex: 1; overflow-y: auto; }
.cs-user-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.2s; }
.cs-user-item:hover { background: #f0f5ff; }
.cs-user-item.active { background: #e6f0ff; border-left: 3px solid var(--primary); }
.cs-user-name { font-size: 14px; font-weight: 500; }
.cs-user-preview { font-size: 12px; color: #999; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-user-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.cs-user-time { font-size: 11px; color: #bbb; }
.cs-unread-badge { background: #f56565; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.cs-chat-main { flex: 1; display: flex; flex-direction: column; background: #fff; }
.cs-chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); font-weight: 500; background: #fafafa; }
.cs-messages { flex: 1; overflow-y: auto; padding: 20px; background: #f8f9fa; }
.cs-msg { margin-bottom: 16px; display: flex; flex-direction: column; align-items: flex-start; }
.cs-msg.cs-reply { align-items: flex-end; }
.cs-msg-inner { display: flex; align-items: flex-end; max-width: 80%; gap: 8px; }
.cs-reply .cs-msg-inner { flex-direction: row-reverse; }
.cs-msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #718096; flex-shrink: 0; font-weight: 600; }
.cs-reply .cs-msg-avatar { background: #FF8C42; color: #fff; }
.cs-msg-body { max-width: 400px; }
.cs-msg-name { font-size: 11px; color: #a0aec0; margin-bottom: 4px; padding: 0 4px; }
.cs-reply .cs-msg-name { text-align: right; }
.cs-msg-bubble { padding: 10px 16px; border-radius: 12px; font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.cs-msg-admin .cs-msg-bubble { background: #fff; color: #1a1a1a; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.cs-msg-user .cs-msg-bubble { background: #3182ce; color: #fff; border-bottom-right-radius: 4px; }
.cs-msg-time { font-size: 11px; color: #cbd5e0; margin-top: 2px; padding: 0 4px; }
.cs-input-area { display: flex; padding: 12px 16px; border-top: 1px solid var(--border); background: #fafafa; }

/* 底部版权信息 */
.footer-copyright {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #999;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  line-height: 1.8;
}
.footer-copyright a:hover {
  text-decoration: underline !important;
  color: var(--primary) !important;
}

/* 登录页版权信息 */
.login-copyright {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: #999;
  line-height: 1.8;
}
