@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* Floating Button */
.chatbot__button {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 56px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #EE6B69;
  color: #fff;
  border: none;
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.chatbot__button:hover,.chatbot__button:focus {
  background: #f57876;
  transform: scale(1.05);
}

.chatbot__button span:not(.chatbot__notification-badge) {
  position: absolute;
  font-size: 28px;
  transition: opacity 0.2s ease;
}

.show-chatbot .chatbot__button span:first-child:not(.chatbot__notification-badge),
.chatbot__button span:last-child:not(.chatbot__notification-badge) {
  opacity: 0;
}
.show-chatbot .chatbot__button span:last-child:not(.chatbot__notification-badge) {
  opacity: 1;
}

/* Notification Badge */
.chatbot__notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: #ff4444;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 2px solid #fff;
  animation: badge-pulse 2s infinite;
  z-index: 1001;
}

/* Badge pulse animation */
@keyframes badge-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }
}

/* Chatbot Window */
.chatbot {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 380px;
  max-height: 450px;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  overflow: hidden;
  z-index: 999;
}

.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot__header {
  position: relative;
  background: #EE6B69;
  color: #fff;
  padding: 14px 16px;
  /*display: flex;*/
  /*align-items: center;*/
  /*justify-content: space-between;*/
}

.chatbox__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.chatbot__header span {
  font-size: 22px;
  cursor: pointer;
}

/* Messages Box */
.chatbot__box {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: #f9fafb;
}

.chatbot__box::-webkit-scrollbar {
  width: 6px;
}
.chatbot__box::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
}

/* Chat Messages */
.chatbot__chat {
  display: flex;
  margin-bottom: 14px;
  align-items: flex-end;
}

.chatbot__chat p {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 75%;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chatbot__chat.incoming p {
  background: #e5e7eb;
  color: #111827;
  border-radius: 12px 12px 12px 0;
}

.chatbot__chat.incoming span {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 20px;
  color: #fff;
  background: #062649;
  border-radius: 6px;
}

.chatbot__chat.outgoing {
  justify-content: flex-end;
}

.chatbot__chat.outgoing p {
  background: #062649;
  color: #fff;
  border-radius: 12px 12px 0 12px;
}

/* Error Messages */
.chatbot__chat p.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Input Area */
.chatbot__input-box {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.chatbot__textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  font-size: 0.95rem;
  border: none;
  outline: none;
  resize: none;
  padding: 8px;
  font-family: 'Poppins', sans-serif;
}

.chatbot__input-box span {
  margin-left: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #062649;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  visibility: hidden;
  transition: all 0.3s ease;
}

.chatbot__input-box span:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.chatbot__input-box span i {
  font-size: 16px;
}

.chatbot__textarea:valid ~ span {
  visibility: visible;
}

/* Bot Icon Styling */
.bot-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 18px;
  color: #fff;
  background: #2563eb;
  border-radius: 6px;
}

.chatbot__button i {
  position: absolute;
  font-size: 22px;
  transition: opacity 0.25s ease;
}

.chatbot__button .close-icon {
  opacity: 0;
}

.show-chatbot .chatbot__button .open-icon {
  opacity: 0;
}

.show-chatbot .chatbot__button .close-icon {
  opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chatbot {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .chatbot__box {
    padding: 16px;
  }

  .chatbot__header span {
    display: inline;
  }

  /* Adjust notification badge for mobile */
  .chatbot__notification-badge {
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  /* Hide floating button when chatbot is open on mobile */
  .show-chatbot .chatbot__button {
    display: none;
  }

  /* Add close button in header for mobile */
  .show-chatbot .chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .show-chatbot .chatbot__header::after {
    content: "✕";
    font-size: 20px;
    cursor: pointer;
    color: #fff;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
  }

  .show-chatbot .chatbot__header::after:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}