/* 院小生 管理后台样式 */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --primary: #10b981;
  --primary-dark: #059669;
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
  --sidebar: #1f2937;
  --sidebar-active: #10b981;
  --radius: 8px;
}

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

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

/* ══════════ 登录页 ══════════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
}
.login-logo {
  width: 60px; height: 60px;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 26px; }

/* ══════════ 布局 ══════════ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  background: var(--sidebar);
  color: #d1d5db;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  padding: 20px 18px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 9px;
}
.sidebar .brand .dot {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.sidebar nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.sidebar a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px;
  color: #d1d5db;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: .15s;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active {
  background: rgba(16,185,129,.14);
  color: #fff;
  border-left-color: var(--sidebar-active);
}
.sidebar a .count {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
}
.sidebar a .count.zero { display: none; }
.sidebar .foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: var(--text-3);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }

.content { padding: 22px 24px 60px; }

/* ══════════ 卡片 ══════════ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ══════════ 统计卡 ══════════ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .label { color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat .sub { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.stat.primary .value { color: var(--primary-dark); }
.stat.danger .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }

/* ══════════ 表格 ══════════ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #fafbfc; color: var(--text-2); font-weight: 500; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }
td .title-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════ 徽标 ══════════ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.badge.gray   { background: #f3f4f6; color: #4b5563; }
.badge.green  { background: #d1fae5; color: #065f46; }
.badge.red    { background: #fee2e2; color: #991b1b; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.blue   { background: #dbeafe; color: #1e40af; }
.badge.purple { background: #ede9fe; color: #5b21b6; }

/* ══════════ 按钮 ══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }

/* ══════════ 表单 ══════════ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
textarea { resize: vertical; min-height: 90px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline input, .inline select { width: auto; }

/* ══════════ 标签页 ══════════ */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  padding: 0 18px; background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto;
}
.tabs button {
  padding: 12px 14px;
  border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text-2);
  border-bottom: 2px solid transparent;
  font-family: inherit;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 500; }
.tabs button .pill {
  display: inline-block; margin-left: 5px;
  background: var(--danger); color: #fff;
  font-size: 11px; padding: 0 5px; border-radius: 8px;
}
.tabs button .pill.zero { display: none; }

/* ══════════ 预警 ══════════ */
.alert {
  padding: 11px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert.danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert.warn   { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert.info   { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert.ok     { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ══════════ 进度条（监控用）══════════ */
.meter { margin-bottom: 14px; }
.meter .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter .row .k { color: var(--text-2); }
.meter .row .v { font-weight: 500; }
.bar { height: 7px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); transition: width .3s; }
.bar > i.warn { background: var(--warn); }
.bar > i.danger { background: var(--danger); }

/* ══════════ 键值列表 ══════════ */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv .k { color: var(--text-2); white-space: nowrap; }
.kv .v { color: var(--text); word-break: break-all; }

/* ══════════ 图片预览 ══════════ */
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 5px; border: 1px solid var(--border); cursor: zoom-in;
  background: #f3f4f6;
}
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #f3f4f6; }
.avatar.sm { width: 24px; height: 24px; }

/* ══════════ 提示 Toast ══════════ */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 7px;
  font-size: 14px; z-index: 9999; opacity: 0; transition: .25s; pointer-events: none;
  max-width: 86vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }
#toast.success { background: var(--primary-dark); }

/* ══════════ 图片放大 ══════════ */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 9998;
  display: none; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ══════════ 空态 ══════════ */
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ══════════ 加载 ══════════ */
.loading { text-align: center; padding: 34px; color: var(--text-3); font-size: 13px; }

/* ══════════ 分页 ══════════ */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; font-size: 13px; color: var(--text-2); }

/* ══════════ 弹窗 ══════════ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9997;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 720px) {
  .sidebar { width: 58px; }
  .sidebar .brand span:not(.dot), .sidebar a span:not(.count):not(.ico) { display: none; }
  .sidebar a { justify-content: center; padding: 13px 0; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
}

/* ══════════ 轮播图管理：上传区 ══════════ */
.banner-form {
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 720px) {
  .banner-form { grid-template-columns: 1fr; }
}

.upload-area {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: #fafbfc;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: .18s;
  overflow: hidden;
  padding: 14px;
}
.upload-area:hover { border-color: var(--primary); background: #f0fdf9; }
.upload-area.dragover {
  border-color: var(--primary);
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(16,185,129,.12);
}
.upload-area.busy { pointer-events: none; opacity: .7; }
.upload-area .hint { font-size: 13px; color: var(--text-2); line-height: 1.9; }
.upload-area .hint strong { color: var(--primary-dark); }
.upload-area .hint small { color: var(--text-3); font-size: 12px; }
.upload-area img {
  max-width: 100%;
  max-height: 210px;
  border-radius: 8px;
  display: block;
}
.upload-area .replace-tip {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(31,41,55,.78); color: #fff;
  font-size: 12px; padding: 5px 0; text-align: center;
  opacity: 0; transition: .18s;
}
.upload-area:hover .replace-tip { opacity: 1; }

.upload-progress {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-2);
}
.upload-progress .bar-wrap {
  width: 70%; height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 8px;
}
.upload-progress .bar-wrap > i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .15s; }

.form-fields .field:last-of-type { margin-bottom: 18px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox-line input { width: auto; }

/* 轮播图列表缩略图 */
.banner-thumb {
  width: 132px; height: 70px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
  background: #f3f4f6; cursor: zoom-in; display: block;
}
.banner-thumb.off { opacity: .4; filter: grayscale(1); }
.sort-btns { display: inline-flex; flex-direction: column; gap: 2px; }
.sort-btns button {
  border: 1px solid var(--border); background: #fff; border-radius: 4px;
  width: 24px; height: 18px; line-height: 1; font-size: 10px; cursor: pointer; color: var(--text-2);
  padding: 0;
}
.sort-btns button:hover:not(:disabled) { background: #f3f4f6; color: var(--text); }
.sort-btns button:disabled { opacity: .3; cursor: not-allowed; }
