/* ============================================================
   找到 · 管理后台 — 基础样式（变量/重置/布局/登录页）
   PC + 移动双端响应式（<768px 侧边栏抽屉式）
   ============================================================ */

:root {
  --primary: #2b7fff;
  --primary-dark: #1a5fd0;
  --primary-light: #eaf2ff;
  --success: #16a34a;
  --success-light: #e8f7ee;
  --warning: #f59e0b;
  --warning-light: #fdf3e2;
  --danger: #dc2626;
  --danger-light: #fdecec;
  --info: #0891b2;
  --info-light: #e4f6fa;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --bg: #f3f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #1e2a3a;
  --sidebar-text: #c7d2e0;
  --sidebar-active: #2b7fff;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 8px 24px rgba(17, 24, 39, 0.12);
  --sidebar-w: 220px;
  --topbar-h: 56px;
}

/* ---------- 重置 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

button { font-family: inherit; }

/* ---------- 通用工具类 ---------- */
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #2b7fff 55%, #38bdf8 100%);
  padding: 16px;
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.login-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.login-sub {
  margin-top: 8px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}

.login-form { margin-top: 28px; }

.login-tip {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

/* ---------- 主布局 ---------- */
.main-body { overflow: hidden; }

.layout { display: flex; height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.25s ease;
  z-index: 30;
}

.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-name { font-size: 18px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 10px; }

.menu-group-label {
  padding: 10px 12px 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
}

.menu-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.menu-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.menu-item .menu-icon { width: 18px; text-align: center; font-size: 16px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

/* 遮罩（移动端抽屉） */
.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}

/* 主区域 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 10;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--text-2);
  cursor: pointer;
  display: none;
}

.icon-btn:hover { background: var(--bg); }

.topbar-title { font-size: 16px; font-weight: 600; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-name { font-size: 13px; color: var(--text-2); }
.admin-role {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-3);
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 12px; }
  .admin-name, .admin-role { display: none; }
  .topbar-right .btn-sm { padding: 4px 8px; font-size: 12px; }
}

@media (min-width: 768px) {
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
}
