/* Chatbot v1 Foundation Styles */

#chatbot-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 400px;
  height: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.2);
  display: none; /* hidden by default */
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

.sender-name {
  display: block;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 2px;
  color: #555;
}

/* ================= BOT MESSAGE STYLES ================= */
.message.bot {
  justify-content: flex-start;
}

.message.bot .sender-name {
  color: #0A0A0A;
}

.message.bot .text {
  background: #e1ecf9;
  color: #222;
  padding: 8px 12px;
  border-radius: 12px;
}

/* ================= USER MESSAGE STYLES ================= */

/* Crucial: The container for the name and bubble */
.message-content {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  flex-grow: 1;
}

/* Default container for names */
.name-container {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

/* User message container: avatar + name + bubble */
.message.user {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
}

/* ✅ User name + avatar container (swap order) */
.message.user .name-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  gap: 6px; /* space between avatar and name */
}

/* ✅ Avatar first */
.message.user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  order: 0;
}

/* ✅ Username second */
.message.user .sender-name {
  font-size: 14px;
  font-weight: bold;
  color: #0A0A0A;
  text-align: right;
  width: auto;
  margin-bottom: 2px;
  order: 1;
}

/* Container for name + bubble */
.message.user .message-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* lock to right wall */
  max-width: 75%;
}

/* ✅ User bubble with wrapping */
.message.user .text {
  background: #5b9bd5;
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  align-self: flex-end;  /* align bubble to right */

  /* Wrapping fixes */
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  display: inline-block;
}

/* ================= GENERAL MESSAGE CONTAINER ================= */
.message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 6px;
}

.message .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ================= CHAT UI STYLES ================= */
#chatbot-header {
  background: #0066cc;
  color: white;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chatbot-header .chatbot-title {
  font-size: 15px;
  font-weight: bold;
  color: white;
  line-height: 1.2;
}

#chatbot-header .chatbot-tagline {
  font-size: 10px;
  color: white;
  opacity: 0.85;
  margin-top: 2px;
}

#chatbot-close {
  cursor: pointer;
  border: none;
  background: transparent;
  color: white;
  font-size: 18px;
  font-weight: bold;
}

#chatbot-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f4f6f9;
}

/* ================= CHAT INPUT & ICON ================= */
#chatbot-input {
  display: flex;
  border-top: 1px solid #ddd;
}

#chatbot-input input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 14px;
}

#chatbot-input button {
  border: none;
  background: #0066cc;
  color: #fff;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 14px;
}

#chatbot-icon {
  position: fixed;
  bottom: 20px;
  right: 40px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  border: 2px solid #0078FF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
}

#chatbot-icon img {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  object-fit: cover;
}

/* ================= TYPING INDICATOR ================= */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0;
}

/* Each dot */
.typing-indicator .dot {
  width: 2px;
  height: 2px;
  background-color: #000000;
  border-radius: 50%;
  animation: bounce 0.6s infinite;
}

/* Make each dot bounce one after another */
.typing-indicator .dot:nth-child(1) {
  animation-delay: 0s;
}
.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Bouncing animation */
@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
}
/* Ensure same font size for user and bot names */
.sender-name {
  font-size: 14px;   /* adjust to match */
  font-weight: bold;
}

