/* Chat Bot Styles */
.chat-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: 'Montserrat', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Robot Icon & Animation */
.chat-toggle-btn svg {
  display: none;
  /* Hide default icon if we use custom robot HTML inside */
}

.chat-toggle-btn .robot-icon {
  display: block;
  /* Ensure the icon is visible */
  width: 40px;
  height: 40px;
  animation: robotFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: all 0.3s ease;
}

.eye-bg {
  animation: robotBlink 4s infinite;
  transform-origin: center;
}

.eye-pupil {
  animation: robotScan 5s infinite;
}

@keyframes robotFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes robotBlink {

  0%,
  48%,
  52%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(0.1);
  }
}

@keyframes robotScan {

  0%,
  15% {
    transform: translate(0, 0);
  }

  20%,
  35% {
    transform: translate(-1px, 0);
  }

  40%,
  55% {
    transform: translate(1px, 0);
  }

  60%,
  75% {
    transform: translate(0, 1px);
  }

  80%,
  100% {
    transform: translate(0, 0);
  }
}

.chat-toggle-btn:hover .robot-icon {
  animation-play-state: paused;
  transform: scale(1.1) rotate(5deg);
}

.chat-toggle-btn:hover .eye-bg,
.chat-toggle-btn:hover .eye-pupil {
  animation-play-state: paused;
}

/* Typing Indicator - Row by Row */
.typing-line-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: white;
  border-radius: 15px;
  border-bottom-left-radius: 5px;
  width: fit-content;
  margin-bottom: 10px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-line {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  animation: typingLine 1.5s infinite ease-in-out;
  opacity: 0.6;
}

.typing-line:nth-child(1) {
  width: 50px;
  animation-delay: 0s;
}

.typing-line:nth-child(2) {
  width: 80px;
  animation-delay: 0.2s;
}

.typing-line:nth-child(3) {
  width: 60px;
  animation-delay: 0.4s;
}

@keyframes typingLine {

  0%,
  100% {
    opacity: 0.3;
    transform: scaleX(0.95);
  }

  50% {
    opacity: 0.8;
    transform: scaleX(1);
  }
}


.chat-toggle-btn.active svg {
  transform: rotate(90deg);
  opacity: 0;
}

.chat-close-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 55px;
  color: white;
  opacity: 0;
  transition: all 0.3s ease;
}

.chat-toggle-btn.active .chat-close-icon {
  transform: translate(-50%, -50%) rotate(0);
  opacity: 1;
}

.chat-window {
  width: 350px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
  display: none;
  flex-direction: column;
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  display: flex;
}

.chat-header {
  background: linear-gradient(135deg, #25D366, #128C7E);
  padding: 15px 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 15px;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.bot-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #00e676;
  border: 2px solid white;
  border-radius: 50%;
}

.bot-info h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.bot-info span {
  font-size: 12px;
  opacity: 0.9;
}

.chat-body {
  height: 350px;
  padding: 20px;
  background: #f0f2f5;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overscroll-behavior: contain;
  /* Prevents scroll chaining to body */
}

.message {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  animation: messageSlideIn 0.3s ease forwards;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.bot {
  background: white;
  color: #333;
  border-bottom-left-radius: 5px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user {
  background: #dcf8c6;
  color: #333;
  border-bottom-right-radius: 5px;
  align-self: flex-end;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.option-btn {
  background: white;
  border: 1px solid #25D366;
  color: #25D366;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  align-self: flex-start;
  animation: fadeIn 0.5s ease forwards;
}

.option-btn:hover {
  background: #25D366;
  color: white;
}

.chat-footer {
  padding: 10px;
  background: white;
  border-top: 1px solid #eee;
  display: none;
  /* Hidden by default */
}

.chat-footer.visible {
  display: block;
}

.chat-input-group {
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  border: none;
  background: #f0f2f5;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

.send-btn {
  background: none;
  border: none;
  color: #25D366;
  cursor: pointer;
  padding: 5px;
}

/* Writing Animation */
.writing-avatar-icon {
  animation: writingAnimation 1s infinite alternate;
}

@keyframes writingAnimation {
  0% {
    transform: rotate(0deg) translate(0, 0);
  }

  25% {
    transform: rotate(-5deg) translate(-1px, 1px);
  }

  50% {
    transform: rotate(0deg) translate(0, 0);
  }

  75% {
    transform: rotate(5deg) translate(1px, -1px);
  }

  100% {
    transform: rotate(0deg) translate(0, 0);
  }
}

/* Header Close Button */
.header-close-btn {
  margin-left: auto;
  /* Pushes to the right */
  cursor: pointer;
  font-size: 40px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.header-close-btn:hover {
  opacity: 1;
}

/* Option Row for Side-by-Side Buttons */
.option-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.option-row .option-btn {
  flex: 1;
  /* Distribute space equally */
  text-align: center;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] .chat-window {
  background: #2c3035;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .chat-body {
  background: #212529;
}

[data-bs-theme="dark"] .message.bot {
  background: #373b3e;
  color: #e9ecef;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .message.user {
  background: #056162;
  color: #e9ecef;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .chat-footer {
  background: #2c3035;
  border-top-color: #373b3e;
}

[data-bs-theme="dark"] .chat-input {
  background: #212529;
  color: #e9ecef;
}

[data-bs-theme="dark"] .typing-line-container {
  background: #373b3e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .typing-line {
  background: #6c757d;
}

[data-bs-theme="dark"] .option-btn {
  background: #2c3035;
  border-color: #25D366;
  color: #25D366;
}

[data-bs-theme="dark"] .option-btn:hover {
  background: #25D366;
  color: white;
}
