/* Позиционирование кнопки-иконки */
#foqira-chat-toggle {
  position: fixed;
  bottom: 50px;
  right: 50px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #ff4d22;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg fill="%23ecece6" height="40" viewBox="0 0 24 24" width="40" xmlns="http://www.w3.org/2000/svg"><path d="M4 4h16v12H7l-3 3V4z"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 1001;
}

/* Анимация пульсации */
@keyframes foqira-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

#foqira-chat-toggle.pulse {
  animation: foqira-pulse 1s infinite;
}

/* Окно чата */
#foqira-chat-widget {
  position: fixed;
  bottom: 120px;    /* чуть выше кнопки */
  right: 50px;
  width: 300px;
  max-width: 90%;
  height: 400px;
  max-height: 70%;
  background-color: #ecece6;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: sans-serif;
  z-index: 1000;
}

/* Заголовок */
.foqira-chat-header {
  background-color: #1a1a1a;
  color: #ecece6;
  padding: 10px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Крестик закрытия */
.foqira-chat-close {
  cursor: pointer;
  font-size: 18px;
  color: #ff4d22;
}

/* Область сообщений */
.foqira-chat-body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background-color: #ffffff;
  /* чтобы можно было скроллить весь текст */
}

/* Футер (поле ввода + кнопка) */
.foqira-chat-footer {
  padding: 10px;
  border-top: 1px solid #1a1a1a;
  display: flex;
}

.foqira-chat-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
  margin-right: 8px;
}

.foqira-chat-send {
  background-color: #ff4d22;
  border: none;
  color: #ecece6;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* Сообщения */
.foqira-message {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 4px;
  max-width: 80%;
  /* Разрешаем переносить длинные слова и сохранять переводы строк */
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

.foqira-message--bot {
  background-color: #1a1a1a;
  color: #ecece6;
  align-self: flex-start;
}

.foqira-message--user {
  background-color: #ff4d22;
  color: #ecece6;
  align-self: flex-end;
}

/* typing indicator */
.foqira-typing {
  display: flex;
  align-items: center;
  font-style: italic;
  color: #777;
  margin-bottom: 8px;
}

/* Бот печатает */
.foqira-typing-dot {
  width: 6px;
  height: 6px;
  background: #777;
  border-radius: 50%;
  margin: 0 2px;
  opacity: 0.3;
  animation: foqira-dot 1s infinite;
}
.foqira-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.foqira-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes foqira-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-4px); }
}