/* ============================================================
   Атмосфера — чат-консультант «Атмо».
   Переменные берём из style.css с безопасными fallback
   (в блоге style.css не подключён).
   ============================================================ */

.atmo-chat {
  --ac-gold-grad: var(--gold-grad, linear-gradient(135deg, #deab68, #f4c84b));
  --ac-gold-deep: var(--gold-deep, #c98f1b);
  --ac-paper: var(--paper, #faf6ee);
  --ac-ink: var(--ink, #111413);
  --ac-text: var(--text, #2b2410);
  --ac-muted: var(--muted, #6b6459);
  --ac-muted2: var(--muted-2, #8a8175);
  --ac-line: rgba(20, 17, 15, .12);
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 75;
  font-family: inherit;
}

.atmo-chat__fab {
  position: fixed;
  left: 18px;
  right: auto;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  cursor: pointer;
  background: var(--ac-gold-grad);
  color: var(--ac-text);
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38);
  font-weight: 800;
  font-size: 13.5px;
  transition: transform .18s, box-shadow .18s;
}
.atmo-chat__fab:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.atmo-chat__fab img { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; background: #fff; }

.atmo-chat__panel {
  position: fixed;
  left: 18px;
  right: auto;
  bottom: 84px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--ac-paper);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}
.atmo-chat__panel.is-open { opacity: 1; pointer-events: auto; transform: none; }

.atmo-chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--ac-ink);
  color: #fff;
  flex: 0 0 auto;
}
.atmo-chat__ava { width: 38px; height: 38px; object-fit: contain; border-radius: 50%; background: #fff; }
.atmo-chat__who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.atmo-chat__who b { font-size: 15px; color: var(--ac-gold-deep); }
.atmo-chat__who i { font-style: normal; font-size: 11px; color: #cfc6b8; }
.atmo-chat__close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.atmo-chat__close:hover { background: rgba(255, 255, 255, .16); }

.atmo-chat__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(#fdfaf4, #f4ecdd);
  -webkit-overflow-scrolling: touch;
}

.atmo-chat__msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.atmo-chat__msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e4e0d8;
  border-bottom-left-radius: 5px;
  color: var(--ac-text);
}
.atmo-chat__msg--user {
  align-self: flex-end;
  background: var(--ac-gold-grad);
  border-bottom-right-radius: 5px;
  color: var(--ac-text);
  font-weight: 600;
}

.atmo-chat__typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid #e4e0d8;
  border-radius: 14px;
  padding: 5px 11px 5px 6px;
  font-size: 12.5px;
  color: var(--ac-muted);
}
.atmo-chat__typing img { width: 28px; height: 28px; object-fit: contain; }

.atmo-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.atmo-chat__chip {
  border: 1px solid rgba(201, 161, 59, .5);
  background: rgba(244, 200, 75, .18);
  color: #7a5c10;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
}
.atmo-chat__chip:hover { background: rgba(244, 200, 75, .34); }

.atmo-chat__form {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e4e0d8;
  flex: 0 0 auto;
}
.atmo-chat__form input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #e4e0d8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--ac-text);
}
.atmo-chat__form input:focus { border-color: var(--ac-gold-deep); }
.atmo-chat__form button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  background: var(--ac-gold-grad);
  color: var(--ac-text);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}
.atmo-chat__form button:disabled { opacity: .55; cursor: default; }

.atmo-chat__note {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--ac-muted2);
  text-align: center;
  background: #fff;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .atmo-chat { z-index: 1005; }
  body.atmo-chat-open { overflow: hidden; }
  .atmo-chat__fab { left: auto; right: 14px; bottom: 14px; padding: 8px; border-radius: 50%; }
  .atmo-chat__fabtext { display: none; }
  .atmo-chat__panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    transform: translateY(100%);
  }
  .atmo-chat__panel.is-open { transform: none; }
  .atmo-chat__head { padding-top: calc(11px + env(safe-area-inset-top)); }
  .atmo-chat__form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .atmo-chat__msg { max-width: 92%; font-size: 14px; }
}

/* карточки подобранных товаров в чате */
.atmo-chat__products { display: flex; flex-direction: column; gap: 8px; }
.atmo-chat__product {
  display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid #e4e0d8;
  border-radius: 12px; padding: 8px; text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.atmo-chat__product:hover { border-color: var(--ac-gold-deep); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.atmo-chat__plink { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.atmo-chat__prow { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px; margin-top: 2px; }
.atmo-chat__pfav {
  border: 0; background: none; padding: 0; font: inherit; font-size: 10.5px; font-weight: 800;
  color: #8a6414; cursor: pointer; white-space: nowrap;
}
.atmo-chat__pfav:hover { color: #c98f1b; }
.atmo-chat__pfav.is-on { color: #c14a33; }
.atmo-chat__product img { width: 54px; height: 54px; object-fit: contain; background: #fff; border-radius: 8px; flex: 0 0 auto; }
.atmo-chat__noimg {
  width: 54px; height: 54px; display: grid; place-items: center; font-size: 10px; color: #8a8175;
  background: #f6f0e4; border-radius: 8px; flex: 0 0 auto; text-align: center;
}
.atmo-chat__pbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.atmo-chat__pbody b {
  font-size: 12.5px; line-height: 1.3; color: #2b2410;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.atmo-chat__pbody i { font-style: normal; font-size: 10.5px; color: #8a8175; }
.atmo-chat__pbody em {
  font-style: normal; font-size: 10.5px; color: #6b6459; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.atmo-chat__pgo { font-size: 10.5px; font-weight: 800; color: #a87d1b; white-space: nowrap; flex: 0 0 auto; }
/* калькулятор ламината/плитки у карточки товара в чате */
.atmo-chat__pcalc {
  border: 0; background: none; padding: 0; font: inherit; font-size: 10.5px; font-weight: 800;
  color: #8a6414; cursor: pointer; white-space: nowrap; flex: 0 0 auto;
}
.atmo-chat__pcalc:hover { color: #c98f1b; }
/* кнопки-ссылки на разделы каталога */
.atmo-chat__catlinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.atmo-chat__catlink {
  display: inline-block; font-size: 12px; font-weight: 700; color: #2b2410;
  background: #fff; border: 1px solid #e4d9be; border-radius: 999px; padding: 6px 12px;
  text-decoration: none; white-space: nowrap;
}
.atmo-chat__catlink:hover { border-color: #c9a13b; background: #fff8e6; }
@media (max-width: 640px) {
  .atmo-chat__pbody b { font-size: 13px; }
  .atmo-chat__pbody em { font-size: 11px; }
}

/* на странице подбора слева живёт маскот-статус — чат оставляем справа */
@media (min-width: 641px) {
  .pb-body .atmo-chat__fab { left: auto; right: 18px; }
  .pb-body .atmo-chat__panel { left: auto; right: 18px; }
}

/* ответы менеджера, системные заметки и форма контакта */
.atmo-chat__mgr {
  margin-left: auto;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #f4c84b;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.atmo-chat__mgr:hover { background: rgba(255,255,255,.16); }
.atmo-chat__mgr:disabled { opacity: .6; cursor: default; color: #cfc6b8; }
.atmo-chat__mgr.is-waiting { color: #ffd27a; border-color: rgba(244,200,75,.45); }
.atmo-chat__mgr.is-online {
  background: #1f7a4d;
  border-color: #1f7a4d;
  color: #fff;
  opacity: 1;
  padding: 0 12px;
}
.atmo-chat__mgr.is-online::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ff0c0;
  display: inline-block;
  margin-right: 5px;
  flex: 0 0 6px;
}
.atmo-chat__close { margin-left: 0; }
.atmo-chat__msg--admin {
  align-self: flex-start;
  background: #fff8e6;
  border: 1px solid #e6c977;
  border-bottom-left-radius: 5px;
  color: #2b2410;
}
.atmo-chat__author {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  color: #a87d1b;
  margin-bottom: 3px;
}
.atmo-chat__system {
  align-self: center;
  max-width: 92%;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(20,17,15,.06);
  color: #8a8175;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}
.atmo-chat__contact {
  position: relative;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #fff;
  border: 1px solid #e6c977;
  border-radius: 12px;
  padding: 10px;
}
.atmo-chat__contact-title { font-size: 12px; font-weight: 700; color: #3a2c12; line-height: 1.35; }
.atmo-chat__contact input[type="text"], .atmo-chat__contact input[type="tel"] {
  border: 1.5px solid #e4e0d8;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: #2b2410;
  background: #fff;
}
.atmo-chat__contact input[type="text"]:focus, .atmo-chat__contact input[type="tel"]:focus { border-color: #c98f1b; }
.atmo-chat__contact-send {
  align-self: flex-start;
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--ac-gold-grad);
  color: #2b2410;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
}
.atmo-chat__contact-send:disabled { opacity: .6; cursor: default; }
.atmo-chat__contact-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8a8175;
  font-size: 19px;
  line-height: 22px;
  cursor: pointer;
}
.atmo-chat__contact-close:hover { color: #3a2c12; }
.atmo-chat__contact-sub { font-size: 11px; line-height: 1.4; color: #7a6f60; }
.atmo-chat__consent {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 10.5px;
  line-height: 1.35;
  color: #7a6f60;
  cursor: pointer;
}
.atmo-chat__consent input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  padding: 0;
  border: 0;
  flex: 0 0 auto;
  accent-color: #c98f1b;
}
.atmo-chat__consent a { color: #8a6414; text-decoration: underline; }
.atmo-chat__contact-err { color: #c14a33; font-size: 11px; min-height: 12px; }

/* показ по расписанию и выбранная сторона кнопки (настройки в админке) */
.atmo-chat--hidden { display: none !important; }
.atmo-chat--right .atmo-chat__fab { left: auto; right: 18px; }
.atmo-chat--right .atmo-chat__panel { left: auto; right: 18px; }
.atmo-chat--left .atmo-chat__fab { left: 18px; right: auto; }
.atmo-chat--left .atmo-chat__panel { left: 18px; right: auto; }
.pb-body .atmo-chat--left .atmo-chat__fab { left: 18px; right: auto; }
.pb-body .atmo-chat--right .atmo-chat__fab { left: auto; right: 18px; }
@media (max-width: 640px) {
  .atmo-chat--left .atmo-chat__fab { left: 14px; right: auto; }
  .atmo-chat--right .atmo-chat__fab { left: auto; right: 14px; }
  .atmo-chat--above-bar .atmo-chat__fab { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .atmo-chat--left .atmo-chat__panel,
  .atmo-chat--right .atmo-chat__panel { left: 0; right: 0; }
}
