/* ================================================================
   平台总部管理后台 - 样式表 (桌面端优化)
   ================================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #E8615D;
  --primary-dark: #D04A46;
  --primary-light: #FDE8E7;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1890ff;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e8e8e8;
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: linear-gradient(180deg, #2d1b2e 0%, #1a1a2e 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon { font-size: 32px; }
.logo-title { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: #fff;
  background: rgba(232,97,93,0.2);
  border-left-color: var(--primary);
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
  display: none;
}

.nav-badge.show { display: inline-block; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #faad14;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

/* ===== 主内容区 ===== */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: calc(100vw - var(--sidebar-width));
}

/* 顶部栏 */
.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.topbar-time { font-size: 13px; color: var(--text-muted); }
.topbar-user { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.btn-logout {
  padding: 6px 16px;
  border: 1px solid #ffcccc;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.2s;
}

.btn-logout:hover { background: #fff2f0; border-color: var(--primary); }

.btn-refresh {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-refresh:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* 页面切换 */
.page { display: none; padding: 24px 32px; }
.page.active { display: block; }

/* ===== 统计卡片 ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.stat-icon.red { background: #FDE8E7; }
.stat-icon.blue { background: #E6F7FF; }
.stat-icon.green { background: #F6FFED; }
.stat-icon.orange { background: #FFF7E6; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== 通用卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  width: 100%;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title { font-size: 15px; font-weight: 600; }
.card-link { font-size: 13px; color: var(--primary); cursor: pointer; }

/* ===== 图表区域 ===== */
.dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dash-chart-card .card-header { border-bottom: none; }

.chart-wrap { padding: 0 16px 16px; height: 300px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-pie { height: 320px; }

/* ===== 数据表格 ===== */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #fafafa;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

.data-table tbody tr:hover { background: #fafafa; }

/* ===== 状态标签 ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #F6FFED; color: var(--success); }
.badge-warning { background: #FFF7E6; color: var(--warning); }
.badge-danger { background: #FFF2F0; color: var(--danger); }
.badge-info { background: #E6F7FF; color: var(--info); }
.badge-default { background: #f5f5f5; color: var(--text-muted); }

/* ===== 筛选区 ===== */
.filter-row { display: flex; gap: 10px; align-items: center; }

.filter-select, .filter-input {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}

.filter-select:focus, .filter-input:focus { border-color: var(--primary); }
.filter-input { width: 200px; }

/* ===== 订单状态标签栏 ===== */
.order-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.order-tab {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}
.order-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
}
.order-tab.active {
  color: #fff;
  background: var(--primary);
  font-weight: 600;
}

/* ===== 按钮 ===== */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }

/* 分页 */
.pagination {
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ===== 入驻审核卡片 ===== */
.app-card {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 20px;
}

.app-card:last-child { border-bottom: none; }

.app-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.app-info { flex: 1; min-width: 0; }

.app-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.app-name { font-size: 15px; font-weight: 600; }

.app-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.app-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.app-photo {
  width: 72px; height: 72px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
  overflow: hidden;
}

.app-photo:hover { border-color: var(--primary); }
.app-photo img { width: 100%; height: 100%; object-fit: cover; }

.app-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.section-label {
  padding: 12px 24px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: none;
}

.modal-mask.show { display: block; }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 201;
  display: none;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

.modal.show { display: block; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
textarea.form-input { resize: vertical; min-height: 72px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

/* ===== 图片预览 ===== */
.img-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 999;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.img-overlay.show { display: flex; }
.img-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .logo-text, .sidebar .nav-item span:not(.nav-icon), .sidebar .nav-badge { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 14px 0; }
  .main { margin-left: 60px; width: calc(100vw - 60px); }
  .topbar { padding: 0 16px; }
  .page { padding: 16px; }
  .stat-cards { grid-template-columns: 1fr; }
}

/* ===== 登录页 ===== */
.login-page {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b2e 50%, #3d2a3e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo {
  font-size: 56px;
  margin-bottom: 8px;
}

.login-brand {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 2px;
}

.login-sub {
  font-size: 13px;
  color: #999;
  margin-bottom: 36px;
}

.login-form { text-align: left; }

.login-field {
  display: flex;
  align-items: center;
  background: #f5f6fa;
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 16px;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.login-field:focus-within {
  border-color: #E8615D;
  background: #fff;
}

.login-field-icon {
  font-size: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

.login-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 0;
  font-size: 15px;
  color: #1a1a2e;
  outline: none;
  font-family: inherit;
}

.login-input::placeholder { color: #bbb; }

.login-error {
  font-size: 13px;
  color: #ff4d4f;
  min-height: 20px;
  margin-bottom: 8px;
  text-align: center;
}

.login-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #E8615D, #D04A46);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 4px;
  transition: all 0.2s;
}

.login-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,97,93,0.4); }
.login-btn:active { transform: translateY(0); }
.login-btn.loading { opacity: 0.7; pointer-events: none; }

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: #ccc;
}
