/* MCN Workbench - Main Styles */
:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #3730A3;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --bg: #F3F4F6;
  --card-bg: #FFFFFF;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --sidebar-width: 240px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Login ─────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: var(--text);
}
.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}
.login-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--border-light);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.login-card .btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 8px;
}
.error-msg {
  color: var(--danger);
  background: #FEF2F2;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}

/* ─── Layout ─────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-logo h2 { font-size: 18px; font-weight: 700; color: var(--primary); }
.sidebar-logo .slogan { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px; }
.sidebar-nav .nav-section { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 12px 8px 6px; font-weight: 600; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--border-light); color: var(--text); }
.sidebar-nav a.active { background: var(--primary); color: white; }
.sidebar-nav a .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-user .info .name { font-size: 13px; font-weight: 600; }
.sidebar-user .info .role { font-size: 11px; color: var(--text-muted); }
.sidebar-footer .logout { font-size: 12px; color: var(--text-muted); margin-top: 8px; display: block; text-decoration: none; }
.sidebar-footer .logout:hover { color: var(--danger); }

/* Main content */
.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 28px 32px; }

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header .breadcrumb { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─── Cards ──────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Stat cards */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .change { font-size: 12px; margin-top: 4px; }
.stat-card .change.up { color: var(--success); }
.stat-card .change.down { color: var(--danger); }

/* ─── Tables ─────────────────────────── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  background: var(--border-light);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
table tbody tr:hover { background: #F9FAFB; }

/* ─── Badges ─────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.8;
}
.badge-primary { background: #EEF2FF; color: var(--primary); }
.badge-success { background: #ECFDF5; color: #065F46; }
.badge-warning { background: #FFFBEB; color: #92400E; }
.badge-danger { background: #FEF2F2; color: #991B1B; }
.badge-info { background: #EFF6FF; color: #1E40AF; }
.badge-gray { background: #F3F4F6; color: #4B5563; }

/* Platform badges */
.badge-douyin { background: #111; color: #fff; }
.badge-xiaohongshu { background: #FE2C55; color: #fff; }
.badge-weibo { background: #E6162D; color: #fff; }

/* ─── Buttons ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-outline {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--border-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

/* ─── Forms ──────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
select.form-control { appearance: none; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236B7280' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 30px; }
textarea.form-control { min-height: 100px; resize: vertical; }

/* ─── Filters bar ────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filters-bar .form-control { width: auto; min-width: 140px; }
.filters-bar .search-input { width: 220px; }

/* ─── Modal ──────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  padding: 24px;
}
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ─── Two column layout ──────────────── */
.content-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 20px; margin-bottom: 24px; }
.content-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Summary cards ──────────────────── */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}
.summary-card .value { font-size: 24px; font-weight: 700; }
.summary-card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Tags ───────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: #F3F4F6;
  color: #4B5563;
  margin: 1px 2px;
}

/* ─── Script Editor ─────────────────── */
.script-editor textarea {
  min-height: 300px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.8;
}

/* ─── Account Detail ────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.detail-header .avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
.detail-header .info h3 { font-size: 20px; }
.detail-header .info p { color: var(--text-muted); font-size: 13px; }
.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-stat {
  text-align: center;
  padding: 14px;
  background: var(--border-light);
  border-radius: var(--radius);
}
.detail-stat .val { font-size: 20px; font-weight: 700; }
.detail-stat .lbl { font-size: 11px; color: var(--text-muted); }

/* ─── Chart placeholder ──────────────── */
.chart-area {
  height: 200px;
  background: var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 12px;
}
.chart-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
  position: relative;
}
.chart-bar:hover { background: var(--primary-dark); }

/* ─── Responsive ─────────────────────── */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .content-grid-2 { grid-template-columns: 1fr; }
}

/* ─── Misc ───────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.number { font-family: 'SF Mono', 'Menlo', 'Monaco', monospace; }
