/* ============================================================
   Звуковая библиотека (/admin/sounds)
   Все цвета — через CSS-переменные админ-темы: работает в light/dark.
   ============================================================ */

/* ---------- Верхняя панель: вкладки + управление категориями ---------- */
.snd-toolbar-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 0 14px;
}
.snd-tabs { display: flex; gap: 6px; }
.snd-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all .15s ease;
}
.snd-tab:hover { color: var(--text); background: var(--surface-2); }
.snd-tab.active {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft); font-weight: 600;
}
.snd-cats-manage {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.snd-cats-manage:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Лента категорий ---------- */
.snd-cats {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 2px 2px 10px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.snd-cats:empty { display: none; }
.snd-cat-card {
  position: relative; flex: 0 0 auto;
  width: 148px; height: 88px; border-radius: 12px;
  border: 2px solid transparent; cursor: pointer; overflow: hidden;
  color: #fff; text-align: left; padding: 10px 12px; font-family: inherit;
  display: flex; flex-direction: column; justify-content: flex-end;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.snd-cat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.snd-cat-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.snd-cat-card .snd-cat-ico {
  position: absolute; top: 8px; right: 8px; opacity: .35;
}
.snd-cat-card .snd-cat-name {
  font-size: 13px; font-weight: 700; line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snd-cat-card .snd-cat-count {
  font-size: 11px; opacity: .85; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.snd-cat-g0 { background: linear-gradient(135deg, #667eea, #764ba2); }
.snd-cat-g1 { background: linear-gradient(135deg, #f5576c, #f093fb); }
.snd-cat-g2 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.snd-cat-g3 { background: linear-gradient(135deg, #11998e, #38ef7d); }
.snd-cat-g4 { background: linear-gradient(135deg, #fa709a, #fee140); }
.snd-cat-g5 { background: linear-gradient(135deg, #30cfd0, #330867); }
.snd-cat-g6 { background: linear-gradient(135deg, #f83600, #f9d423); }
.snd-cat-g7 { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.snd-cat-gu { background: linear-gradient(135deg, #6b7280, #374151); }

/* ---------- Поиск + сортировка ---------- */
.snd-filters { display: flex; gap: 10px; margin-bottom: 6px; }
.snd-search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 16px; color: var(--text-muted);
}
.snd-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.snd-search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px; padding: 11px 0; font-family: inherit;
}
.snd-sort {
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font-size: 13px; padding: 0 14px; font-family: inherit; cursor: pointer; outline: none;
}
.snd-sort:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Список ---------- */
.snd-list-head {
  display: grid; align-items: center;
  grid-template-columns: 48px minmax(0, 1fr) 216px 96px 110px 128px;
  gap: 10px; padding: 10px 8px 8px;
  font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
}
.snd-lh-dur, .snd-lh-plays { text-align: right; }
.snd-row {
  display: grid; align-items: center;
  grid-template-columns: 48px minmax(0, 1fr) 216px 96px 110px 128px;
  gap: 10px; padding: 8px; border-bottom: 1px solid var(--border-soft);
  border-radius: 8px; transition: background .12s ease;
}
.snd-row:hover { background: var(--surface-2); }
.snd-row.playing { background: var(--accent-soft); }

.snd-play {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: all .15s ease;
}
.snd-play:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); transform: scale(1.06); }
.snd-row.playing .snd-play { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.snd-play svg { display: block; }

.snd-name-wrap { min-width: 0; }
.snd-name {
  font-size: 14px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snd-cat-label {
  font-size: 12px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}

.snd-wave { position: relative; width: 216px; height: 30px; cursor: pointer; }
.snd-wave canvas { display: block; width: 100%; height: 100%; }

.snd-dur, .snd-plays {
  text-align: right; font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.snd-actions { display: flex; justify-content: flex-end; gap: 2px; }
.snd-abtn {
  width: 30px; height: 30px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .12s ease; text-decoration: none;
}
.snd-abtn:hover { background: var(--surface-3, var(--surface-2)); color: var(--text); }
.snd-abtn.danger:hover { color: var(--danger, #e5484d); }
.snd-abtn.faved { color: #f5a623; }
.snd-abtn.faved:hover { color: #f5a623; }
.snd-abtn.faved svg { fill: #f5a623; }

.snd-count-note {
  padding: 14px 8px; font-size: 13px; color: var(--text-muted); text-align: center;
}

/* ---------- Модалки ---------- */
.snd-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; }
.snd-modal[hidden] { display: none; }
.snd-modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 20, .55); backdrop-filter: blur(2px); }
.snd-modal-panel {
  position: relative; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.snd-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.snd-modal-head h2 { margin: 0; font-size: 17px; }
.snd-modal-x {
  border: 0; background: transparent; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex;
}
.snd-modal-x:hover { color: var(--text); background: var(--surface-2); }
.snd-modal-body { padding: 18px 20px; overflow-y: auto; }
.snd-modal-body p { margin: 0 0 10px; font-size: 13.5px; }
.snd-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
}
.snd-modal-foot-split { justify-content: space-between; }
.snd-modal-foot-split > div { display: flex; gap: 8px; }

/* ---------- Загрузка ---------- */
.snd-drop {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 26px 16px; text-align: center; color: var(--text-muted);
  cursor: pointer; transition: all .15s ease; margin-bottom: 14px;
}
.snd-drop p { margin: 8px 0 0; font-size: 13px; }
.snd-drop b { color: var(--text); }
.snd-drop:hover, .snd-drop.dragover {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.snd-upload-files {
  margin: 0 0 14px; border: 1px solid var(--border-soft); border-radius: 10px;
  max-height: 180px; overflow-y: auto; font-size: 13px;
}
.snd-upload-file {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--border-soft);
}
.snd-upload-file:last-child { border-bottom: 0; }
.snd-upload-file .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.snd-upload-file .s { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.snd-upload-file .x {
  border: 0; background: transparent; color: var(--text-muted);
  cursor: pointer; padding: 2px; display: inline-flex; border-radius: 4px;
}
.snd-upload-file .x:hover { color: var(--danger, #e5484d); }
.snd-progress {
  height: 8px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin-top: 4px;
}
.snd-progress-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s ease;
}

/* ---------- Сканирование ---------- */
.snd-path {
  display: block; padding: 10px 14px; margin: 4px 0 12px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 8px; font-size: 12.5px; color: var(--text);
  word-break: break-all; user-select: all;
}
.snd-hint { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--text-muted); }
.snd-hint li { margin-bottom: 4px; }
.snd-hint code {
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.snd-scan-result {
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
  background: var(--accent-soft); color: var(--text); border: 1px solid var(--border-soft);
}
.snd-scan-result .err { color: var(--danger, #e5484d); }

/* ---------- Категории (модалка) ---------- */
.snd-cat-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.snd-cat-row { display: flex; align-items: center; gap: 8px; }
.snd-cat-row .snd-cat-dot { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }
.snd-cat-row input { flex: 1; }
.snd-cat-row .cnt { font-size: 12px; color: var(--text-muted); white-space: nowrap; min-width: 46px; text-align: right; }
.snd-cat-empty { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.snd-cat-add { display: flex; gap: 8px; }
.snd-cat-add input { flex: 1; }

/* ---------- Тосты ---------- */
.snd-toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 1400;
  display: flex; flex-direction: column; gap: 8px;
}
.snd-toast {
  padding: 11px 16px; border-radius: 10px; font-size: 13.5px;
  background: var(--text); color: var(--bg);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: snd-toast-in .2s ease;
  max-width: 380px;
}
.snd-toast.error { background: var(--danger, #e5484d); color: #fff; }
@keyframes snd-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .snd-list-head, .snd-row { grid-template-columns: 48px minmax(0, 1fr) 96px 128px; }
  .snd-wave, .snd-lh-wave, .snd-plays, .snd-lh-plays { display: none; }
}
@media (max-width: 640px) {
  .snd-list-head { display: none; }
  .snd-row { grid-template-columns: 44px minmax(0, 1fr) 72px; }
  .snd-dur { display: none; }
  .snd-actions .snd-abtn.hide-sm { display: none; }
  .snd-filters { flex-direction: column; }
}
