/* ===== Виджет ИИ-консультант «Тумэн» ===== */

/* Кнопка */
#fs-consultant-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1B3A2F, #2F6B4F);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(27, 58, 47, 0.4);
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#fs-consultant-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(27, 58, 47, 0.5);
}
#fs-consultant-btn.open { transform: rotate(0); background: #A4442F; }

/* Потряхивание */
@keyframes fs-consultant-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-12deg); }
  30% { transform: rotate(10deg); }
  45% { transform: rotate(-8deg); }
  60% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}
#fs-consultant-btn.fs-shake { animation: fs-consultant-shake 0.8s ease-in-out; }

/* Окно */
#fs-consultant-window {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #F5F1E8;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(27, 58, 47, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
#fs-consultant-window.open { display: flex; }

/* Шапка окна */
.fs-c-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #1B3A2F;
  color: #fff;
}
.fs-c-header .fs-c-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #B8935A;
  background: #fff;
}
.fs-c-header .fs-c-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fs-c-title { font-weight: 700; font-size: 1rem; }
.fs-c-sub { font-size: 0.72rem; color: #B8935A; }

/* Сообщения */
.fs-c-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fs-c-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.fs-c-msg.assistant { align-self: flex-start; background: #fff; color: #1B3A2F; border: 1px solid #E3DCCB; }
.fs-c-msg.user { align-self: flex-end; background: #1B3A2F; color: #fff; }
.fs-c-msg.error { align-self: center; background: #f8e3dd; color: #A4442F; font-size: 0.85rem; }
.fs-c-typing { opacity: 0.7; font-style: italic; }

/* Ввод */
.fs-c-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #E3DCCB;
}
.fs-c-input {
  flex: 1;
  resize: none;
  border: 1px solid #D9D2C4;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  max-height: 80px;
  outline: none;
}
.fs-c-input:focus { border-color: #B8935A; }
.fs-c-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #B8935A;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.fs-c-send:hover { background: #9A7842; }
.fs-c-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 480px) {
  #fs-consultant-window { right: 8px; left: 8px; width: auto; bottom: 88px; }
  #fs-consultant-btn { right: 16px; bottom: 16px; }
}
