/* ===== 极光流金主题 ===== */
:root {
  --primary: #533afd;
  --primary-soft: #edeaff;
  --primary-2: #6b5bff;
  --bg: #f7f6ff;
  --surface: #ffffff;
  --ink: #0d253d;
  --ink-2: #5b6b83;
  --line: #ecebf6;
  --amber: #f5a623;
  --ok: #2bb673;
  --warn: #e4572e;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(13,37,61,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC","Microsoft YaHei","Noto Sans SC",system-ui,-apple-system,sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

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

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; transition: width .2s;
}
.sidebar.collapsed { width: 72px; }
.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 12px; font-size: 15px; font-weight: 900; letter-spacing: -0.3px;
}
.side-toggle {
  margin-left: auto; border-radius: 8px; padding: 4px; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.side-toggle:hover { background: var(--bg); color: var(--primary); }
.side-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.side-logo .logo-badge {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #533afd, #7a5bff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
}
.side-logo .logo-text { white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .side-logo { justify-content: center; padding: 20px 12px 12px; }
.sidebar.collapsed .side-toggle { margin-left: 0; }

.side-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 999px; color: var(--ink-2); font-size: 14px; transition: all .15s;
  white-space: nowrap;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px; }
.sidebar.collapsed .nav-label { display: none; }

.side-foot { padding: 12px; border-top: 1px solid var(--line); }
.account-pill {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; background: var(--primary-soft); border-radius: 999px;
  padding: 10px 14px; font-size: 13px;
}
.account-pill .acc-user { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .account-pill { justify-content: center; padding: 10px; }
.sidebar.collapsed .acc-more, .sidebar.collapsed .acc-role { display: none; }
.role-badge { font-size: 11px; background: var(--primary); color: #fff; padding: 1px 8px; border-radius: 999px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .logo-badge { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg,#533afd,#7a5bff); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; flex-shrink:0; }
.topbar .top-title { font-weight: 900; font-size: 15px; }

.hero-strip {
  height: 64px; background:
    radial-gradient(80% 120% at 5% 0%, rgba(83,58,253,.28), transparent 60%),
    radial-gradient(70% 110% at 95% 0%, rgba(245,166,35,.22), transparent 60%),
    radial-gradient(60% 100% at 50% 100%, rgba(123,91,255,.18), transparent 60%),
    linear-gradient(180deg, #f3f0ff, #f7f6ff);
}

.content { flex: 1; padding: 0 28px 32px; margin-top: -34px; position: relative; max-width: 1280px; width: 100%; margin-left: auto; margin-right: auto; }

/* ===== 卡片 ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

/* ===== 顶部工具栏 ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .search-box {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
.toolbar .search-box input { border: none; outline: none; flex: 1; background: transparent; }
.toolbar select, .toolbar .btn { border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.toolbar select { background: var(--surface); border: 1px solid var(--line); }

.btn { border-radius: 8px; padding: 10px 16px; font-size: 14px; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #e2dcff; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fdece8; color: var(--warn); }
.btn-danger:hover { background: #fbdcd5; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ===== 题目卡片 ===== */
.q-list { display: flex; flex-direction: column; gap: 12px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.q-card.hidden-q { opacity: .55; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--ink-2); }
.seq-tag { font-family: "SF Mono",ui-monospace,monospace; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 9px; border-radius: 999px; letter-spacing: .3px; }
.cat-tag { background: var(--bg); padding: 2px 9px; border-radius: 999px; }
.time-tag { color: #9aa7bd; }
.soft-tag { background: var(--amber); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.pending-tag { background: var(--amber); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.q-text { font-size: 15px; line-height: 1.6; margin-bottom: 6px; }
.q-img { margin: 8px 0; border-radius: 8px; overflow: hidden; }
.q-img img { max-height: 340px; object-fit: contain; background: #faf9ff; }
.answer-box { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.answer-box b { color: var(--ok); font-weight: 600; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #d9d6ee; transition: background .2s; flex-shrink: 0; }
.switch.on { background: var(--primary); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on::after { left: 20px; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pager-right { display: flex; align-items: center; gap: 6px; }
.pager-right button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.pager-right button:disabled { opacity: .4; cursor: not-allowed; }
.pageinfo { font-size: 13px; color: var(--ink-2); }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(13,20,40,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-mask.show { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden; box-sizing: border-box; }
.modal.modal-wide { max-width: 900px; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=password], .form-row textarea, .form-row select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; background: var(--surface);
}
.form-row textarea { min-height: 84px; resize: vertical; }
.form-row input[type=text]:focus, .form-row input[type=password]:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--primary); }
.img-preview { margin-top: 8px; border-radius: 8px; overflow: hidden; max-width: 220px; }
.img-preview img { display: block; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ===== 留言 ===== */
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; }
.msg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.msg-nick { font-weight: 600; font-size: 14px; }
.msg-time { font-size: 12px; color: #9aa7bd; }
.msg-content { font-size: 14px; line-height: 1.6; color: var(--ink); margin-bottom: 10px; }
.reply-toggle { font-size: 13px; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.replies { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; display: none; }
.replies.open { display: block; }
.reply-item { padding: 8px 0; border-bottom: 1px solid var(--bg); font-size: 13px; }
.reply-item .r-nick { font-weight: 600; color: var(--primary); }
.reply-item .r-time { font-size: 11px; color: #9aa7bd; margin-left: 8px; }
.reply-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.reply-form input, .reply-form textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; font-size: 13px; }
.reply-form textarea { min-height: 56px; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); font-size: 14px; }

/* ===== toast ===== */
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: opacity .25s; z-index: 100; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ===== 设置/资料 ===== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--bg); }
.setting-row:last-child { border-bottom: none; }
.setting-title { font-weight: 500; font-size: 15px; }
.setting-desc { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 12px; border-bottom: 1px solid var(--bg); text-align: left; vertical-align: top; }
.data-table th { color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.data-table tr:hover td { background: #faf9ff; }

/* ===== checkbox ===== */
.checkbox { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* ===== 登录/注册 ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px 32px; width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 22px; }
.auth-switch { text-align: center; font-size: 13px; margin-top: 16px; color: var(--ink-2); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); width: 240px !important; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .sidebar.collapsed { width: 240px !important; }
  .sidebar.collapsed .logo-text, .sidebar.collapsed .nav-label, .sidebar.collapsed .acc-more { display: block; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 11px 14px; }
  .sidebar.collapsed .account-pill { justify-content: space-between; padding: 10px 14px; }
  .topbar { display: flex; }
  .content { padding: 0 14px 24px; margin-top: -28px; }
  .hero-strip { height: 56px; }
  /* 题目操作按钮移到信息下方独立一行 */
  .q-actions { width: 100%; order: 3; }
  .q-meta { order: 1; }
  .q-body { order: 2; }
  .q-card { display: flex; flex-direction: column; }
  .q-actions .btn, .q-actions .switch-row { margin-top: 0; }
}

.hidden { display: none !important; }

/* ===== 图片灯箱 ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.88);
  display: none; flex-direction: column;
}
.lightbox.show { display: flex; }
.lightbox-toolbar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; background: rgba(0,0,0,.6); flex-shrink: 0;
}
.lightbox-toolbar button {
  width: 36px; height: 36px; border-radius: 8px; background: rgba(255,255,255,.15);
  color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.lightbox-toolbar button:hover { background: rgba(255,255,255,.3); }
.lightbox-toolbar .lb-close { width: auto; padding: 0 16px; font-size: 14px; }
.lightbox-zoom-label { color: #fff; font-size: 14px; min-width: 60px; text-align: center; }
.lightbox-body {
  flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lightbox-body img {
  transform-origin: center center; transition: transform .15s;
  max-width: 100%; max-height: 100%;
}
