/* ==================== CLEANED & OPTIMIZED CSS ==================== */

/* Floating Action Button (FAB) */
#chatbot-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.chat-fab-btn {
  width: 60px;
  height: 60px;
  border: none;
  background: linear-gradient(135deg, #008080, #20c997);
  color: white;
  font-size: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Chat Container - Slide-up Animation */
.chat-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  border: 1px solid #e0e6ef;
  font-family: 'Segoe UI', sans-serif;
  animation: slideUp 0.4s ease-out;
  display: none; /* Hidden by default */
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #008080, #20c997);
  color: white;
  padding: 1rem;
  text-align: center;
  border-radius: 18px 18px 0 0;
}

.chat-title {
  font-weight: bold;
  font-size: 1.1rem;
}

.chat-status {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Chatbox */
.chat-box {
  height: 300px;
  overflow-y: auto;
  padding: 1rem;
  background: #f8f9ff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

/* Messages */
.message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 16px;
  margin-bottom: 6px;
  animation: fadeIn 0.3s ease-out;
}

.user-msg {
  align-self: flex-end;
  background: #6a11cb;
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-msg {
  align-self: flex-start;
  background: #e0e6ef;
  color: #2c3e50;
  border-bottom-left-radius: 4px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typing Indicator */
.typing-indicator {
  align-self: flex-start;
  background: #e0e6ef;
  padding: 10px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #777;
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input Area */
.chat-input-area {
  display: flex;
  padding: 0.8rem;
  background: white;
  border-top: 1px solid #eee;
}

#userInput {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 24px;
  outline: none;
  font-size: 0.95rem;
}

#userInput:focus {
  border-color: #6a11cb;
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

.send-btn {
  width: 45px;
  height: 45px;
  border: none;
  background: #6a11cb;
  color: white;
  border-radius: 50%;
  margin-left: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover {
  background: #5b0ecb;
}

/* =============== ANIMATED BUJANG CHARACTER =============== */

.bujang-character {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 100px;
  text-align: center;
}

.char-bubble {
  background: #000;
  color: white;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 10px;
  margin-top: 6px;
  max-width: 120px;
  position: relative;
  opacity: 0;
  transition: opacity 0.3s;
}

.char-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #000;
}

/* Idle breathing effect */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Blinking eyes (if using SVG with eye classes) */
.bujang-eye-left, .bujang-eye-right {
  animation: blink 4s infinite;
}

@keyframes blink {
  0%, 98% { opacity: 1; }
  99% { opacity: 0; }
}

/* Speech reaction */
@keyframes bounceReact {
  0% { transform: translateY(0) scale(1); }
  10% { transform: translateY(-8px) scale(1.05); }
  20% { transform: translateY(0) scale(1); }
}

/* Show bubble when active */
.bujang-character.active .char-bubble {
  opacity: 1;
}

/* Make avatar react when speaking */
.bujang-character.speaking .char-img {
  animation: bounceReact 0.5s ease-in-out;
}

/* Responsive */
@media (max-width: 500px) {
  .chat-container {
    width: 320px;
    bottom: 70px;
    right: 10px;
  }
  .bujang-character {
    width: 80px;
    bottom: 8px;
    right: 8px;
  }
  .char-img {
    width: 80%;
  }
}