/* «Видео из фотографий»: отдельная страница создания, витрина в «Моих заказах»
   и модальные окна.

   Отдельный файл, а не ещё пятьсот строк в index.html: страница большая, а сам
   index.html и без того на четыре тысячи строк. Никакой сборки это не требует —
   обычный <link>.

   Новый дизайн-язык НЕ вводится: цвета, радиусы, тени и типографика берутся из
   тех же переменных :root, что и весь остальной POVOD. Страница обязана
   выглядеть частью сервиса, а не отдельным приложением. */

/* ---------------------------------------------------------------- шапка ---- */
.sv-head { margin-bottom: 22px; }
.sv-back {
  font-size: 14px; font-weight: 600; color: var(--muted); background: none;
  border: 0; padding: 6px 0; cursor: pointer; display: inline-flex; gap: 7px;
}
.sv-back:hover { color: var(--red); }
.sv-kicker {
  margin-top: 10px; font-size: 12px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--red);
}
.sv-title { margin-top: 6px; font-size: clamp(26px, 5vw, 38px); font-weight: 800; line-height: 1.15; }
.sv-lead { margin-top: 10px; font-size: 15px; color: var(--muted); line-height: 1.55; max-width: 46em; }

/* Три визуальных этапа. Это НЕ состояния backend — просто ориентир, где человек
   находится: песня выбрана, фотографии добавляются, видео создаётся. */
.sv-steps { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.sv-step {
  flex: 1 1 130px; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 11px 14px; min-width: 0;
}
.sv-step-mark {
  width: 26px; height: 26px; min-width: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--muted);
  background: rgba(141, 141, 138, .14); border: 1px solid var(--line);
}
.sv-step-text { min-width: 0; }
.sv-step-name { font-size: 13.5px; font-weight: 700; }
.sv-step-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-step.done .sv-step-mark { color: #fff; background: var(--grad); border-color: transparent; }
.sv-step.active { border-color: rgba(232, 90, 79, .38); }
.sv-step.active .sv-step-mark {
  color: var(--red); background: rgba(232, 90, 79, .1); border-color: rgba(232, 90, 79, .38);
}

/* --------------------------------------------------------------- панели ---- */
.sv-card {
  background: var(--card); border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px; padding: 20px 22px; box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.sv-card h2 { font-size: 19px; font-weight: 800; }
.sv-card-sub { margin-top: 6px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.sv-label { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sv-locked { margin-top: 12px; font-size: 13px; font-weight: 600; color: #2f8a5e; display: flex; align-items: center; gap: 7px; }
.sv-song-row { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sv-song-name { font-size: 16px; font-weight: 700; }
.sv-song-dur { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ загрузчик ---- */
.sv-drop {
  margin-top: 16px; border: 2px dashed rgba(141, 141, 138, .38); border-radius: 20px;
  background: rgba(252, 251, 246, .5); padding: 34px 20px; text-align: center;
  transition: .18s; cursor: pointer; display: block; width: 100%;
  font: inherit; color: inherit;
}
.sv-drop:hover, .sv-drop:focus-visible { border-color: var(--red); background: rgba(255, 255, 255, .8); }
.sv-drop.over { border-color: var(--red); background: rgba(232, 90, 79, .07); }
.sv-drop-main { font-size: 17px; font-weight: 700; color: var(--red); }
.sv-drop-sub { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.sv-hint { margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.sv-count { margin-top: 16px; font-size: 14px; font-weight: 700; }
.sv-count em { font-style: normal; color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------ сетка фото --- */
.sv-grid {
  margin-top: 12px; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.sv-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  background: rgba(141, 141, 138, .12); border: 1px solid var(--line);
}
.sv-cell.hero { border-color: var(--red); box-shadow: 0 0 0 2px rgba(232, 90, 79, .35); }
.sv-cell.drag { opacity: .45; }
.sv-cell.dropbefore { box-shadow: -3px 0 0 0 var(--red); }
.sv-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; padding: 8px; text-align: center;
}
.sv-fallback-ico { font-size: 24px; }
.sv-fallback-fmt { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.sv-fallback-name { font-size: 10.5px; color: var(--muted); word-break: break-all; line-height: 1.3; }
.sv-cell-bar {
  position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between;
  gap: 4px; padding: 5px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .55));
}
.sv-cell-bar .left { display: flex; gap: 4px; }
.sv-ico {
  width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(20, 18, 16, .62); color: #fff; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.sv-ico:hover { background: rgba(20, 18, 16, .85); transform: scale(1.08); }
.sv-ico:focus-visible { outline: 3px solid rgba(232, 90, 79, .8); outline-offset: 2px; }
.sv-ico[aria-pressed="true"] { background: var(--red); }
.sv-ico[disabled] { opacity: .35; cursor: default; transform: none; }
.sv-hero-tag {
  position: absolute; top: 6px; left: 6px; font-size: 10.5px; font-weight: 800;
  color: #fff; background: var(--grad); border-radius: 99px; padding: 3px 8px;
}
.sv-add {
  aspect-ratio: 1 / 1; border-radius: 14px; border: 2px dashed rgba(141, 141, 138, .38);
  background: rgba(252, 251, 246, .5); color: var(--red); font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; transition: .15s;
}
.sv-add:hover { border-color: var(--red); background: #fff; }
.sv-add-plus { font-size: 22px; }

/* -------------------------------------------------- дополнительные опции --- */
.sv-adv { margin-top: 16px; border-top: 1px solid var(--line2); padding-top: 12px; }
.sv-adv > summary {
  cursor: pointer; font-size: 14px; font-weight: 700; list-style: none;
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
}
.sv-adv > summary::-webkit-details-marker { display: none; }
.sv-adv > summary::before { content: '＋'; color: var(--red); font-weight: 800; }
.sv-adv[open] > summary::before { content: '－'; }
.sv-adv-body { padding: 10px 0 2px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.sv-adv-body p + p { margin-top: 8px; }
.sv-adv-body b { color: var(--ink); }

/* ------------------------------------------------------------- запуск ------ */
.sv-submit-note {
  margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.5;
  background: rgba(216, 195, 165, .22); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 14px;
}
.sv-submit-row { margin-top: 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sv-submit-row .cta { margin-top: 0; }
.sv-err {
  margin-top: 14px; font-size: 13.5px; color: var(--red); background: rgba(232, 90, 79, .08);
  border: 1px solid rgba(232, 90, 79, .28); border-radius: 14px; padding: 11px 14px;
}

/* --------------------------------------------------------- обработка ------- */
.sv-proc { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sv-spin {
  width: 42px; height: 42px; min-width: 42px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red);
  animation: sv-spin 1s linear infinite;
}
@keyframes sv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sv-spin { animation: none; } }
.sv-proc-stage { font-size: 18px; font-weight: 700; }
.sv-proc-sub { margin-top: 5px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------------- готово ------ */
.sv-player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px;
  overflow: hidden; background: #151311; border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); margin-top: 14px;
}
.sv-player video { width: 100%; height: 100%; display: block; object-fit: contain; background: #151311; }
.sv-player .plyr { width: 100%; height: 100%; border-radius: inherit; }
.sv-meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.sv-ready-row { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sv-ready-row .cta, .sv-ready-row .ghost { margin-top: 0; }

/* ------------------------------------------ витрина в «Моих заказах» ------- */
.ss-cta {
  font-size: 13px; font-weight: 700; color: #fff; background: var(--grad);
  border: 0; border-radius: 99px; padding: 9px 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: .18s;
  box-shadow: 0 8px 20px rgba(232, 90, 79, .26);
}
.ss-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(232, 90, 79, .34); }
.ss-cta[disabled] { opacity: .6; cursor: default; transform: none; }
.ss-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* Дополнение ещё не куплено — предложение уже стоит у каждой песни, и пустой
   блок с разделителем в карточке был бы просто мусором. */
.ss-box.ss-empty { display: none; }
.ss-box-title { flex: 1 1 100%; font-size: 14px; font-weight: 800; }
.ss-box-sub { flex: 1 1 100%; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------- модальные окна ---- */
.sv-overlay {
  position: fixed; inset: 0; z-index: 120; background: rgba(45, 42, 38, .55);
  backdrop-filter: blur(3px); display: flex; align-items: center;
  justify-content: center; padding: 18px; overflow-y: auto;
}
.sv-modal {
  background: #FCFBF6; border-radius: 24px; box-shadow: var(--shadow);
  width: min(460px, 100%); max-height: calc(100vh - 36px); overflow-y: auto;
  padding: 26px 26px 22px; position: relative;
}
.sv-modal h3 { font-size: 21px; font-weight: 800; padding-right: 30px; }
.sv-modal p { margin-top: 12px; font-size: 14.5px; color: #4c4740; line-height: 1.6; }
.sv-modal .sv-pick {
  margin-top: 14px; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; background: rgba(216, 195, 165, .2);
}
.sv-modal .sv-pick-label { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sv-modal .sv-pick-value { margin-top: 4px; font-size: 16px; font-weight: 700; }
.sv-modal .sv-price { margin-top: 16px; font-size: 26px; font-weight: 800; }
/* Выбор версии песни для уже оплаченного видео (вариант подарка с дополнением):
   покупка здесь уже состоялась, остаётся только решение «под какую песню». */
.sv-pick-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.sv-pick-list button { margin-top: 0; }
.sv-pick-list button[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(232, 90, 79, .35); }
.sv-modal-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.sv-modal-actions .cta, .sv-modal-actions .ghost { margin-top: 0; }
.sv-modal-close {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted);
  cursor: pointer; border-radius: 50%;
}
.sv-modal-close:hover { color: var(--red); background: rgba(141, 141, 138, .12); }

/* ---------------------------------------------------------- адаптив -------- */
@media (max-width: 560px) {
  .sv-card { padding: 17px 15px; border-radius: 18px; }
  .sv-drop { padding: 26px 14px; }
  .sv-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
  .sv-steps { gap: 7px; }
  .sv-step { flex-basis: 100%; padding: 9px 12px; }
  .sv-modal { padding: 22px 18px 18px; border-radius: 20px; }
  .sv-modal-actions { justify-content: stretch; }
  .sv-modal-actions .cta, .sv-modal-actions .ghost { flex: 1 1 auto; justify-content: center; }
  .sv-submit-row .cta { width: 100%; justify-content: center; }
  .ss-cta { width: 100%; justify-content: center; }
}
