/* ==========================================================================
   Блок: Нейро-бот витрины (.b-neuro-bot)
   Плавающая кнопка + чат-окно. Открытие — класс .is-open (assets/js/bot.js).
   ========================================================================== */

.b-neuro-bot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1250;
  font-family: var(--font-sans);
  transition: bottom 0.3s ease; /* поднимается, когда виден cookie-баннер */
}

/* --- Плавающая кнопка (лавандовый круг) ---------------------------------- */
.b-neuro-bot__fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--lavender);
  color: #FFF;
  box-shadow: 0 10px 26px rgba(110, 90, 126, 0.35);
  transition: background-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
}

.b-neuro-bot__fab:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(110, 90, 126, 0.42);
}

.b-neuro-bot__fab-icon {
  width: 26px;
  height: 26px;
}

/* Мягкий пульс, привлекающий внимание */
.b-neuro-bot__fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--lavender);
  animation: b-neuro-bot-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes b-neuro-bot-pulse {
  0%   { opacity: 0.7; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.45); }
  100% { opacity: 0;   transform: scale(1.45); }
}

.b-neuro-bot.is-open .b-neuro-bot__fab-pulse {
  animation: none;
  opacity: 0;
}

/* --- Окно чата ------------------------------------------------------------ */
.b-neuro-bot__window {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px rgba(59, 52, 55, 0.22);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.b-neuro-bot.is-open .b-neuro-bot__window {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Шапка ---------------------------------------------------------------- */
.b-neuro-bot__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--lavender-soft);
  border-bottom: 1px solid var(--line);
}

.b-neuro-bot__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  flex: 0 0 auto;
}

.b-neuro-bot__header-text {
  flex: 1 1 auto;
  min-width: 0;
}

.b-neuro-bot__name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
}

.b-neuro-bot__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5C5450;
}

.b-neuro-bot__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7A9B6D;
}

.b-neuro-bot__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
  transition: color var(--transition), background-color var(--transition);
}

.b-neuro-bot__close:hover {
  color: var(--accent);
  background: rgba(110, 90, 126, 0.08);
}

.b-neuro-bot__close svg {
  width: 14px;
  height: 14px;
}

/* --- Сообщения ------------------------------------------------------------ */
.b-neuro-bot__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
  background: var(--bg);
}

.b-neuro-bot__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: b-neuro-bot-msg-in 0.25s ease;
}

@keyframes b-neuro-bot-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.b-neuro-bot__msg--bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.b-neuro-bot__msg--user {
  align-self: flex-end;
  background: var(--accent);
  border-bottom-right-radius: 4px;
  color: #FFF;
}

.b-neuro-bot__msg a {
  color: var(--accent);
  border-bottom: 1px solid rgba(110, 90, 126, 0.35);
}

.b-neuro-bot__msg--user a {
  color: #FFF;
  border-color: rgba(255, 255, 255, 0.5);
}

/* Индикатор печати */
.b-neuro-bot__typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.b-neuro-bot__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lavender);
  animation: b-neuro-bot-typing 1.2s ease-in-out infinite;
}

.b-neuro-bot__typing span:nth-child(2) { animation-delay: 0.15s; }
.b-neuro-bot__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes b-neuro-bot-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* --- Быстрые вопросы-чипы ------------------------------------------------- */
.b-neuro-bot__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.b-neuro-bot__chips:empty {
  display: none;
}

.b-neuro-bot__chip {
  padding: 7px 12px;
  border: 1px solid var(--lavender);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition);
}

.b-neuro-bot__chip:hover {
  background: var(--lavender-soft);
  border-color: var(--accent);
}

/* --- Форма ввода ---------------------------------------------------------- */
.b-neuro-bot__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.b-neuro-bot__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.b-neuro-bot__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--lavender-soft);
}

.b-neuro-bot__send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF;
  flex: 0 0 auto;
  transition: background-color var(--transition), transform var(--transition);
}

.b-neuro-bot__send:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.b-neuro-bot__send svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 480px) {
  .b-neuro-bot {
    right: 16px;
    bottom: 16px;
  }

  .b-neuro-bot__window {
    bottom: 66px;
    height: min(480px, calc(100vh - 100px));
  }
}
