/* --- КНОПКИ --- */
.floating-buttons-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 9999;
}

.tg-shop-btn {
  width: 60px;
  height: 60px;
  background-color: #24A1DE;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  transition: transform 0.3s;
  cursor: pointer;
  position: relative;
}
.tg-shop-btn:hover { transform: scale(1.1); }
.tg-shop-btn svg { width: 30px; height: 30px; fill: white; }

.tg-tooltip {
  position: absolute;
  right: 70px;
  background: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tg-shop-btn:hover .tg-tooltip { opacity: 1; }

.ai-widget-btn {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s;
  border: none;
  color: white;
  font-size: 28px;
}
.ai-widget-btn:hover { transform: scale(1.1); }

/* --- ОКНО ЧАТА --- */
.ai-chat-window {
  position: fixed;
  bottom: 100px;
  right: 20px;
  /* УВЕЛИЧЕННЫЙ РАЗМЕР КАК В AMOCRM */
  width: 360px;
  height: 600px; 
  max-height: 80vh; /* Чтобы не вылезало на маленьких экранах */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 5px 30px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  z-index: 10000;
  font-family: sans-serif;
  border: 1px solid #eee;
  overflow: hidden;
}

/* Адаптив для мобильных */
@media (max-width: 480px) {
  .ai-chat-window {
    width: 90%;
    height: 80vh;
    right: 5%;
    bottom: 90px;
  }
}

.ai-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.ai-close { cursor: pointer; font-size: 20px; }

.ai-messages {
  flex-grow: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f4f4f9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid #e0e0e0; color: #333; border-bottom-left-radius: 2px; }
.ai-msg.user { align-self: flex-end; background: #764ba2; color: #fff; border-bottom-right-radius: 2px; }

.ai-msg a { color: #007bff; text-decoration: underline; font-weight: bold; }
.ai-msg.user a { color: #fff; }

/* ЗОНА ВВОДА */
.ai-input-area {
  padding: 12px;
  border-top: 1px solid #eee;
  background: #fff;
  display: flex;
  align-items: flex-end; /* Кнопка прижата к низу */
  gap: 10px;
  flex-shrink: 0;
}

.ai-input {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 12px 15px; /* Чуть больше отступы */
  outline: none;
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  background-color: #f9f9f9;
  
  /* ВАЖНО ДЛЯ РАСТЯГИВАНИЯ */
  height: 46px; /* Начальная высота */
  min-height: 46px;
  max-height: 150px; /* Максимальная высота перед скроллом */
  overflow: hidden;  /* Скрываем скролл, пока не достигнем max-height */
  box-sizing: border-box;
}

.ai-input:focus { background-color: #fff; border-color: #3390ec; }

.ai-send {
  background: #764ba2;
  color: #fff;
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  transition: transform 0.2s;
  padding: 0;
}
.ai-send:hover { transform: scale(1.1); }
.ai-typing { font-size: 11px; color: #888; padding: 5px 15px; display: none; background: #f4f4f9;}