/* editor/catalog.css — каталог моделей. Свои цвета студии, своя сетка. */
:root {
  --bg: #0f1319;
  --panel: #171d25;
  --panel-2: #1f2731;
  --border: #2a3440;
  --text: #e8ecf2;
  --muted: #9aa7b4;
  --accent: #e8703a;
  --ok: #4fb37e;
  --warn: #d8a13a;
  --bad: #d35c5c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { text-decoration: none; font-size: 18px; display: flex; gap: 8px; align-items: baseline; }
.brand span { font-weight: 700; }
.brand b { color: var(--accent); font-weight: 600; }
.top-right { display: flex; gap: 10px; align-items: center; }
select { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 44px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.button.quiet { background: transparent; }
.my-folders { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.my-folders .chip { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.my-folders .chip.on { border-color: var(--accent); color: var(--accent); }

main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 48px; }
.lead { color: var(--muted); margin: 4px 0 14px; max-width: 70ch; }
.search-row { display: flex; gap: 10px; margin-bottom: 14px; }
.search-row input { flex: 1; min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-size: 16px; }
#toggle-filters { display: none; }

.layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.filters { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.filters h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.filters h3:first-child { margin-top: 0; }
.filters label { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.filters label small { color: var(--muted); margin-inline-start: auto; }
.filters select { width: 100%; }

.found { color: var(--muted); margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .pic { aspect-ratio: 1; background: #0b0f14; display: grid; place-items: center; }
.card .pic img { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card .name { font-weight: 600; line-height: 1.3; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.tag.patho { color: #f0a877; }
.tag.lic-restricted { color: var(--bad); }
.tag.lic-share-alike { color: var(--warn); }
.none { color: var(--muted); }
.more { width: 100%; margin-top: 16px; }

/* ── Страница модели ── */
.back { display: inline-flex; min-height: 44px; align-items: center; color: var(--muted); text-decoration: none; }
.model { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.stage { position: sticky; top: 76px; }
.view { aspect-ratio: 4 / 3; background: #0b0f14; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; position: relative; touch-action: none; }
.view canvas { width: 100%; height: 100%; display: block; }
.view img.still { width: 100%; height: 100%; object-fit: contain; }
.view .gate { position: absolute; inset: auto 16px 16px 16px; background: rgba(15, 19, 25, .92); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.view .gate h3 { margin: 0 0 6px; font-size: 16px; }
.view .gate p { margin: 0 0 10px; color: var(--muted); }
.view .state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.info h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.25; }
.info .en { color: var(--muted); margin: 0 0 14px; }
.info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.desc { color: var(--muted); margin: 0 0 14px; white-space: pre-line; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.box h3, #m-parts h3, #m-variants h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.box .ok { color: var(--ok); }
.box .sa { color: var(--warn); }
.box .no { color: var(--bad); }
.box ul { margin: 6px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 13px; }
#m-parts ul { columns: 2; margin: 0; padding-inline-start: 18px; }
#m-parts li { break-inside: avoid; }
#m-variants { margin-top: 28px; }
#m-variants .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ── Телефон ── */
@media (max-width: 900px) {
  .top { padding: 10px 14px; }
  main { padding: 12px 14px 40px; }
  .layout { grid-template-columns: 1fr; }
  #toggle-filters { display: inline-flex; }
  .filters { display: none; position: static; max-height: none; }
  .filters.open { display: block; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .model { grid-template-columns: 1fr; }
  .stage { position: static; }
  #m-parts ul { columns: 1; }
  #to-studio { display: none; }
}

/* Арабский — справа налево: сетка и отступы зеркалятся сами (logical props). */
[dir="rtl"] .back { direction: rtl; }

/* «+ В сцену» на карточке и всплывающее «Добавлено…». */
.card .to-scene {
  margin-top: 8px;
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--accent, #e06a3b);
  border-radius: 8px;
  background: transparent;
  color: var(--accent, #e06a3b);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.card .to-scene:hover { background: rgba(224, 106, 59, 0.12); }
.card .to-scene.done { border-color: #3fae6b; color: #3fae6b; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 18px;
  border-radius: 10px;
  background: #1c2733;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 900px) { .card .to-scene { min-height: 44px; } }

/* Окно «Добавлено» на странице модели. */
.added-shade {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center; padding: 16px;
}
.added-box {
  width: min(460px, 100%);
  background: var(--panel, #161f29);
  border: 1px solid var(--border, #2a3642);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.added-title { font-size: 18px; font-weight: 700; color: #3fae6b; margin-bottom: 6px; }
.added-where { color: var(--muted, #9aa7b4); margin-bottom: 18px; }
.added-row { display: flex; flex-wrap: wrap; gap: 10px; }
.added-row .button { flex: 1 1 180px; min-height: 44px; }
.added-row .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast button {
  border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; color: #fff;
  border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; white-space: nowrap;
}
.toast.on { pointer-events: auto; }
a.done, .done { border-color: #3fae6b !important; }
