/* ---------------------------
   Chatbot trigger / character
   --------------------------- */
#chatbot-character {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none;
  align-items: flex-end;
  cursor: pointer;
  z-index: 1000;
}

.character {
  width: 70px;
  height: 100px;
  background: url("Ti Bot.png") no-repeat center/contain;
  animation: chatbot-bounce 2s infinite;
}

.speech-bubble {
  background: #1c4980;
  color: white;
  padding: 8px 12px;
  border-radius: 12px;
  margin-right: 10px;
  font-size: 14px;
  position: relative;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  border-left: 10px solid #1c4980;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

/* Unique bounce animation for chatbot */
@keyframes chatbot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------------------------
   Chatbot window
   --------------------------- */
#chatbot-window {
  display: none;
  position: fixed;
  bottom: 140px;
  right: 20px;
  width: 320px;
  max-height: 420px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  flex-direction: column;
  z-index: 1000;
  font-family: "Poppins", sans-serif;
}

#chatbot-header {
  background: #1c4980;
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: bold;
  position: relative;
}

#close-btn {
  position: absolute;
  right: 10px;
  top: 5px;
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

/* Chat container */
#chatbot-body {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------------------------
   Chat bubble styles (single consolidated block)
   --------------------------- */
.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 15px;
  margin: 5px 0;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.28s ease;
  display: inline-block;
}

/* BOT replies — left */
.chat-bubble.bot {
  background: #e6efff;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 0;
  margin-left: 5px;
  text-align: left;
}

/* USER messages / selectable questions — right */
.chat-bubble.user {
  background: #1c4980;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 0;
  margin-right: 5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.08s;
  text-align: right;
}

.chat-bubble.user:hover {
  background: #163764;
  transform: scale(1.02);
}

/* Typing indicator (bot side, left) */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #1c4980;
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ---------------------------
   Keyframes (single definitions)
   --------------------------- */
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Optional: question list wrapper to force right alignment */
.question-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
