/* ================= sucai 素材库 · 深色主题 ================= */

:root {
  --bg: #0e1116;
  --surface: #161a22;
  --surface-2: #1e2430;
  --border: #2a3140;
  --text: #e6e9ef;
  --text-dim: #8b93a3;
  --accent: #7c5cff;
  --accent-hover: #927aff;
  --success: #3dd68c;
  --danger: #ff5c74;
  --radius: 12px;
  --radius-sm: 8px;
}

[v-cloak] { display: none; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 通用按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

.btn.danger {
  background: transparent;
  border-color: rgba(255, 92, 116, .4);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(255, 92, 116, .12); border-color: var(--danger); }

.btn.block { width: 100%; justify-content: center; }
.btn.small { padding: 4px 10px; font-size: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(22, 26, 34, .85);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.danger:hover { background: rgba(255, 92, 116, .2); color: var(--danger); }

/* ---------------- 登录 ---------------- */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 60% 40% at 70% 20%, rgba(124, 92, 255, .18), transparent),
    radial-gradient(ellipse 50% 40% at 20% 85%, rgba(61, 214, 140, .08), transparent),
    var(--bg);
}

.login-card {
  width: 340px;
  padding: 40px 36px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { margin: 0; font-size: 20px; letter-spacing: 1px; }
.login-sub { margin: 6px 0 24px; color: var(--text-dim); font-size: 13px; }

.login-card input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.login-card input:focus { border-color: var(--accent); }

.login-error {
  margin: -6px 0 12px;
  color: var(--danger);
  font-size: 13px;
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(14, 17, 22, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand span { color: var(--accent); letter-spacing: 2px; }

.search {
  width: 240px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color .15s, width .2s;
}
.search:focus { border-color: var(--accent); width: 320px; }

.segment {
  display: flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.segment button {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segment button.active { background: var(--accent); color: #fff; font-weight: 600; }
.segment button:not(.active):hover { color: var(--text); }

.sort-select {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.topbar-spacer { flex: 1; }

/* ---------------- 布局 ---------------- */

.layout {
  display: flex;
  gap: 20px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 76px;
}

.stat-card {
  padding: 18px;
  background: linear-gradient(135deg, rgba(124, 92, 255, .15), rgba(124, 92, 255, .04));
  border: 1px solid rgba(124, 92, 255, .3);
  border-radius: var(--radius);
}
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--text-dim); margin-top: 2px; }
.stat-sub { color: var(--text-dim); font-size: 12px; margin-top: 8px; }

.tags-box {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tags-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
}
.tags-empty { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.tags-box .btn { margin-top: 12px; }

.mini-segment { display: flex; padding: 2px; background: var(--bg); border-radius: 6px; }
.mini-segment button {
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.mini-segment button.active { background: var(--accent); color: #fff; }

.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.tag-chip i { font-style: normal; color: var(--text-dim); margin-left: 4px; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip.active i { color: rgba(255, 255, 255, .75); }

.side-hint {
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* ---------------- 分类树 ---------------- */

.cats-box {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cats-box .tags-empty { margin-top: 8px; }

.cat-tree { display: flex; flex-direction: column; gap: 1px; }

.cat-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  user-select: none;
  transition: background .12s, color .12s;
}
.cat-row:hover { background: var(--surface-2); color: var(--text); }
.cat-row.active { background: rgba(124, 92, 255, .15); color: var(--accent); font-weight: 600; }
.cat-row .cat-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-row i { font-style: normal; font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.cat-row.active i { color: var(--accent); }

.twist {
  width: 14px;
  text-align: center;
  font-size: 10px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-dim);
}
.twist:hover { color: var(--text); }
.twist.placeholder { visibility: hidden; cursor: default; }

.mini-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
}
.mini-btn:hover { background: rgba(124, 92, 255, .12); }

/* 卡片上的分类小徽章 */
.mini-tags .cat-chip { background: rgba(124, 92, 255, .14); color: var(--accent); }

/* 上传面板:目标分类 */
.upload-target { margin: -4px 0 10px; font-size: 12px; color: var(--text-dim); }

/* ---------------- 分类管理弹窗 ---------------- */

.cat-mgr { width: min(640px, 100%); }

.cat-add-row {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cat-add-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
}
.cat-add-row input:focus { border-color: var(--accent); }
.cat-add-row select, .cat-mgr-row select {
  max-width: 220px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.cat-list { padding: 10px 18px; overflow-y: auto; max-height: 55vh; }

.cat-mgr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
}
.cat-mgr-row:hover { background: var(--surface-2); }
.cat-mgr-row .cat-name { font-size: 13.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-mgr-row .cnt { font-style: normal; font-size: 11.5px; color: var(--text-dim); flex-shrink: 0; }
.flex-spacer { flex: 1; }

.cat-mgr-row input.mgr-name-input {
  width: 150px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.cat-mgr-row input.mgr-name-input:focus { border-color: var(--accent); }

.cat-mgr-tip {
  padding: 10px 18px 14px;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ---------------- 网格 ---------------- */

.content { flex: 1; min-width: 0; }

.result-bar { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 255, .5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
}
.card.playing { border-color: var(--accent); }

/* 透明底棋盘格,衬托精灵图透明通道 */
.thumb {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #12151d;
  background-image:
    linear-gradient(45deg, #1a1e28 25%, transparent 25%),
    linear-gradient(-45deg, #1a1e28 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1e28 75%),
    linear-gradient(-45deg, transparent 75%, #1a1e28 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.audio-face { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wave-icon { width: 72px; height: 72px; color: var(--accent); opacity: .85; }

/* 播放中的均衡器动画 */
.eq { display: flex; gap: 3px; align-items: flex-end; height: 14px; }
.eq span {
  width: 3px;
  height: 5px;
  background: var(--accent);
  border-radius: 2px;
  animation: eq 1s ease-in-out infinite;
}
.eq span:nth-child(2) { animation-delay: .15s; }
.eq span:nth-child(3) { animation-delay: .3s; }
.eq span:nth-child(4) { animation-delay: .45s; }
.eq span:nth-child(5) { animation-delay: .6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.eq.lg span { animation-duration: .8s; }

.badge {
  position: absolute;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.badge.kind { top: 8px; left: 8px; background: rgba(14, 17, 22, .75); color: var(--text-dim); }
.badge.kind.image { color: var(--accent); }
.badge.kind.audio { color: var(--success); }
.badge.kind.lg { position: static; font-size: 12px; padding: 3px 10px; }
.badge.dur { bottom: 8px; right: 8px; background: rgba(14, 17, 22, .75); color: var(--text); }

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
}
.card:hover .card-actions { opacity: 1; transform: none; }

.card-meta { padding: 10px 12px 12px; }
.card-meta .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta .sub {
  display: flex;
  gap: 10px;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 12px;
}
.mini-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.mini-tags span {
  padding: 1px 8px;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
}
.mini-tags .more { color: var(--accent); }

/* ---------------- 空态 / 加载 ---------------- */

.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty-icon { font-size: 52px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text); }
.empty-sub { margin: 8px 0 20px; }

.loading-hint { padding: 24px; text-align: center; color: var(--text-dim); }
.end-hint { padding: 20px; text-align: center; color: var(--text-dim); font-size: 12px; }
.sentinel { height: 2px; }

/* ---------------- 详情弹窗 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(860px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-body {
  display: flex;
  gap: 0;
  overflow-y: auto;
  min-height: 0;
}

.preview {
  flex: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #12151d;
  background-image:
    linear-gradient(45deg, #1a1e28 25%, transparent 25%),
    linear-gradient(-45deg, #1a1e28 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1e28 75%),
    linear-gradient(-45deg, transparent 75%, #1a1e28 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  min-height: 320px;
}
.preview img {
  max-width: 100%;
  max-height: 560px;
  object-fit: contain;
  cursor: zoom-in;
}

.audio-preview { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }
.play-big {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  transition: transform .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.play-big:hover { background: var(--accent-hover); transform: scale(1.06); }
.dur-big { color: var(--text-dim); font-size: 15px; font-variant-numeric: tabular-nums; }
.audio-el { width: 100%; max-width: 420px; }
.audio-el::-webkit-media-controls-panel { background: var(--surface-2); }

.modal-side {
  flex: 1;
  min-width: 280px;
  padding: 18px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-side label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.modal-side label:first-child { margin-top: 0; }

.modal-side input, .modal-side textarea, .modal-side select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color .15s;
  cursor: pointer;
}
.modal-side input, .modal-side textarea { cursor: auto; }
.modal-side input:focus, .modal-side textarea:focus, .modal-side select:focus { border-color: var(--accent); }

.tag-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 38px;
  align-items: center;
}
.tag-editor:focus-within { border-color: var(--accent); }
.tag-editor .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 12px;
}
.tag-editor .tag b { cursor: pointer; color: var(--text-dim); font-weight: 400; }
.tag-editor .tag b:hover { color: var(--danger); }
.tag-input {
  flex: 1;
  min-width: 90px;
  border: none !important;
  background: transparent !important;
  padding: 2px 4px !important;
}

.meta-rows { margin-top: 14px; border-top: 1px solid var(--border); }
.meta-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.meta-rows span { color: var(--text-dim); }
.sha { cursor: pointer; font-family: Consolas, monospace; }
.sha i { font-style: normal; color: var(--accent); }
.sha:hover i { text-decoration: underline; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.modal-actions .btn { flex: 1; justify-content: center; padding: 9px 8px; }

/* ---------------- 拖拽上传覆层 ---------------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 17, 22, .88);
  backdrop-filter: blur(4px);
}
.drop-inner {
  padding: 60px 90px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 3px dashed var(--accent);
  border-radius: 24px;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .25); }
  50% { box-shadow: 0 0 48px 8px rgba(124, 92, 255, .25); }
}
.drop-icon { font-size: 56px; margin-bottom: 12px; }
.drop-sub { margin-top: 10px; font-size: 13px; font-weight: 400; color: var(--text-dim); }

/* ---------------- 上传队列 ---------------- */

.uploads-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  width: 320px;
  max-height: 45vh;
  overflow-y: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.uploads-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
}
.upload-item { padding: 8px 0; }
.upload-item + .upload-item { border-top: 1px solid var(--border); }
.upload-name {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-status { margin: 3px 0 4px; font-size: 11.5px; color: var(--text-dim); }
.upload-item.err .upload-status { color: var(--danger); }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .2s;
}
.bar-fill.err { background: var(--danger); }

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  animation: toast-in .25s ease;
}
.toast.ok { border-color: rgba(61, 214, 140, .5); color: var(--success); }
.toast.err { border-color: rgba(255, 92, 116, .5); color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar > * { flex: 1 1 260px; }
  .side-hint { display: none; }
  .modal-body { flex-direction: column; }
  .modal-side { border-left: none; border-top: 1px solid var(--border); }
  .search { width: 160px; }
  .search:focus { width: 200px; }
}
