/* styles.css - Enterprise WeChat Management System */
/* Base styles */
:root {
  --primary: #07C160;
  --primary-dark: #06AD56;
  --primary-light: #E8F8EE;
  --sidebar-bg: #2E3238;
  --sidebar-hover: #3A3F45;
  --sidebar-active: #07C160;
  --header-bg: #FFFFFF;
  --card-bg: #FFFFFF;
  --body-bg: #F5F5F5;
  --text-primary: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #E8E8E8;
  --danger: #E53935;
  --warning: #FF9800;
  --info: #2196F3;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --sidebar-width: 240px;
  --header-height: 60px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
.app-container { display: flex; height: 100vh; width: 100vw; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 12px; }
.sidebar-logo {
  width: 36px; height: 36px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 700;
}
.sidebar-title { color: #fff; font-size: 16px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.2s;
  font-size: 14px; border-left: 3px solid transparent; text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--primary); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.nav-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); font-size: 12px; text-align: center; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.header {
  height: var(--header-height); background: var(--header-bg);
  border-bottom: 1px solid var(--border-color); display: flex;
  align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0;
}
.header-search { flex: 1; max-width: 360px; position: relative; }
.header-search input {
  width: 100%; height: 36px; padding: 0 36px 0 14px;
  border: 1px solid var(--border-color); border-radius: 18px;
  background: var(--body-bg); font-size: 13px; outline: none; transition: border-color 0.2s;
}
.header-search input:focus { border-color: var(--primary); }
.header-search .search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-btn {
  width: 36px; height: 36px; border: none; background: transparent;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: var(--text-secondary); font-size: 18px; position: relative; transition: background 0.2s;
}
.header-btn:hover { background: var(--body-bg); }
.header-btn .badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }
.header-user { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 20px; cursor: pointer; transition: background 0.2s; }
.header-user:hover { background: var(--body-bg); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.user-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }
.page-hidden { display: none !important; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.green { background: #E8F8EE; color: #07C160; }
.stat-icon.blue { background: #E3F2FD; color: #2196F3; }
.stat-icon.orange { background: #FFF3E0; color: #FF9800; }
.stat-icon.purple { background: #F3E5F5; color: #9C27B0; }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.stat-change { font-size: 12px; color: var(--primary); margin-top: 4px; }
.stat-change.down { color: var(--danger); }
.section { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 20px; }
.section-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.section-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.section-actions { display: flex; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 6px; border: 1px solid transparent; font-size: 13px;
  cursor: pointer; transition: all 0.2s; font-weight: 500; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border-color); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; font-size: 16px; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--body-bg); border-bottom: 2px solid var(--border-color);
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #FAFAFA; }
.table-user { display: flex; align-items: center; gap: 10px; }
.table-user-info { display: flex; flex-direction: column; }
.table-user-name { font-weight: 500; color: var(--text-primary); }
.table-user-meta { font-size: 12px; color: var(--text-muted); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-badge.approved { background: #E8F8EE; color: #07C160; }
.status-badge.approved .dot { background: #07C160; }
.status-badge.pending { background: #FFF3E0; color: #E65100; }
.status-badge.pending .dot { background: #FF9800; }
.status-badge.rejected { background: #FFEBEE; color: #C62828; }
.status-badge.rejected .dot { background: #E53935; }
.status-badge.active { background: #E3F2FD; color: #1565C0; }
.status-badge.active .dot { background: #2196F3; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; margin: 1px; }
.tag-vip { background: #FFF3E0; color: #E65100; }
.tag-agent { background: #E3F2FD; color: #1565C0; }
.tag-new { background: #E8F8EE; color: #07C160; }
.tabs { display: flex; border-bottom: 1px solid var(--border-color); }
.tab { padding: 12px 20px; font-size: 13px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; transition: all 0.2s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-control { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 13px; outline: none; transition: border-color 0.2s; }
.form-control:focus { border-color: var(--primary); }
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 90%; max-width: 520px; max-height: 80vh; overflow-y: auto; transform: scale(0.95); transition: transform 0.2s; }
.modal-overlay.show .modal { transform: scale(1); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border: none; background: transparent; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: background 0.2s; }
.modal-close:hover { background: var(--body-bg); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; transition: box-shadow 0.2s; cursor: pointer; }
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0; }
.card-title { font-size: 14px; font-weight: 600; }
.card-meta { font-size: 12px; color: var(--text-muted); }
.card-body { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.card-footer { display: flex; gap: 8px; flex-wrap: wrap; }
.activity-list { padding: 0; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 12px; transition: 0.3s; }
.toggle-slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }
.automation-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.automation-item:last-child { border-bottom: none; }
.automation-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.automation-info { flex: 1; min-width: 0; }
.automation-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.automation-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.automation-status { display: flex; align-items: center; gap: 8px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4 { margin-top: 4px; }
.mb-4 { margin-bottom: 4px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CCC; border-radius: 3px; }
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar-title, .sidebar-footer, .nav-item .nav-text, .nav-item .nav-badge { display: none; }
  .sidebar-header { justify-content: center; padding: 12px; }
  .nav-item { justify-content: center; padding: 14px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
}
