/* Existing Styles */

/* Positioning and styling the floating button */
.xipt-chatbot-button {
  position: fixed;
  bottom: 70px;
  right: 26px;
  background: #4A90E2;
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Floating chat container */
.xipt-chatbot-container {
  position: fixed;
  bottom: 120px;
  right: 50px;
  width: 350px;
  max-height: 500px; /* Ensures the container doesn't grow too large */
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  overflow: hidden; /* Hide overflow beyond container boundary */
}

/* Chat header */
.chat-header {
  background: #4A90E2;
  color: #ffffff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.chat-header span {
  font-weight: bold;
}

.chat-header .chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* Chat messages container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #f9f9f9;
  max-height: 350px; /* Prevents messages section from growing endlessly */
}

.user-message {
  text-align: right;
  margin: 5px;
  background: #daf7a6;
  display: inline-block;
  padding: 8px;
  border-radius: 5px;
  white-space: pre-wrap; /* Keep formatting for user messages */
}

.bot-message {
  text-align: left;
  margin: 5px;
  background: #ffffff;
  display: block;
  padding: 8px;
  border-radius: 5px;
  white-space: pre-wrap; /* Preserve formatting and line breaks */
}

/* Typing indicator */
.typing-indicator {
  font-style: italic;
  color: #555;
  display: flex;
  align-items: center;
}

.typing-indicator::after {
  content: '';
  display: inline-block;
  margin-left: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  animation: typing 1s infinite;
}

@keyframes typing {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Chat input area */
.chat-input {
  display: flex;
  border-top: 1px solid #ccc;
  padding: 5px;
  background: #fafafa;
}

#chat-prompt {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
}

/* Make the placeholder less visible */
#chat-prompt::placeholder {
  color: #aaa;
  font-style: italic;
}

#chat-send {
  padding: 8px 12px;
  margin-left: 5px;
  background: #4A90E2;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#chat-send:hover {
  background: #3b76b2;
}
