/* ================= CHATBOT STYLES ================= */

/* Принудительное переопределение возможных конфликтующих стилей */
.chatbot-widget * {
  box-sizing: border-box;
}

.chatbot-widget {
  position: fixed;
  bottom: 150px;
  right: 20px;
  width: 380px;
  max-height: 550px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  border: 1px solid rgba(79, 70, 229, 0.1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chatbot-widget.active {
  display: flex;
  animation: slideInUp 0.3s ease-out;
}

.chatbot-widget .chatbot-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  min-height: 60px;
}

.chatbot-widget .chatbot-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.chatbot-widget .chatbot-header-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 2;
}

.chatbot-widget .chatbot-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  line-height: 1.3;
  color: #ffffff;
  background: none;
  text-decoration: none;
  display: block;
  visibility: visible;
  opacity: 1;
}

.chatbot-widget .chatbot-status {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  line-height: 1.2;
  background: none;
  text-decoration: none;
  visibility: visible;
}

.chatbot-widget .chatbot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.chatbot-widget .chatbot-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.chatbot-widget .chatbot-message.bot {
  background: #e0f2fe;
  border: 1px solid #b3e5fc;
  color: #0f172a; /* тёмный читаемый текст */
}

.chatbot-widget .chatbot-message.user {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #0f172a; /* тёмный читаемый текст */
  text-align: right;
  margin-left: auto;
}
.chatbot-widget .chatbot-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.chatbot-widget .chatbot-messages {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  font-size: 0.9rem;
  background: #f8fafc;
  max-height: 350px;
}

.chatbot-widget .chatbot-message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
  animation: messageAppear 0.3s ease-out;
}


.chatbot-widget .chatbot-message.typing {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: italic;
  color: #64748b;
}

.typing-dots {
  display: inline-block;
  min-width: 20px;
  animation: typingDots 1.4s infinite;
}

.chatbot-widget .chatbot-input-container {
  display: flex;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.chatbot-widget .chatbot-input-container input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
}

.chatbot-widget .chatbot-input-container input::placeholder {
  color: #9ca3af;
}

.chatbot-widget .chatbot-input-container button {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  padding: 14px 18px;
  cursor: pointer;
  margin-top: 0;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-widget .chatbot-input-container button:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: scale(1.05);
}

.chatbot-toggle {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
  transition: all 0.3s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-toggle:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

/* ================= ANIMATIONS ================= */

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingDots {
  0%, 60%, 100% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
}

/* ================= RESPONSIVE DESIGN ================= */

@media (max-width: 768px) {
  .chatbot-widget {
    bottom: 130px;
    width: calc(100vw - 30px);
    right: 15px;
    left: 15px;
    max-height: 450px;
  }
  
  .chatbot-toggle {
    bottom: 70px;
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .chatbot-widget {
    bottom: 110px;
    width: calc(100vw - 20px);
    right: 10px;
    left: 10px;
    max-height: 400px;
  }
  
  .chatbot-toggle {
    bottom: 60px;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .chatbot-widget .chatbot-header {
    padding: 12px 16px;
    min-height: 50px;
  }
  
  .chatbot-widget .chatbot-title {
    font-size: 1rem;
  }
  
  .chatbot-widget .chatbot-status {
    font-size: 0.8rem;
  }
  
  .chatbot-widget .chatbot-input-container input {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
  
  .chatbot-widget .chatbot-input-container button {
    padding: 12px 16px;
    font-size: 1rem;
  }
}