/* Existing CSS - Keep these as they are good starting points */
#chatbot-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0078d7;
  color: white;
  font-size: 26px;
  padding: 14px 18px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 999;
  transition: transform 0.2s;
}
#chatbot-button:hover {
  transform: scale(1.1);
}

#chatbot-window {
  display: none; /* This will be set to 'flex' by JS */
  flex-direction: column; /* IMPORTANT: This is crucial for align-self to work */
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 320px;
  height: 420px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 1000;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

#chat-header {
  background: #0078d7;
  color: white;
  padding: 12px;
  font-weight: bold;
  text-align: center;
}

#chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-size: 14px;
  /* NEW: Add flex display to the messages container itself */
  display: flex;
  flex-direction: column; /* This makes the individual messages stack vertically and allows align-self */
}

#chat-input {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
}

#chat-input input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: black;
}

#chat-input button {
  background: #0078d7;
  color: white;
  border: none;
  margin-left: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* Message Bubble Styling */
.bot-msg,
.user-msg {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 16px;
  max-width: 85%;
  line-height: 1.4em;
  /* Adding these for better control */
  word-wrap: break-word; /* Ensures long words wrap */
  box-sizing: border-box; /* Include padding/border in element's total width */
}

/* User Messages - Aligned Right */
.user-msg {
  background: #DCF8C6; /* Light green, like WhatsApp sent messages */
  color: #1A1A1A; /* Darker text for readability */
  align-self: flex-end; /* Aligns to the right of the flex container */
  /* Optional: Add a small triangular "tail" for bubble effect */
  border-bottom-right-radius: 3px; /* Slightly sharper corner for the tail side */
}

/* Bot Messages - Aligned Left */
.bot-msg {
  background: #E0E0E0; /* Light grey, like WhatsApp received messages */
  color: #1A1A1A; /* Darker text for readability */
  align-self: flex-start; /* Aligns to the left of the flex container */
  /* Optional: Add a small triangular "tail" for bubble effect */
  border-bottom-left-radius: 3px; /* Slightly sharper corner for the tail side */
}