/* ============================================================
   AI摄影私教 - 管理后台样式
   深色主题 + 琥珀珊瑚渐变（与小程序品牌一致）
   ============================================================ */

:root {
  --bg: #0A0A0F;
  --bg-card: #111120;
  --bg-card-2: #1a1a2e;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e8e8;
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-faint: rgba(255, 255, 255, 0.3);
  --primary: #F59E0B;
  --secondary: #EF4444;
  --gradient: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --success: #4ADE80;
  --danger: #EF4444;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #ffc04d; }

/* ─── 登录页 ─── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(245,158,11,0.12) 0%, rgba(239,68,68,0.05) 40%, transparent 70%), var(--bg);
  padding: 20px;
}
.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo { font-size: 48px; text-align: center; margin-bottom: 12px; }
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.login-sub { text-align: center; color: var(--text-faint); font-size: 12px; margin-bottom: 28px; }

/* ─── 表单 ─── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-faint); }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control option { background: #1a1a2e; color: var(--text); }

/* ─── 按钮 ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 4px 16px rgba(239,68,68,0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239,68,68,0.4); }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.14); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── 布局 ─── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-brand .logo { font-size: 28px; }
.sidebar-brand .name {
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 16px;
}
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--text-dim);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.sidebar-nav a.active {
  color: var(--primary);
  background: rgba(245,158,11,0.08);
  border-left-color: var(--primary);
}
.sidebar-nav a .nav-emoji { font-size: 16px; }

.main {
  flex: 1;
  padding: 28px 36px 60px;
  max-width: 1400px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}
.page-desc { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* ─── 卡片 ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── 统计卡片（仪表盘） ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.dark { background: rgba(255,255,255,0.08); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-dim); }

/* ─── 表格 ─── */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table .actions { white-space: nowrap; display: flex; gap: 6px; }

/* ─── 徽章 ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: rgba(74,222,128,0.12); color: var(--success); }
.badge-dim { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--primary); }

/* ─── 弹窗 ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ─── Toast 提示 ─── */
.toast-box {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease;
}
.toast-success { background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.3); color: var(--success); }
.toast-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── 工具类 ─── */
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mb-0 { margin-bottom: 0 !important; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; color: var(--primary); }
.key-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--primary);
  font-family: Consolas, monospace;
  font-size: 12px;
}

/* ─── 分类管理（左列表右内容） ─── */
.split-layout { display: flex; gap: 20px; align-items: flex-start; }
.split-side { width: 260px; flex-shrink: 0; }
.split-main { flex: 1; min-width: 0; }

.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.2s;
}
.cat-item:hover { background: rgba(255,255,255,0.05); }
.cat-item.active { border-color: var(--primary); background: rgba(245,158,11,0.08); }
.cat-item .cat-count {
  font-size: 12px;
  color: var(--text-faint);
  background: rgba(255,255,255,0.06);
  padding: 1px 8px;
  border-radius: 10px;
}
.cat-actions { display: none; gap: 4px; }
.cat-item:hover .cat-actions { display: flex; }
.cat-actions .mini-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}
.cat-actions .mini-btn:hover { color: var(--primary); }
.cat-actions .mini-btn.del:hover { color: var(--danger); }

/* ─── 模板画廊 ─── */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.tpl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s;
}
.tpl-card:hover { transform: translateY(-3px); }
.tpl-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-card-2);
  display: block;
}
.tpl-card.portrait .tpl-thumb { height: 240px; }
.tpl-body { padding: 12px 14px; }
.tpl-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.tpl-meta { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tpl-actions { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.04); }

/* 构图建议图示缩略图（表格内） */
.tip-thumb {
  width: 56px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  cursor: pointer;
  display: block;
}

/* ─── 上传预览 ─── */
.upload-preview {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 10px;
  display: none;
}
.upload-preview.show { display: block; }
.upload-preview.landscape { width: 160px; height: 100px; }

/* ─── 空状态 ─── */
.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-faint);
  font-size: 14px;
}
.empty .empty-emoji { font-size: 40px; display: block; margin-bottom: 10px; }

/* ─── 响应式 ─── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand .name { display: none; }
  .sidebar-nav a span.nav-text { display: none; }
  .main { padding: 16px; }
  .split-layout { flex-direction: column; }
  .split-side { width: 100%; }
}
