/* ============================================================
   云鼎研学 · 后台管理样式
   ============================================================ */
:root {
  --red: #c4161c;
  --red-light: #e23b41;
  --ink: #1a1d24;
  --gray: #6b7280;
  --line: #e8eaed;
  --bg: #f4f5f8;
  --sidebar: #1c2030;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(20,22,28,.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(120% 120% at 25% 20%, #2a2e3a 0%, #14161c 60%, #0a0b10 100%); position: relative; overflow: hidden; }
.login-wrap::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 28px 28px; }
.login-wrap .orb { position: absolute; width: 340px; height: 340px; border-radius: 50%; filter: blur(20px); }
.login-wrap .orb.a { background: radial-gradient(circle, rgba(196,22,28,.35), transparent 70%); top: -80px; right: -60px; }
.login-wrap .orb.b { background: radial-gradient(circle, rgba(201,160,99,.3), transparent 70%); bottom: -100px; left: -60px; }
.login-card { position: relative; z-index: 2; width: 400px; max-width: 92vw; background: #fff; border-radius: 18px; padding: 44px 40px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-card .brand .mark { width: 44px; height: 44px; border-radius: 11px; background: linear-gradient(135deg,var(--red),#9c0f14); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; }
.login-card .brand b { font-size: 20px; }
.login-card h1 { font-size: 22px; margin: 18px 0 4px; }
.login-card .sub { color: var(--gray); font-size: 14px; margin-bottom: 28px; }
.login-card .field { margin-bottom: 18px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: #2b3038; }
.login-card input { width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #f7f8fa; transition: all .3s; }
.login-card input:focus { outline: none; border-color: var(--red); background: #fff; box-shadow: 0 0 0 4px rgba(196,22,28,.08); }
.login-card .btn-login { width: 100%; padding: 14px; border: none; border-radius: 10px; background: linear-gradient(120deg,var(--red),var(--red-light)); color: #fff; font-size: 16px; font-weight: 600; margin-top: 8px; transition: all .3s; }
.login-card .btn-login:hover { box-shadow: 0 12px 28px rgba(196,22,28,.35); transform: translateY(-2px); }
.login-card .err { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }
.login-card .tip { text-align: center; color: #9aa2ad; font-size: 12.5px; margin-top: 18px; }

/* ---------- 后台框架 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--sidebar); color: #c4c9d4; flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; }
.sidebar .logo { padding: 24px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo .mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg,var(--red),#9c0f14); display: grid; place-items: center; color: #fff; font-weight: 800; }
.sidebar .logo b { color: #fff; font-size: 17px; }
.sidebar .logo small { display: block; font-size: 11px; color: #8a909d; letter-spacing: 1px; }
.sidebar .menu { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar .menu .group-title { font-size: 11px; color: #6b7280; padding: 14px 12px 8px; letter-spacing: 1px; }
.sidebar .menu a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 9px; font-size: 14.5px; margin-bottom: 3px; transition: all .25s; color: #c4c9d4; }
.sidebar .menu a svg { flex-shrink: 0; opacity: .8; }
.sidebar .menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .menu a.active { background: linear-gradient(120deg,var(--red),var(--red-light)); color: #fff; box-shadow: 0 6px 16px rgba(196,22,28,.3); }
.sidebar .menu a.active svg { opacity: 1; }
.sidebar .foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .foot a { display: block; text-align: center; padding: 10px; border-radius: 9px; background: rgba(255,255,255,.06); font-size: 13.5px; transition: all .25s; }
.sidebar .foot a:hover { background: rgba(255,255,255,.12); color: #fff; }

.main { flex: 1; margin-left: 248px; display: flex; flex-direction: column; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.topbar .crumb { font-size: 15px; font-weight: 600; }
.topbar .crumb span { color: var(--gray); font-weight: 400; }
.topbar .actions { display: flex; align-items: center; gap: 14px; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar .user .avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,var(--red),var(--red-light)); display: grid; place-items: center; color: #fff; font-weight: 700; }
.btn { padding: 9px 18px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 500; transition: all .25s; display: inline-flex; align-items: center; gap: 7px; }
.btn:hover { border-color: var(--red); color: var(--red); }
.btn-primary { background: linear-gradient(120deg,var(--red),var(--red-light)); color: #fff; border-color: transparent; }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 20px rgba(196,22,28,.3); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #f3d2d3; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.content { padding: 28px; flex: 1; }
.panel { display: none; }
.panel.active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { font-size: 21px; }
.panel-head p { color: var(--gray); font-size: 13.5px; margin-top: 2px; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; margin-bottom: 22px; }
.card h3 { font-size: 16px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.card h3 .bar { width: 4px; height: 16px; border-radius: 3px; background: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #2b3038; }
.field input, .field textarea, .field select { width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; transition: all .25s; background: #fafbfc; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px rgba(196,22,28,.07); }
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 12px; color: #9aa2ad; margin-top: 5px; }

/* 列表项卡片（可重复条目） */
.item-list { display: flex; flex-direction: column; gap: 14px; }
.item-row { border: 1px solid var(--line); border-radius: 10px; padding: 18px; position: relative; background: #fcfcfd; transition: all .25s; }
.item-row:hover { border-color: #d8dbe0; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.item-row .row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.item-row .row-head .idx { font-weight: 700; color: var(--red); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.item-row .row-head .ops { display: flex; gap: 6px; }
.icon-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--gray); transition: all .2s; }
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.icon-btn.del:hover { background: var(--red); color: #fff; border-color: var(--red); }

.add-btn { width: 100%; padding: 13px; border: 1.5px dashed #cfd3da; border-radius: 10px; background: transparent; color: var(--gray); font-size: 14px; font-weight: 500; transition: all .25s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.add-btn:hover { border-color: var(--red); color: var(--red); background: rgba(196,22,28,.03); }

/* 标签云编辑 */
.tag-edit { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-edit .tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: #f1f2f5; border-radius: 50px; font-size: 14px; }
.tag-edit .tag button { border: none; background: none; color: #9aa2ad; font-size: 16px; line-height: 1; transition: color .2s; }
.tag-edit .tag button:hover { color: var(--red); }
.tag-add { display: flex; gap: 10px; margin-top: 14px; max-width: 360px; }
.tag-add input { flex: 1; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; }

/* 保存栏 */
.save-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 16px 28px; display: flex; justify-content: flex-end; gap: 12px; margin: 0 -28px -28px; box-shadow: 0 -4px 20px rgba(0,0,0,.04); }

/* Toast */
.toast { position: fixed; top: 80px; right: 28px; background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 10px; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.25); transform: translateX(120%); transition: transform .4s cubic-bezier(.22,1,.36,1); z-index: 999; display: flex; align-items: center; gap: 10px; }
.toast.show { transform: none; }
.toast.ok { background: #1f9d55; }
.toast.err { background: var(--red); }

.preview-thumb { height: 40px; width: 64px; border-radius: 6px; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }
