/* CHAT BUTTON */
.chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #007bff;
  color: #fff;
  border-radius: 50%;
  padding: 16px;
  font-size: 48px;
  cursor: pointer;
  box-shadow: 0 4px 12px #0000004d;
  transition: background-color 0.3s ease, transform 0.3s ease;
  z-index: 9999;
}
.chat-button:hover {
  background-color: #0056b3;
  transform: scale(1.1);
}

/* THINKING ANIMATION */
@keyframes thinking {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}
.thinking-bubble {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #3498db;
  margin: 10px 0;
  animation: thinking 1.5s infinite;
  display: inline-block;
}

/* CHAT WINDOW */
.chat-window {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background-color: #fff;
  width: 350px;
  max-height: 450px;
  box-shadow: 0 4px 15px #0003;
  border-radius: 12px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  transform: scale(0);
  transition: transform 0.3s ease-in-out, display 0s ease 0.3s;
}
.chat-window.show {
  display: flex;
  transform: scale(1);
}

/* CHAT RESPONSE AREA */
#chat-response {
  padding: 15px;
  overflow-y: auto;
  max-height: 300px;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid #f1f1f1;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* CHAT MESSAGES */
.chat-message {
  display: flex;
  margin-bottom: 10px;
}
.chat-message.user {
  justify-content: flex-end;
}
.chat-message.ai {
  justify-content: flex-start;
}

/* MESSAGE BUBBLE */
.chat-message .message-bubble {
  padding: 0 12px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14px;
  position: relative;
  box-shadow: 0 2px 8px #0000001a;
  word-wrap: break-word;
  text-align: left;
}
.chat-message.user .message-bubble {
  background-color: #007bff;
  color: #fff;
}
.chat-message.ai .message-bubble {
  background-color: #e0e0e0;
  color: #333;
}

/* TYPEWRITER EFFECT FOR AI MESSAGES */
.chat-message.ai .message-bubble.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid #333;
  width: 0;
  animation: typing 2s steps(30, end) forwards;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

/* CHAT FORM */
#chat-form {
  display: flex;
  flex-direction: column;
  padding: 15px;
  background-color: #fff;
  border-top: 1px solid #f1f1f1;
}
#chat-form input {
  padding: 10px;
  font-size: 14px;
  border-radius: 20px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
  outline: none;
  transition: border 0.3s ease;
}
#chat-form input:focus {
  border-color: #007bff;
}
#chat-form button {
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
#chat-form button:hover {
  background-color: #0056b3;
}

/* WINDOW FADE-IN */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.chat-window {
  animation: fadeIn 0.3s ease-in-out;
}
