/* =====================================================================
   🛰 КОНСТРУКТОР БАНИ — СТИЛИ ДЛЯ ГЛАВНОЙ СТРАНИЦЫ
   ---------------------------------------------------------------------
   Перенесены из site/landing/templates/constructor.html (страница
   /ai/constructor). Те же классы .cw2-* — но БЕЗ .ai-tabs и .cw2-header
   (на главной свои заголовки).

   Палитра — из site.css через var(--c-*).
   ===================================================================== */

/* ── ДВУХКОЛОНОЧНАЯ СЕТКА ──────────────────────────────────── */
.cw2-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 920px) {
  .cw2-grid { grid-template-columns: 1fr; }
}

/* ── ПАНЕЛЬ (левая колонка + правая колонка) ───────────────── */
.cw2-panel {
  background: var(--c-white, #fff);
  border: 1px solid var(--c-line-soft, #e5e7eb);
  border-radius: var(--radius, 18px);
  padding: 22px;
  box-shadow: var(--shadow, 0 10px 30px rgba(31,36,30,.05));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── ЛЕВАЯ КОЛОНКА · ТАБЫ «СНАРУЖИ / ВНУТРИ» ───────────────── */
.cw2-tabs {
  display: flex; gap: 6px; margin: 0 0 14px;
  background: var(--c-bg-soft, #f4f6f3);
  padding: 4px; border-radius: 12px;
  width: fit-content;
}
.cw2-tab {
  border: none; background: transparent;
  padding: 7px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--c-ink-soft, #6b7269);
  cursor: pointer; transition: 0.15s;
}
.cw2-tab.is-active {
  background: var(--c-white, #fff);
  color: var(--c-heading, #1f241e);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

/* ── СЦЕНА (фото) ─────────────────────────────────────────── */
.cw2-stage {
  position: relative;
  width: 100%; height: 320px;
  background: var(--c-bg-soft, #e9ede8);
  border-radius: 12px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.cw2-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(255,255,255,.94);
  padding: 5px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  color: var(--c-primary-dark, #4e7a46);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.cw2-photo {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.cw2-photo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.cw2-stub {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  background: #eceff1;
  color: #9097a1;
  font-size: 14px; font-weight: 600;
  text-align: center; padding: 12px;
  letter-spacing: .2px; line-height: 1.4;
}

/* ── СВОДКА + ЦЕНА ─────────────────────────────────────────── */
.cw2-summary {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--c-line-soft, #e5e7eb);
}
.cw2-summary-text strong {
  display: block; font-size: 15px; margin: 0 0 3px;
  color: var(--c-heading, #111827);
}
.cw2-summary-text span {
  font-size: 13px; color: var(--c-ink-soft, #6b7269);
}
.cw2-price-block { text-align: right; flex-shrink: 0; }
.cw2-price-label {
  font-size: 11px; color: var(--c-ink-soft, #6b7269);
  margin-bottom: 2px;
}
.cw2-price {
  font-size: 24px; font-weight: 700;
  color: var(--c-primary-dark, #4e7a46);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cw2-price.is-request {
  font-size: 16px; font-weight: 600; color: #7a8a72;
}

/* ── ОПИСАНИЕ ВАРИАНТА ─────────────────────────────────────── */
.cw2-desc {
  padding: 12px 14px;
  background: #f7f9f6;
  border: 1px solid var(--c-line-soft, #e5e7eb);
  border-radius: 12px;
}
.cw2-desc-title {
  font-size: 11px; font-weight: 700;
  color: #4e7a46; text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 5px;
}
.cw2-desc-text {
  font-size: 13px; line-height: 1.55;
  color: #374151; white-space: pre-line;
}

/* ── РАЗМЕРЫ ПОМЕЩЕНИЙ ─────────────────────────────────────── */
.cw2-rooms {
  padding: 12px 14px;
  border: 1px solid var(--c-line-soft, #e5e7eb);
  border-radius: 12px;
  background: #fafbf9;
}
.cw2-rooms-title {
  font-size: 11px; font-weight: 700;
  color: #4e7a46; text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 6px;
}
.cw2-rooms-list { display: flex; flex-direction: column; gap: 4px; }
.cw2-room {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px;
}
.cw2-room-name { color: #1f241e; }
.cw2-room-dims { color: #6b7269; font-variant-numeric: tabular-nums; }

/* ── СПОЙЛЕР «ЧТО ВХОДИТ» ──────────────────────────────────── */
.cw2-details {
  border: 1px solid var(--c-line-soft, #e5e7eb);
  border-radius: 12px;
  background: #fafbf9;
  overflow: hidden;
}
.cw2-details summary {
  padding: 12px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none;
}
.cw2-details summary::-webkit-details-marker { display: none; }
.cw2-details summary::after {
  content: '▾'; font-size: 14px;
  color: var(--c-ink-soft, #6b7269);
  transition: transform .2s;
}
.cw2-details[open] summary::after { transform: rotate(180deg); }
.cw2-details-content {
  padding: 10px 16px 14px;
  font-size: 12.5px; color: var(--c-ink-soft, #6b7269);
  border-top: 1px solid var(--c-line-soft, #e5e7eb);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}
@media (max-width: 600px) {
  .cw2-details-content { grid-template-columns: 1fr; }
}
.cw2-base-line em {
  color: var(--c-border, #9ca3af);
  font-style: normal; font-size: 11px;
}

/* ── ИНФОРМЕР ─────────────────────────────────────────────── */
.cw2-informer {
  font-size: 12.5px;
  color: var(--c-ink-soft, #6b7269);
  background: var(--c-bg-soft, #eef4ed);
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
}

/* ── КНОПКИ ────────────────────────────────────────────────── */
.cw2-btn {
  padding: 12px 22px;
  border-radius: 10px;
  background: var(--c-primary, #7aaa67);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background-color .15s, transform .12s;
}
.cw2-btn--wide { width: 100%; }
.cw2-btn:hover {
  background: var(--c-primary-dark, #4e7a46);
  transform: translateY(-1px);
}
.cw2-btn:active { transform: translateY(0); }
.cw2-btn:disabled,
.cw2-btn:disabled:hover {
  background: #cfd6cc; color: #f5f7f4;
  cursor: not-allowed; transform: none; box-shadow: none;
}

/* ── ВОРОНКА (правая колонка) ──────────────────────────────── */
.cw2-funnel {
  display: flex; flex-direction: column; gap: 18px;
}
.cw2-step {
  display: none;
  animation: cw2-fadeIn .25s ease;
}
.cw2-step.is-open { display: block; }
@keyframes cw2-fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cw2-step-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 8px;
}
.cw2-step-title { font-size: 14px; font-weight: 700; color: var(--c-heading, #111827); }
.cw2-step-badge {
  font-size: 11px; color: var(--c-ink-soft, #6b7269);
  background: var(--c-bg-soft, #f4f6f3);
  padding: 2px 8px; border-radius: 10px;
}

.cw2-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cw2-chips { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .cw2-grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ── ПЛИТКИ ────────────────────────────────────────────────── */
.cw2-opt {
  border: 1.5px solid var(--c-line-soft, #dfe4dd);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--c-white, #fff);
  user-select: none;
  transition: 0.15s;
}
.cw2-opt:hover { border-color: var(--c-primary, #7aaa67); }
.cw2-opt.is-active {
  border-color: var(--c-primary, #7aaa67);
  background: var(--c-bg-soft, #eef4ed);
}
.cw2-opt-title {
  font-size: 13.5px; font-weight: 600;
  color: var(--c-ink, #1f241e);
  display: flex; align-items: center; gap: 6px;
  line-height: 1.3;
}
.cw2-opt-sub {
  font-size: 11.5px;
  color: var(--c-ink-soft, #6b7269);
  margin-top: 3px; line-height: 1.4;
}
.cw2-opt.is-active .cw2-opt-sub {
  color: var(--c-primary-dark, #4e7a46);
}

/* ── ЧИПЫ (длина / диаметр) ────────────────────────────────── */
.cw2-chip {
  flex: 1; min-width: 80px;
  border: 1.5px solid var(--c-line-soft, #dfe4dd);
  border-radius: 12px;
  padding: 9px 6px;
  text-align: center;
  cursor: pointer;
  background: var(--c-white, #fff);
  user-select: none;
  transition: 0.15s;
}
.cw2-chip:hover { border-color: var(--c-primary, #7aaa67); }
.cw2-chip.is-active {
  border-color: var(--c-primary, #7aaa67);
  background: var(--c-bg-soft, #eef4ed);
}
.cw2-chip strong {
  display: block; font-size: 13.5px;
  color: var(--c-ink, #1f241e);
}
.cw2-chip.is-active strong { color: var(--c-primary-dark, #4e7a46); }

/* ── ПУСТЫЕ ПЛИТКИ ─────────────────────────────────────────── */
.cw2-empty {
  padding: 16px;
  color: var(--c-ink-soft, #6b7269);
  font-size: 13px;
  text-align: center;
  width: 100%;
  grid-column: 1 / -1;
}

/* ── МОДАЛКА «ЗАКАЗАТЬ» ─────────────────────────────────────── */
.cw2-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.cw2-modal[hidden] { display: none; }
.cw2-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(17, 24, 39, .55);
  backdrop-filter: blur(2px);
}
.cw2-modal-dialog {
  position: relative;
  background: #fff;
  border-radius: 18px;
  width: min(520px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 24px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.cw2-modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; border: none;
  font-size: 26px; line-height: 1;
  color: #6b7269; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.cw2-modal-close:hover { background: #f3f4f6; color: #111827; }
.cw2-modal-title {
  margin: 0 0 6px; font-size: 20px; font-weight: 700; color: #1f241e;
}
.cw2-modal-lead {
  margin: 0 0 16px; font-size: 13px; color: #6b7269;
}

/* ── ФОРМА В МОДАЛКЕ ──────────────────────────────────────── */
.cw2-lead-form {
  display: flex; flex-direction: column; gap: 12px;
}
.cw2-form-field {
  display: flex; flex-direction: column; gap: 5px;
  position: relative;
}
.cw2-form-field label {
  font-size: 13px; font-weight: 600;
  color: var(--c-ink, #374151);
}
.cw2-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border, #dfe4dd);
  border-radius: 10px;
  font-size: 14px; font-family: inherit;
  background: #fff; color: var(--c-ink, #1f241e);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.cw2-input:focus {
  outline: none;
  border-color: var(--c-primary, #7aaa67);
  box-shadow: 0 0 0 3px rgba(120,170,103,.18);
}
.cw2-textarea {
  min-height: 140px; resize: vertical; line-height: 1.5;
  font-size: 13px;
}
.cw2-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px;
  color: var(--c-ink-soft, #6b7269);
  line-height: 1.5;
}
.cw2-check input { margin-top: 2px; accent-color: var(--c-primary, #7aaa67); }
.cw2-form-note {
  font-size: 12px;
  color: var(--c-ink-soft, #6b7269);
  line-height: 1.5;
  text-align: center;
}
.cw2-form-note a { color: var(--c-primary-dark, #4e7a46); }

/* ==========================================================================
   ЗОНА ПРЕВЬЮ КОНСТРУКТОРА — БЕЛАЯ ПАЛУБА + ТОНКАЯ СЕРАЯ РАМКА
   ----------------------------------------------------------------------
   Задача оператора:
     • убрать серо-зелёную заливку зоны фото (была --c-bg-soft);
     • сделать фон белым;
     • обвести зону маленькой серой рамкой 1px.

   Что делаем:
     • .cw2-stage  — background: #ffffff + border: 1px solid #d7dde3;
     • .cw2-stub   — гасим серую заливку заглушки, оставляем только текст,
                     чтобы внутри белой палубы не висел серый прямоугольник.

   Почему APPEND в конец файла:
     • специфичность селекторов та же, что у базовых правил выше;
     • правило, стоящее ПОЗЖЕ в файле, выигрывает каскад — существующие
       строки не тронуты, откат = удалить этот блок.
     • скругление (12px), overflow: hidden и position: relative остаются
       от прежних правил — их не переопределяем.

   Если захочешь крутить цвета — меняй только два значения ниже:
     #ffffff  — заливка палубы;
     #d7dde3  — цвет рамки (чуть темнее #e5e7eb, чтобы линия читалась).
   ========================================================================== */

/* --- Сама зона фото: белая палуба с тонкой серой окантовкой --- */
.cw2-stage {
  background: #ffffff;
  border: 1px solid #d7dde3;
  box-shadow: none;
}

/* --- Заглушка внутри зоны: без серой заливки, только текст --- */
.cw2-stub {
  background: transparent;
  color: #9097a1;
}

/* ==========================================================================
   📱 МОБИЛЬНАЯ ВОРОНКА — СНАЧАЛА ВЫБОР, ПОТОМ ИТОГ  (2026.11)
   ----------------------------------------------------------------------
   На ПК конструктор показывает две панели в ряд:
     • слева  — паспорт собранной бани (фото, комплектация, цена, «Заказать»);
     • справа — шаги воронки (материал → форма → длина → диаметр → вариант).

   На узких экранах панели складываются в столбик в порядке РАЗМЕТКИ,
   и «итог» оказывается сверху, а «выбор» — под ним. Клиент видит
   результат раньше, чем инструмент — читается задом наперёд.

   Лечение: на мобиле превращаем .cw2-grid в вертикальный флекс,
   а двум панелям раздаём order:
     • воронка (вторая панель в разметке) → order: 1  → показывается первой;
     • паспорт (первая панель)              → order: 2  → едет под воронку.

   Почему APPEND:
     • правка локальная, стоит ПОСЛЕ всех правил файла — гарантированно
       выигрывает каскад и ничего в конструкторе не ломает;
     • десктоп не затрагивается вообще — всё живёт внутри медиа-запроса.

   Если в самом constructor.css воронка/паспорт раскладываются в столбик
   на другой ширине (например, на 900 px или 768 px) — просто поменяй число
   в @media (max-width: 980px) на своё. На визуал десктопа это не влияет.
   ========================================================================== */
@media (max-width: 980px) {
  /* Панели — в один вертикальный стек. gap из базовых правил сохраняется. */
  .cw2-grid {
    display: flex;
    flex-direction: column;
  }

  /* 1-я панель разметки (паспорт/итог) уезжает вниз */
  .cw2-grid > .cw2-panel:first-child {
    order: 2;
  }

  /* 2-я панель разметки (воронка/выбор) поднимается наверх */
  .cw2-grid > .cw2-panel:last-child {
    order: 1;
  }
}

/* ==========================================================================
   📱 МОБИЛЬНАЯ ВОРОНКА — ВЫРАВНИВАНИЕ ПАНЕЛЕЙ ПО ШИРИНЕ  (2026.11)
   ----------------------------------------------------------------------
   Проблема (жалоба оператора):
     На телефоне «воронка» (правая панель разметки) сначала уже, чем
     «итог» (левая панель). После выбора древесины — выравнивается.

   Причина:
     Базовое правило .cw2-grid содержит `align-items: start` — это свойство
     из мира CSS Grid («прижать к верху»). Когда медиа-запрос ниже
     переключает .cw2-grid на `display: flex` + `flex-direction: column`,
     то же `align-items: start` начинает значить ДРУГОЕ: «не растягивать
     детей по поперечной оси» = по горизонтали. В итоге каждая панель
     сжимается до своего min-content:
       • паспорт (фото + цена + кнопка) — шире;
       • воронка (одна плитка материала) — уже.
     Выбрали материал → в воронке появились новые строки → её min-content
     подрос → она «догнала» паспорт. Отсюда эффект «выровнялось само».

   Лечение:
     • align-items: stretch — приказ flex-контейнеру растянуть детей
       на всю ширину. Повторяем явно, потому что базовое `start` живёт
       в том же селекторе и мы его перебиваем по каскаду;
     • width: 100% + min-width: 0 — жёсткая фиксация и защита от
       «разрыва» длинным словом/ценой (flex-элемент по умолчанию имеет
       min-width: auto и может вылезти за экран);
     • box-sizing: border-box — страховка, чтобы padding: 22px панели
       не добавлял лишние 44 px к ширине (если в site.css глобальный
       border-box вдруг не подключён).

   Почему APPEND:
     • правка стоит ПОСЛЕ всех прежних правил файла → каскад выигрывает;
     • всё внутри медиа-запроса → десктоп не затронут вообще;
     • откат = удалить этот блок целиком.
   Ширину перелома (980px) при необходимости меняй здесь же — она
   продублирована из блока «МОБИЛЬНАЯ ВОРОНКА — СНАЧАЛА ВЫБОР» выше.
   ========================================================================== */
@media (max-width: 980px) {
  /* Контейнер: дети растягиваются на всю ширину, а не по содержимому. */
  .cw2-grid {
    align-items: stretch;
  }

  /* Панель: ровно 100% ширины колонки, независимо от содержимого. */
  .cw2-grid > .cw2-panel {
    width: 100%;
    min-width: 0;              /* защита от разрыва длинным контентом */
    box-sizing: border-box;    /* padding не увеличивает ширину */
  }
}