/* qualifier.css — стили инлайн AI-квалификатора в панели результата квиза (/bbq).
 * Подключается ТОЛЬКО из bbq/index.html. styles.css НЕ трогаем.
 * Все классы префикснуты `lbq-` (LuxBeton Qualifier), чтобы не коллидить с
 * общими правилами styles.css (.msg/.composer/.header и т.п.).
 *
 * Два режима:
 *  - по умолчанию (desktop + fallback): инлайн-карточка внутри [data-result],
 *    скроллится только .lbq-messages.
 *  - .lbq-overlay (мобайл): fixed-оверлей по visualViewport (JS выставляет height
 *    + translateY), чтобы клавиатура не уносила ввод (перенесено из thank-you).
 */

.lbq-root {
  box-sizing: border-box;
  position: relative; /* для оверлея подтверждения закрытия (.lbq-confirm) */
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  margin: 16px auto 0;
  height: 440px;
  max-height: 70vh;
  background: #ECE5DD;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111;
  text-align: left;
}
.lbq-root *,
.lbq-root *::before,
.lbq-root *::after { box-sizing: border-box; }

/* ===== Мобильный fixed-оверлей (визуальный viewport) ===== */
.lbq-root.lbq-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  max-width: 720px;
  width: 100%;
  height: 100dvh;          /* JS переопределит высотой visualViewport */
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  z-index: 100000;
}

/* ===== Header ===== */
.lbq-header {
  flex: 0 0 auto;
  background: #075E54;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lbq-root.lbq-overlay .lbq-header { padding-top: max(12px, env(safe-area-inset-top)); }
.lbq-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff url("qualifier-avatar.png") center / contain no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex: 0 0 auto;
}
.lbq-info { flex: 1 1 auto; min-width: 0; }
.lbq-name { font-weight: 600; font-size: 15.5px; }
.lbq-status { font-size: 12px; opacity: 0.85; }
.lbq-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lbq-close:active { transform: scale(0.92); }

/* ===== Messages ===== */
.lbq-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lbq-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  font-size: 14.5px;
  line-height: 1.4;
}
.lbq-msg.bot { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.lbq-msg.user { align-self: flex-end; background: #DCF8C6; border-top-right-radius: 4px; }
.lbq-msg.system {
  align-self: center;
  background: rgba(225, 245, 254, 0.9);
  color: #555;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  text-align: center;
  max-width: 92%;
}
.lbq-msg.pick {
  align-self: center;
  background: rgba(7, 94, 84, 0.08);
  color: #075E54;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 10px;
  max-width: 92%;
  text-align: center;
}
.lbq-msg a { color: #075E54; text-decoration: underline; word-break: break-all; }

/* ===== Typing indicator ===== */
.lbq-typing {
  align-self: flex-start;
  background: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  border-top-left-radius: 4px;
  font-size: 14px;
  color: #999;
}
.lbq-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 1px;
  background: #999;
  border-radius: 50%;
  animation: lbq-typing 1.2s infinite;
}
.lbq-typing span:nth-child(2) { animation-delay: 0.2s; }
.lbq-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lbq-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ===== WhatsApp-выход (target, финал диалога) ===== */
.lbq-wa-exit {
  align-self: stretch;
  margin: 4px 6px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #25D366;
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.35);
}
.lbq-wa-exit:active { transform: scale(0.98); }
.lbq-wa-exit svg { width: 20px; height: 20px; flex: 0 0 auto; }

/* ===== Composer ===== */
.lbq-composer {
  flex: 0 0 auto;
  background: #F0F0F0;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid #e0e0e0;
}
.lbq-root.lbq-overlay .lbq-composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.lbq-input {
  flex: 1 1 auto;
  resize: none;
  border: none;
  border-radius: 18px;
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;          /* ≥16px — iOS не зумит при фокусе */
  background: #fff;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
}
.lbq-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #075E54;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}
.lbq-btn:active { transform: scale(0.92); }
.lbq-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.lbq-mic.recording { background: #d93025; }

/* ===== Подтверждение закрытия (анти-случайное) ===== */
.lbq-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10;
}
.lbq-confirm-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 18px 14px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}
.lbq-confirm-title { font-weight: 700; font-size: 16px; color: #111; margin-bottom: 6px; }
.lbq-confirm-text { font-size: 13.5px; color: #555; line-height: 1.4; margin-bottom: 14px; }
.lbq-confirm-actions { display: flex; flex-direction: column; gap: 8px; }
.lbq-confirm-stay {
  background: #075E54; color: #fff; border: none; border-radius: 10px;
  padding: 11px; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.lbq-confirm-stay:active { transform: scale(0.98); }
.lbq-confirm-leave {
  background: transparent; color: #8a8a8a; border: none;
  padding: 4px; font-size: 13px; cursor: pointer; text-decoration: underline;
}

/* ===== Видео-отзывы по комплектации (финал диалога, 2026-06-12) ===== */
/* Лента карточек как видео-вложения WhatsApp: постер + play + длительность. */
.lbq-rv-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 2px;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory;
  align-self: flex-start; max-width: 100%;
  /* messages — flex-колонка: без flex-shrink:0 скролл-лента схлопывается
     (min-content скролл-контейнера = 0), текстовые пузыри спасает текст. */
  flex-shrink: 0;
}
.lbq-rv-card {
  flex: 0 0 auto; width: 138px; border: none; background: none; padding: 0;
  cursor: pointer; text-align: left; scroll-snap-align: start;
  font: inherit;
}
.lbq-rv-thumb {
  position: relative; display: block; width: 138px; height: 184px;
  border-radius: 12px; overflow: hidden; background: #d8d8d8;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.lbq-rv-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.lbq-rv-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; padding-left: 4px;
}
.lbq-rv-dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 8px;
}
.lbq-rv-caption {
  display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.3;
  color: #6b6b6b;
}
/* Полноэкранный просмотр */
.lbq-rv-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 12px;
}
.lbq-rv-lightbox video {
  max-width: 100%; max-height: 82vh; border-radius: 8px; background: #000;
  outline: none;
}
.lbq-rv-lb-caption { color: #ddd; font-size: 13px; margin-top: 10px; }
.lbq-rv-close {
  position: absolute; top: 10px; right: 14px;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.14); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}

/* ===== Каталог-квалификация: кнопка выдачи каталога в финале чата (2026-06-12) ===== */
.lbq-catalog-exit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  align-self: stretch; margin: 4px 0 2px;
  background: #d2562c; color: #fff;
  border-radius: 24px; padding: 12px 18px;
  font-size: 14.5px; font-weight: 700; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  flex-shrink: 0; /* messages — flex-колонка (см. .lbq-rv-strip) */
}
.lbq-catalog-exit:active { transform: scale(0.99); }

/* Подложка под мобильным оверлеем: щели iOS-клавиатуры показывают фон чата, не сайт. */
.lbq-backdrop {
  position: fixed; inset: 0; height: 100lvh;
  background: #ECE5DD; z-index: 99999;
}
