/* =========================================================================
   99 Nights Scripts — components.css
   Карточки скриптов, бейджи, код-блок, фильтр, шаги, executor-карточки, FAQ.
   ========================================================================= */

/* --- Фильтр ------------------------------------------------------------ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 30px;
}
.filter-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.filter-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* --- Сетка скриптов ---------------------------------------------------- */

.scripts-grid {
  display: grid;
  /* min(100%, …) не даёт колонке вылезти за вьюпорт на узких экранах;
     340px → 2 колонки на десктопе/планшете, 1 на телефоне, без переполнения. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 20px;
}

.scripts-empty {
  display: none;
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
  font-size: 1.02rem;
}
.scripts-empty.is-visible { display: block; }

/* --- Карточка скрипта -------------------------------------------------- */

.script-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.2s ease;
}
.script-card:hover {
  border-color: var(--accent);
}

/* Картинка скрипта — на всю ширину карточки (выходит за паддинг). */
.script-card__media {
  display: block;
  margin: -22px -22px 2px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}
.script-card__media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.script-card__media:hover img {
  transform: scale(1.04);
}

.script-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.script-card__title {
  font-size: 1.28rem;
  line-height: 1.25;
}
.script-card__title a {
  color: inherit;
  text-decoration: none;
}
.script-card__title a:hover {
  color: var(--accent);
}
.script-card__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ok);
  font-family: var(--font-body);
  white-space: nowrap;
  margin-top: 4px;
}
.script-card__status--down { color: var(--text-muted); }
.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
/* Ореол без box-shadow (бриф: «Нет box-shadow») — через псевдоэлемент. */
.status-dot::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.18);
}
.script-card__status--down .status-dot {
  background: var(--text-muted);
}
.script-card__status--down .status-dot::before {
  display: none;
}

.script-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge--nokey {
  background: rgba(74, 222, 128, 0.14);
  color: var(--ok);
}
.badge--muted {
  background: var(--bg-elev);
  color: var(--text-muted);
}
.badge--plain {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.script-card__desc {
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.65;
}

.script-card__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}
.script-card__features li {
  position: relative;
  padding-left: 24px;
  font-size: 0.92rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.script-card__features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

.script-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.script-card__exec-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 700;
}
.script-card__exec { color: var(--text-soft); }

.script-card__checked {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-code);
}
.script-card__checked time { color: inherit; }

/* --- Код-блок ---------------------------------------------------------- */

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.code-block__lang {
  font-family: var(--font-code);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.code-block__pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 0.84rem;
  line-height: 1.6;
  color: #CBE9F2;
  -webkit-overflow-scrolling: touch;
}
.code-block__pre code {
  font-family: var(--font-code);
  white-space: pre;
  color: inherit;
}

/* Кнопка «Скопировать» — вторичное действие (основное — «Скачать скрипт»). */
.copy-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}
.copy-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn.is-copied {
  background: var(--ok);
  color: #04140A;
  border-color: var(--ok);
}

/* Основная кнопка скачивания в карточке — над кодом, на всю ширину, ярко-циановая. */
.btn-download-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 13px 22px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.btn-download-card:hover { background: #67E8F9; color: #000; }
.btn-download-card:active { transform: translateY(1px); }
.btn-download-card__icon { font-size: 1.1em; line-height: 1; }

/* --- Шаги (страница «Как использовать») -------------------------------- */

.steps {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  counter-reset: step;
}
.step {
  display: flex;
  gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color 0.2s ease;
}
.step:hover { border-color: var(--accent); }
.step__num {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
}
.step__body { flex: 1; }
.step__title {
  font-size: 1.2rem;
  margin-bottom: 6px;
}
.step__text {
  color: var(--text-soft);
  font-size: 0.96rem;
}
.step__text a { text-decoration: underline; text-underline-offset: 3px; }

/* --- Компактные шаги на главной («Как использовать») ------------------- */

.howto-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 8px;
}
.howto-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.howto-item__num {
  font-family: var(--font-code);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.howto-item__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin: 8px 0 4px;
}
.howto-item__text {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* --- Executor-карточки ------------------------------------------------- */

.exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
  margin-top: 24px;
}
.exec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.2s ease;
}
.exec-card:hover { border-color: var(--accent); }
.exec-card__name {
  font-size: 1.25rem;
  margin-bottom: 10px;
}
.exec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.exec-card__desc {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* --- FAQ --------------------------------------------------------------- */

.faq {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.faq-item:hover { border-color: var(--border); }
.faq-item[open] { border-color: var(--accent-dim); }
.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 50px 18px 22px;
  position: relative;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.04rem;
  color: var(--text-primary);
  user-select: none;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
}
.faq-item[open] > summary::after {
  content: "−";
}
.faq-item__answer {
  padding: 0 22px 20px;
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.7;
}
.faq-item__answer a { text-decoration: underline; text-underline-offset: 3px; }
.faq-item__answer p + p { margin-top: 0.7rem; }

/* --- Callout / note ---------------------------------------------------- */

.note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 24px;
  color: var(--text-soft);
}
.note__title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* --- Промежуточная страница скачивания (/download/) -------------------- */

.dl-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 8px;
}
.dl-summary__title {
  font-size: 1.3rem;
  margin: 10px 0 6px;
}
.dl-summary__desc {
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.65;
}

/* Рекламный слот-заглушка — замените содержимое кодом рекламной сети. */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  margin: 20px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
}
.ad-slot__label {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Блок таймера/готовности */
.dl-gate {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 24px;
}
.dl-wait__lead {
  color: var(--text-soft);
  font-size: 1.02rem;
}
.dl-count {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 13vw, 5rem);
  line-height: 1;
  color: var(--accent);
  margin-top: 4px;
}
.dl-count__unit {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-soft);
}
.dl-progress {
  height: 6px;
  max-width: 360px;
  margin: 20px auto 0;
  background: var(--bg-elev);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.dl-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 1s linear;
}
.dl-wait__hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 16px;
}
.dl-ready__lead {
  color: var(--ok);
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 18px;
}
.dl-ready__alt {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 16px;
}
.dl-ready__alt a { text-decoration: underline; text-underline-offset: 3px; }

/* Главная кнопка скачивания на /download/ — ярко-циановая (основное действие). */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 15px 30px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.btn-download:hover { background: #67E8F9; color: #000; }
.btn-download:active { transform: translateY(1px); }

/* --- Таблица сравнения скриптов --------------------------------------- */

.table-wrap {
  margin-top: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.cmp-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.cmp-table th,
.cmp-table td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border-soft);
}
.cmp-table thead th {
  background: var(--bg-elev);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cmp-table th:first-child,
.cmp-table td:first-child {
  text-align: left;
}
.cmp-table tbody tr:last-child td {
  border-bottom: none;
}
.cmp-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.cmp-name a {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.cmp-name a:hover {
  color: var(--accent);
}
.cmp-table .yes {
  color: var(--accent);
  font-weight: 700;
}
.cmp-table .no {
  color: var(--text-muted);
}

/* --- YouTube-видео (фасад) -------------------------------------------- */

.yt-facade {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 8px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.yt-facade__btn {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.yt-facade__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, opacity 0.2s ease;
}
.yt-facade:hover .yt-facade__poster {
  transform: scale(1.04);
  opacity: 0.85;
}
.yt-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.yt-facade__play::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin-left: 5px;
  border-style: solid;
  border-width: 13px 0 13px 22px;
  border-color: transparent transparent transparent #000;
}
.yt-facade:hover .yt-facade__play {
  transform: translate(-50%, -50%) scale(1.08);
  background: #67E8F9;
}
.yt-facade__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Адаптив компонентов ---------------------------------------------- */

@media (max-width: 720px) {
  .howto-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .script-card { padding: 18px; }
  .script-card__head { flex-direction: column; gap: 8px; }
  .howto-grid { grid-template-columns: 1fr; }
  .step { padding: 18px; gap: 14px; }
  .step__num { width: 36px; height: 36px; font-size: 1.1rem; }
}