/* static/styles/chatbot.css
   Стили для виджета чат-бота */

/* Кнопка для открытия чата */
.chatbot-toggle-btn {
  /* Скрыто пока — убрать когда чатбот снова нужен */
  display: none !important;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary, #3b82f6);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-toggle-btn:hover {
  background: var(--color-primary-hover, #2563eb);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle-btn-hidden {
  display: none;
}

/* Контейнер виджета */
.chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
  border: 1px solid var(--color-border, #e5e7eb);
}

.chatbot-widget-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Заголовок */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-primary, #3b82f6);
  color: white;
  border-radius: 12px 12px 0 0;
}

.chatbot-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chatbot-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
  line-height: 1;
  padding: 0;
}

.chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Контейнер сообщений */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-bg, #f9fafb);
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Приветственное сообщение */
.chatbot-welcome {
  text-align: center;
  color: var(--color-text-muted, #6b7280);
  padding: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.chatbot-welcome p {
  margin: 8px 0;
}

/* Сообщения */
.chatbot-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.chatbot-message-user {
  align-self: flex-end;
  background: var(--color-primary, #3b82f6);
  color: white;
  border-bottom-right-radius: 4px;
}

.chatbot-message-assistant {
  align-self: flex-start;
  background: white;
  color: var(--color-text, #1f2937);
  border: 1px solid var(--color-border, #e5e7eb);
  border-bottom-left-radius: 4px;
}

.chatbot-message-assistant a {
  color: var(--color-primary, #3b82f6);
  text-decoration: underline;
}

.chatbot-message-assistant a:hover {
  color: var(--color-primary-hover, #2563eb);
}

.chatbot-message-assistant strong {
  font-weight: 600;
}

.chatbot-message-assistant em {
  font-style: italic;
}

.chatbot-message-assistant ul {
  margin: 8px 0;
  padding-left: 20px;
}

.chatbot-message-assistant li {
  margin: 4px 0;
}

/* Индикатор печати */
.chatbot-loading {
  background: white;
  border: 1px solid var(--color-border, #e5e7eb);
}

.chatbot-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.chatbot-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted, #9ca3af);
  animation: typing 1.4s infinite;
}

.chatbot-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Контейнер ввода */
.chatbot-input-container {
  padding: 16px;
  border-top: 1px solid var(--color-border, #e5e7eb);
  background: white;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chatbot-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--color-primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chatbot-send-btn {
  padding: 10px 20px;
  background: var(--color-primary, #3b82f6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.chatbot-send-btn:hover:not(:disabled) {
  background: var(--color-primary-hover, #2563eb);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Футер */
.chatbot-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-bg-subtle, #f3f4f6);
  border-radius: 0 0 12px 12px;
}

.chatbot-clear-btn {
  background: none;
  border: none;
  color: var(--color-text-muted, #6b7280);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.chatbot-clear-btn:hover {
  color: var(--color-text, #1f2937);
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
  .chatbot-widget {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  
  .chatbot-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
}
