/* ============================================
   Prompt & Seed 管理助手 - 全局样式（响应式）
   ============================================ */
:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #ccfbf1;
  --accent: #0ea5e9;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.06);
  --nav-bg: #0f172a;
}

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

html { -webkit-text-size-adjust: 100%; }

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

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

/* ---------- 顶部导航 ---------- */
.nav {
  background: var(--nav-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  white-space: nowrap;
}
.nav-brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
}
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-links a {
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.nav-links a.active { background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(20, 184, 166, 0.15);
  color: #5eead4;
  border: 1px solid rgba(20, 184, 166, 0.35);
}
.badge.off { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border-color: rgba(148, 163, 184, 0.35); }

/* ---------- 通用布局 ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  background: var(--primary);
  color: #fff;
  min-height: 40px;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #e2e8f0; color: var(--text); }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 32px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }

/* ---------- 表单 ---------- */
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.form-error.show { display: block; }

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

/* ---------- 搜索与筛选 ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.toolbar .search-box { flex: 1; min-width: 220px; position: relative; }
.toolbar .search-box .input { padding-left: 38px; }
.toolbar .search-box::before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--text-secondary);
}
.model-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.model-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  min-height: 32px;
}
.model-chip:hover { border-color: var(--primary); color: var(--primary); }
.model-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------- 记录卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.record-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.record-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  border-color: var(--primary);
}
.record-card .prompt-preview {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 65px;
}
.record-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.tag.seed { background: #e0f2fe; color: #0369a1; }
.tag.video { background: #fef3c7; color: #b45309; }
.tag.model { background: #ede9fe; color: #6d28d9; }
.tag.image { background: #dcfce7; color: #15803d; }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-header h3 { font-size: 17px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ---------- 详情 ---------- */
.detail-video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 16/9; }
.detail-field { margin-bottom: 16px; }
.detail-field .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.detail-field .value {
  font-size: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  word-break: break-all;
  white-space: pre-wrap;
}
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .value { flex: 1; }
.copy-row .btn { flex-shrink: 0; }

/* ---------- 管理表格（桌面） ---------- */
.table-wrap { overflow-x: auto; }
table.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
}
.list-table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.list-table tr:hover td { background: #f8fafc; }
.list-table .prompt-cell { max-width: 420px; }
.list-table .prompt-cell .truncate {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* ---------- 登录 ---------- */
.login-wrap {
  max-width: 400px;
  margin: 40px auto;
  padding: 28px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.login-wrap h2 { font-size: 20px; margin-bottom: 6px; }
.login-wrap .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

/* ---------- API 文档 ---------- */
.doc-layout { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.doc-nav { position: sticky; top: 84px; }
.doc-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.doc-nav a:hover { background: #e2e8f0; color: var(--text); text-decoration: none; }
.doc-nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.doc-section { margin-bottom: 28px; }
.doc-section h2 { font-size: 20px; margin-bottom: 12px; }
.doc-section h3 { font-size: 16px; margin: 18px 0 10px; }
.endpoint {
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: nowrap;
}
.code-block {
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 13px;
  overflow-x: auto;
  margin: 10px 0 14px;
  white-space: pre-wrap;
  word-break: break-all;
}
.code-block .method { color: #5eead4; font-weight: 700; }
.code-block .url { color: #93c5fd; }
.code-block .comment { color: #94a3b8; }
.param-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 16px; }
.param-table th, .param-table td {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
}
.param-table th { background: #f8fafc; font-size: 12px; }
.param-table code { background: #f1f5f9; padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.required { color: var(--danger); font-weight: 600; }
.opt { color: var(--text-secondary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: #0f172a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 300;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }
.pagination .info { font-size: 13px; color: var(--text-secondary); }

/* ---------- 加载 ---------- */
.loading { text-align: center; padding: 50px; color: var(--text-secondary); }

/* ---------- 响应式：移动端 ---------- */
@media (max-width: 768px) {
  .nav-inner { padding: 0 14px; height: 54px; gap: 4px; }
  .nav-brand { font-size: 15px; margin-right: 6px; }
  .nav-brand .logo { width: 26px; height: 26px; font-size: 13px; }
  .nav-links a { padding: 7px 10px; font-size: 13px; }
  .container { padding: 18px 14px 50px; }
  .page-title { font-size: 20px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
  .modal-body { padding: 16px; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
  .doc-nav a { padding: 6px 10px; font-size: 13px; margin-bottom: 0; }
  .table-wrap { display: none; } /* 移动端隐藏桌面表格，使用卡片列表 */
  .mobile-cards { display: block; }
  .toolbar .search-box { min-width: 100%; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
  .row-actions { flex-direction: column; }
  .row-actions .btn { width: 100%; }
}

/* 桌面端隐藏移动卡片 */
.mobile-cards { display: none; }
@media (min-width: 769px) {
  .mobile-cards { display: none !important; }
}
