/* ============================================================
   单词猫英语学习系统 - 管理员后台样式（PC + 手机自适应）
   ============================================================ */
:root {
  --bg: #f4f6fa;
  --card: #fff;
  --ink: #333;
  --muted: #7a8699;
  --primary: #ff8c42;
  --primary-d: #e76f2e;
  --soft: #fff3e6;
  --green: #4caf50;
  --red: #e05252;
  --blue: #2b6cb0;
  --sidebar: #232a3b;
  --sidebar-hover: #2e3750;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--blue); text-decoration: none; }
.muted { color: var(--muted); font-size: .9em; }
.hidden { display: none !important; }
.mt10 { margin-top: 10px; }
.mt20 { margin-top: 20px; }

/* ---------- 布局 ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: var(--sidebar); color: #cdd3e0; padding: 18px 0; position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; }
.side-brand { color: #fff; font-weight: 800; padding: 6px 20px 18px; font-size: 1.15rem; border-bottom: 1px solid #2e3750; }
.sidebar nav { flex: 1; padding-top: 10px; }
.sidebar nav a { display: block; padding: 11px 20px; color: #aab3c5; }
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar nav a.active { background: var(--sidebar-hover); color: #fff; border-left: 3px solid var(--primary); }
.side-foot { padding: 12px 20px; font-size: .85rem; color: #7c86a0; border-top: 1px solid #2e3750; }
.side-foot a { color: #ffb37a; }
.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  background: #fff; padding: 14px 24px; display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid #e6e9f0; position: sticky; top: 0; z-index: 40;
}
.admin-topbar h1 { font-size: 1.15rem; margin: 0; }
#sideToggle { background: none; border: 1px solid #ddd; border-radius: 8px; font-size: 1.1rem; cursor: pointer; padding: 4px 10px; display: none; }
.admin-content { padding: 24px; max-width: 1240px; }

/* ---------- 统计卡片 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); }
.stat-card b { font-size: 1.6rem; color: var(--primary-d); display: block; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 1.05rem; margin-bottom: 12px; }
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; text-align: left; font-size: .9rem; vertical-align: middle; }
table.data th { background: #f7f9fc; color: #5a6a85; font-weight: 600; white-space: nowrap; }
table.data tr:hover td { background: #fafbfd; }
table.data tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 18px; padding: 7px 16px; font-size: .88rem;
  cursor: pointer; font-weight: 600; transition: .15s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #12823c; }
.btn-soft { background: var(--soft); color: var(--primary-d); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0c9c9; }
.btn-danger:hover { background: #fdf3f3; }
.btn-sm { padding: 4px 12px; font-size: .82rem; }
.btn-xs { padding: 2px 10px; font-size: .78rem; border-radius: 14px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  padding: 8px 10px; border: 1.5px solid #e3e3e3; border-radius: 8px; font-size: .9rem; outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { font-size: .85rem; color: var(--muted); display: block; margin: 10px 0 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.mini-input { width: 130px; }
.add-user-box { background: var(--soft, #f7f9fc); border: 1px dashed #c9d6e8; border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.add-user-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.add-user-form label { display: flex; flex-direction: column; font-size: .82rem; color: #666; gap: 4px; }
.add-user-form input, .add-user-form select { min-width: 150px; }
.mini-select { width: auto; min-width: 110px; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input[type=text] { width: 220px; }
.filter-bar select { width: auto; }
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 5px 12px; border-radius: 8px; background: #fff; border: 1px solid #e3e3e3; font-size: .88rem; color: var(--ink);
}
.pagination .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover { border-color: var(--primary); }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: .78rem; font-weight: 600; }
.badge-green { background: #e8f7e8; color: #2e7d32; }
.badge-red { background: #fdeaea; color: #c0392b; }
.badge-orange { background: var(--soft); color: var(--primary-d); }
.badge-blue { background: #e8f0fd; color: var(--blue); }

/* ---------- 统计条 ---------- */
.hbar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .88rem; }
.hbar-row .lbl { width: 110px; flex-shrink: 0; color: #555; }
.hbar { flex: 1; background: #f0ece6; border-radius: 7px; height: 14px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb37a, #ff8c42); border-radius: 7px; transition: width .4s; }
.hbar-row .val { width: 70px; text-align: right; color: var(--muted); flex-shrink: 0; }

/* ---------- 详情折叠 ---------- */
details.user-detail { margin-top: 8px; }
details.user-detail summary { cursor: pointer; color: var(--blue); font-size: .88rem; }
details.user-detail .detail-body { background: #f8fafc; border-radius: 10px; padding: 12px; margin-top: 8px; font-size: .9rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kv div { background: #fff; border-radius: 8px; padding: 8px 10px; }
.kv b { color: var(--primary-d); }

/* ---------- 后台登录 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #eef2f8, #dfe6f0); padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(60, 80, 120, .15); padding: 30px 28px; width: 100%; max-width: 380px; }
.auth-card .brand-big { font-size: 1.35rem; font-weight: 800; text-align: center; color: var(--sidebar); }
.auth-card .sub { text-align: center; color: var(--muted); margin: 4px 0 16px; font-size: .9rem; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 12px; }
.alert-err { background: #fdeaea; color: #c0392b; }
.alert-ok { background: #e8f7e8; color: #2e7d32; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  #sideToggle { display: block; }
  .sidebar { position: fixed; left: -240px; transition: .2s; z-index: 90; }
  .sidebar.open { left: 0; box-shadow: 8px 0 24px rgba(0, 0, 0, .18); }
  .admin-content { padding: 16px; }
}


/* 视频上传进度条 */
.up-progress { height: 8px; background: #eee; border-radius: 5px; overflow: hidden; }
.up-progress i { display: block; height: 100%; width: 0; background: #4aa8ff; border-radius: 5px; transition: width .2s; }
.btn-warning { background: #fff7e6; border: 1px solid #ffc53d; color: #ad6800; }
.btn-warning:hover { background: #ffe7ba; }
