/* ===== PromptVault · 提示词资产库 ===== */
:root {
  --bg: #0B1220;
  --bg-soft: #101a2e;
  --panel: #131f36;
  --panel-2: #182742;
  --line: #24354f;
  --text: #E6EDF7;
  --text-dim: #93a5c0;
  --accent: #22D3EE;
  --accent-deep: #0ea5c4;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --warn: #F87171;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(59, 130, 246, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.6 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 顶栏 ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.85);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; flex: none; }
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: 0.3px; }
.brand-sub { color: var(--text-dim); font-weight: 400; font-size: 15px; }
.brand-slogan { margin: 1px 0 0; font-size: 12px; color: var(--text-dim); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; width: 300px; color: var(--text-dim);
  transition: border-color 0.15s;
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox input {
  background: none; border: none; outline: none; color: var(--text);
  width: 100%; font-size: 13px;
}
.searchbox input::placeholder { color: #5d708f; }

/* ---- 按钮 ---- */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: #35507a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04222b; font-weight: 600; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); border-color: rgba(248, 113, 113, 0.4); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.08); }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 8px; }

/* ---- 布局 ---- */
.layout { display: flex; min-height: calc(100vh - 76px); }
.sidebar {
  width: 230px; flex: none; padding: 20px 18px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 22px;
}
.side-block h3 {
  margin: 0 0 10px; font-size: 12px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1px;
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text-dim);
  font-size: 13px; margin-bottom: 2px;
}
.side-list li:hover { background: var(--panel); color: var(--text); }
.side-list li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-list .count { font-size: 11px; color: #5d708f; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 12px; color: var(--text-dim); background: var(--panel);
  border: 1px solid var(--line); padding: 2px 9px; border-radius: 99px; cursor: pointer;
}
.tag-chip:hover { color: var(--text); }
.tag-chip.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.stats { display: grid; gap: 8px; }
.stat-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); }
.stat-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; font-size: 11.5px; color: #56688a; line-height: 1.7; }

.content { flex: 1; padding: 22px 26px 60px; min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

/* ---- 空态 ---- */
.empty { text-align: center; padding: 90px 20px; color: var(--text-dim); }
.empty-title { font-size: 17px; color: var(--text); margin: 0 0 6px; }
.empty-sub { margin: 0 0 18px; }

/* ---- 卡片 ---- */
.pv-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 9px;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  position: relative;
}
.pv-card:hover { border-color: #35507a; transform: translateY(-2px); box-shadow: var(--shadow); }
.pv-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pv-name { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.pv-category {
  flex: none; font-size: 11px; color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(34, 211, 238, 0.3); padding: 2px 8px; border-radius: 99px;
}
.pv-body {
  margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.65;
  max-height: 88px; overflow: hidden; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  white-space: pre-wrap;
}
.pv-body code, .var-preview code, .receive-preview code, .hint code {
  font-family: Consolas, monospace; color: var(--accent); background: var(--accent-soft);
  padding: 0 4px; border-radius: 4px; font-size: 12px;
}
.pv-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.pv-tag { font-size: 11px; color: var(--text-dim); background: rgba(147, 165, 192, 0.1); padding: 1px 8px; border-radius: 99px; }
.pv-meta { font-size: 11px; color: #56688a; display: flex; gap: 10px; align-items: center; }
.pv-actions { display: flex; gap: 6px; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 2px; }
.pv-actions .btn { flex: 1; padding: 6px 4px; font-size: 12px; text-align: center; }
.pv-use-badge {
  position: absolute; top: -8px; right: 12px; font-size: 10.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 99px; padding: 1px 8px;
}

/* ---- 弹窗 ---- */
.modal {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; width: min(680px, 92vw); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(4, 8, 16, 0.66); backdrop-filter: blur(2px); }
.modal h2 { margin: 0 0 6px; font-size: 17px; }
.modal form label, .modal > label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.modal input[type="text"], .modal textarea {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 9px 12px; font-size: 13.5px; outline: none;
  font-family: inherit; resize: vertical;
}
.modal textarea { font-family: Consolas, "Microsoft YaHei", monospace; line-height: 1.6; }
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: #6b7f9e; font-weight: 400; }
.modal .hint { display: block; margin-top: 2px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.var-preview {
  background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 9px;
  padding: 8px 12px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px;
}

/* ---- 运行弹窗 ---- */
.runner-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 14px; }
.runner-fields label { font-size: 12.5px; color: var(--text-dim); }
.runner-fields input { display: block; width: 100%; margin-top: 4px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px 10px; outline: none; }
.runner-fields input:focus { border-color: var(--accent); }
.runner-output { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.runner-output-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; background: var(--bg-soft); font-size: 12px; color: var(--text-dim);
  border-bottom: 1px solid var(--line);
}
.runner-output pre {
  margin: 0; padding: 12px 14px; max-height: 260px; overflow: auto;
  font: 12.5px/1.7 Consolas, monospace; color: var(--text); white-space: pre-wrap; word-break: break-all;
}

/* ---- 版本历史 ---- */
.history-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; margin: 10px 0; }
.history-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
.history-item .hi-meta { font-size: 12px; color: var(--text-dim); }
.history-item .hi-meta b { color: var(--text); font-weight: 600; }
.history-item.current { border-color: rgba(34, 211, 238, 0.4); }
.history-item pre {
  margin: 6px 0 0; font: 11.5px/1.6 Consolas, monospace; color: #7c90b0;
  max-height: 60px; overflow: hidden; white-space: pre-wrap; word-break: break-all;
}

/* ---- 导入导出 ---- */
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tools-grid .btn { padding: 12px; }

/* ---- 分享接收 ---- */
.receive-preview {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 12px 0; max-height: 300px; overflow: auto;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}

/* ---- 页脚 / 杂项 ---- */
.pagefoot {
  display: flex; justify-content: space-between; padding: 14px 28px;
  border-top: 1px solid var(--line); font-size: 12px; color: #56688a;
}
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 20px; border-radius: 99px; font-size: 13px; z-index: 99;
  box-shadow: var(--shadow); animation: toast-in 0.18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- 响应式 ---- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .side-block { flex: 1 1 200px; }
  .side-foot { display: none; }
  .topbar { flex-wrap: wrap; }
  .searchbox { width: 100%; order: 3; }
  .form-row.two { grid-template-columns: 1fr; }
  .runner-fields { grid-template-columns: 1fr; }
}
