/* Нейроконсультант «Образ Мысли» — в тёплой палитре /v2 (app.css :root).
   Фолбэки на случай, если переменные не подгрузились: терракота --accent,
   тёмный --dark, карточки --card, линии --line, шрифт Onest. */

#nc-chat {
  /* bottom учитывает высоту куки-баннера (--om-cookie-h ставит его JS), чтобы кнопка
     «Спросить» не перекрывала баннер; после согласия переменная обнуляется. */
  position: fixed; right: 24px; bottom: calc(24px + var(--om-cookie-h, 0px)); z-index: 1090;
  transition: bottom .3s ease;
  font-family: var(--sans, 'Onest', system-ui, -apple-system, sans-serif);
  color: var(--ink, #202020);
}

/* атрибут hidden должен прятать элементы с явным display (flex переопределяет [hidden]) */
.nc-chat__launcher[hidden], .nc-chat__window[hidden], .nc-chat__lead[hidden] { display: none; }

/* ── лаунчер ── */
.nc-chat__launcher {
  height: 56px; padding: 0 20px 0 16px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent, #E8531C); color: #fff;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit; font-weight: 600; font-size: .98rem;
  box-shadow: 0 18px 40px -18px rgba(200,64,15,.55);
  transition: transform .2s var(--ease, cubic-bezier(.22,.61,.36,1)), box-shadow .2s ease, background .2s ease;
}
.nc-chat__launcher:hover { transform: translateY(-2px); background: var(--accent-deep, #C8400F); }
.nc-chat__launcher svg { width: 26px; height: 26px; flex: 0 0 auto; }
.nc-chat__launcher-label { white-space: nowrap; }

/* ── окно ── */
.nc-chat__window {
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 48px);
  background: var(--bg, #F4F3F1);
  border: 1px solid var(--line, #E7E5E1);
  border-radius: var(--radius, 28px);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.4);
  display: flex; flex-direction: column; overflow: hidden;
}

/* ── шапка ── */
.nc-chat__header {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 18px;
  background: var(--dark, #1A1815); color: #fff;
}
.nc-chat__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent, #E8531C); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.nc-chat__title { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.25; }
.nc-chat__close {
  background: none; border: none; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px;
}
.nc-chat__close:hover { opacity: 1; }

/* ── лента сообщений ── */
.nc-chat__log {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg, #F4F3F1);
}
.nc-chat__log::-webkit-scrollbar { width: 8px; }
.nc-chat__log::-webkit-scrollbar-thumb { background: var(--line, #E7E5E1); border-radius: 8px; }

.nc-chat__msg {
  max-width: 86%; padding: 10px 14px; border-radius: 18px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}
.nc-chat__msg--assistant {
  align-self: flex-start; background: var(--card, #fff);
  border: 1px solid var(--line, #E7E5E1);
  border-bottom-left-radius: 6px; color: var(--ink, #202020);
}
.nc-chat__msg--user {
  align-self: flex-end; background: var(--accent-soft, #FCE9E0);
  border-bottom-right-radius: 6px; color: var(--ink, #202020);
}
.nc-chat__typing { opacity: .7; font-style: italic; color: var(--ink-soft, #5C5C5A); }
.nc-chat__tel { color: var(--accent-deep, #C8400F); font-weight: 600; text-decoration: underline; white-space: nowrap; }

/* ── форма заявки ── */
.nc-chat__lead {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--line, #E7E5E1); background: var(--bg-2, #fff);
}
.nc-chat__lead input {
  flex: 1; min-width: 0; padding: 11px 13px; font: inherit; font-size: 14px;
  color: var(--ink, #202020); background: #fff;
  border: 1px solid var(--line, #E7E5E1); border-radius: var(--radius-s, 12px);
}

/* ── поле ввода ── */
.nc-chat__form {
  display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px;
  border-top: 1px solid var(--line, #E7E5E1); background: var(--bg-2, #fff);
}
.nc-chat__input {
  flex: 1; resize: none; max-height: 96px; padding: 11px 13px;
  font: inherit; font-size: 14px; color: var(--ink, #202020); background: #fff;
  border: 1px solid var(--line, #E7E5E1); border-radius: 14px;
}
.nc-chat__input:focus, .nc-chat__lead input:focus {
  outline: none; border-color: var(--accent, #E8531C);
  box-shadow: 0 0 0 3px var(--accent-soft, #FCE9E0);
}

/* ── кнопки-CTA (терракота) ── */
.nc-chat__send {
  flex: 0 0 auto; width: 44px; height: 44px; border: none; cursor: pointer;
  border-radius: var(--radius-s, 12px); background: var(--accent, #E8531C); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.nc-chat__send svg { width: 20px; height: 20px; }
.nc-chat__lead-send {
  flex: 0 0 auto; padding: 0 16px; border: none; cursor: pointer; border-radius: var(--radius-s, 12px);
  background: var(--accent, #E8531C); color: #fff; font: inherit; font-weight: 600; font-size: 14px;
  transition: background .15s ease;
}
.nc-chat__send:hover, .nc-chat__lead-send:hover { background: var(--accent-deep, #C8400F); }

.nc-chat__disclaimer {
  padding: 8px 14px 12px; font-size: 11px; text-align: center;
  color: var(--ink-faint, #8C8C88); background: var(--bg-2, #fff);
}

@media (max-width: 480px) {
  #nc-chat { right: 16px; bottom: calc(16px + var(--om-cookie-h, 0px)); }
  .nc-chat__launcher-label { display: none; }
  .nc-chat__launcher { width: 56px; padding: 0; justify-content: center; }
}

/* Фуллскрин-окно на ВСЕХ телефонах (вкл. крупные >480px — phablet'ы рапортуют до ~600px)
   и в портретных планшетах. vh-фолбэк ПЕРЕД dvh: браузеры без поддержки dvh
   (старый Samsung Internet / Android WebView) иначе откатывали высоту к базовым 560px
   → окно-«модалка» с полями вместо фуллскрина (см. репорт 2026-06-17). */
@media (max-width: 768px) {
  .nc-chat__window {
    position: fixed; right: 0; bottom: 0;
    width: 100vw; max-width: 100vw;
    height: 100vh; max-height: 100vh;
    height: 100dvh; max-height: 100dvh;
    border: none; border-radius: 0;
  }
}
