/* =====================================================================
   admin.css — 后台管理页样式
   ===================================================================== */

:root {
  --bg: #06060a;
  --bg-2: #0b0b14;
  --bg-3: #11111d;
  --text: #f4f5f9;
  --text-dim: #a0a2b5;
  --text-faint: #6b6d80;
  --blue: #00d4ff;
  --green: #b6ff2e;
  --purple: #b026ff;
  --violet: #7c3aed;
  --grad: linear-gradient(135deg, #00d4ff 0%, #7c3aed 55%, #b026ff 100%);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --danger: #ff5c7a;
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 布局 ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  padding: 0 10px 24px;
  letter-spacing: 0.03em;
}

.brand span { color: var(--blue); }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.side-link {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.side-link:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.side-link.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.sidebar-foot a { color: var(--text-dim); }
.sidebar-foot a:hover { color: var(--blue); }

.btn-link {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
  padding: 0;
}

/* ---------- 主内容区 ---------- */
.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(6, 6, 10, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
}

.content {
  padding: 28px;
  max-width: 1080px;
}

/* ---------- 面板 ---------- */
.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-head h2 {
  font-size: 1.5rem;
}

.sub {
  margin: 28px 0 14px;
  font-size: 1.05rem;
  color: var(--text);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  letter-spacing: 0.03em;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
}

.btn-primary:hover { transform: translateY(-2px); }

.btn-ghost {
  background: var(--glass-strong);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.btn-danger {
  background: rgba(255, 92, 122, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 92, 122, 0.3);
}

.btn-danger:hover { background: rgba(255, 92, 122, 0.22); }

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.field input,
.field textarea,
.field select {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.field select option { background: var(--bg-2); }

/* ---------- 动态列表（教育 / 技能 / 社交） ---------- */
.dynamic-list { display: flex; flex-direction: column; gap: 12px; }

.dyn-row {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass);
  position: relative;
}

.dyn-row .dyn-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.dyn-row input {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}

.dyn-row input:focus { border-color: var(--blue); }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass);
}

.list-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.7rem;
}

.list-thumb img { width: 100%; height: 100%; object-fit: cover; }

.list-info { flex: 1; min-width: 0; }
.list-info h4 { font-size: 0.98rem; margin-bottom: 2px; }
.list-info .list-sub { font-size: 0.8rem; color: var(--text-faint); }

.list-actions { display: flex; gap: 8px; flex-shrink: 0; }

.list-actions button {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.list-actions button:hover { color: var(--text); border-color: var(--blue); }
.list-actions button.del:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  animation: modalIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body { padding: 28px; }
.modal-body h2 { font-size: 1.3rem; margin-bottom: 20px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ---------- 上传预览 ---------- */
.upload-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.upload-box:hover { border-color: var(--blue); }

.upload-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-3);
  flex-shrink: 0;
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }

.upload-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* 形象照上传（证件照比例竖版） */
.avatar-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  max-width: 320px;
}

.avatar-upload:hover { border-color: var(--blue); }

.avatar-upload .upload-preview {
  width: 120px;
  height: auto;
  aspect-ratio: 5 / 7;
  flex-shrink: 0;
}

.upload-hint { font-size: 0.8rem; color: var(--text-faint); }

/* 多图上传 */
.images-editor { display: flex; flex-direction: column; gap: 10px; }

.img-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.img-row input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.img-row .img-thumb { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--bg-3); }
.img-row .img-thumb img { width: 100%; height: 100%; object-fit: cover; }

.img-row button {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- 密码卡片 ---------- */
.pw-card {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass);
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 4000;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--green); color: var(--green); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open { transform: translateX(0); }

  .menu-toggle { display: block; }

  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
