/* css/chatbot.min.css */

/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
}

/* Chatbot Container */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 370px;
  height: 90vh;
  display: none; /* Hidden by default */
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  overflow: hidden;
  background-color: #fff;

  /* Animation for opening */
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Visible State */
.chatbot-container.show {
  display: block;
  opacity: 1;
  transform: scale(1);
}

/* Hidden State with Animation */
.chatbot-container.hide {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Wrapper for Flex Layout */
.wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Title Bar */
.wrapper .title {
  background: #007bff;
  color: white;
  line-height: 2.5;
  font-size: 20px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

/* Title Icon */
.title-icon {
  width: 40px;
  height: 40px;
  margin-right: 10px;
  border-radius: 50%;
  object-fit: cover;
}

/* Title Text */
.title-text {
  /* Align text to the left */
  text-align: left;
  font-weight: bold;
  flex-grow: 1;
}

/* Close Button */
.wrapper .title #close-chatbot {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}

.wrapper .title #close-chatbot svg {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.wrapper .title #close-chatbot svg:hover {
  color: #ff0000;
  transform: rotate(90deg);
}

/* Chat Messages Box */
.wrapper .box {
  border: 1px solid #efefef;
  padding: 10px 15px;
  flex: 1;
  overflow-y: auto;
  background-color: #f9f9f9;
  position: relative;
}

.wrapper .box .item {
  display: flex;
  margin: 10px 0;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chatbot Message Styling */
.wrapper .box .item.left {
  justify-content: flex-start;
}

.wrapper .box .item.left .icon {
  background: #007bff;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
}

.wrapper .box .item.left .msg {
  background: #007bff;
  color: white;
  border-radius: 10px;
  max-width: 60%;
  padding: 10px;
  word-wrap: break-word;
}

/* Ensure <p> inherits color */
.wrapper .box .item.left .msg p {
  color: inherit;
}

/* User Message Styling */
.wrapper .box .item.right {
  justify-content: flex-end;
}

.wrapper .box .item.right .msg {
  background: #efefef;
  color: #333;
  border-radius: 10px;
  max-width: 60%;
  padding: 10px;
  word-wrap: break-word;
}

/* Remove icon for user messages */
.wrapper .box .item.right .icon {
  display: none;
}

/* Typing Area */
.wrapper .typing-area {
  width: 100%;
  background: #efefef;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 10px;
  flex-shrink: 0;
}

.wrapper .typing-area .input-field {
  width: 100%;
  position: relative;
}

.wrapper .typing-area .input-field input {
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: none;
  padding-right: 70px;
  font-family: "Poppins", sans-serif;
  transition: 0.3s all ease;
}

.wrapper .typing-area .input-field input:focus {
  border-color: #007bff;
}

.wrapper .typing-area .input-field button {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid #007bff;
  padding: 5px 10px;
  border-radius: 3px;
  color: #007bff;
  outline: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s all ease;
}

.wrapper .typing-area .input-field button:hover {
  background: #007bff;
  color: white;
}

.wrapper .typing-area .input-field input:valid ~ button {
  opacity: 1;
  pointer-events: auto;
}

/* Chat Widget Icon */
#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #007bff;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease, transform 0.3s ease;

  /* Add refined bounce animation */
  animation: bounce 2s infinite;
}

/* Refined Bounce Animation Keyframes */
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Remove default margin/padding from SVGs */
#chat-widget svg,
.wrapper .box .item.left .icon svg {
  margin: 0;
  padding: 0;
}

#chat-widget svg {
  width: 30px;
  height: 30px;
}

#chat-widget:hover {
  background-color: #0056b3;
}

/* Loader Styling */
.loader {
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  position: absolute;
  bottom: 60px; /* Position above the typing area */
  left: 50%;
  transform: translateX(-50%);
}

.loader.show {
  display: flex;
}

.loader .dot {
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background-color: #007bff;
  border-radius: 50%;
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.loader .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loader .dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounceDot {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Badge for Unread Messages */
#chat-widget .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: red;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  display: none;
}

/* Hidden State for Chat Widget Icon */
#chat-widget.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;

  /* Stop bounce animation when hidden */
  animation: none;
}

/* Welcome Message Styling */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 20px 0;
}

.welcome-icon {
  width: 60px; /* Adjust as needed */
  height: 60px; /* Adjust as needed */
  margin-bottom: 10px;
  border-radius: 50%;
  object-fit: cover;
}

.welcome-message h2 {
  font-size: 18px;
  margin-bottom: 5px;
}

.welcome-message p {
  font-size: 14px;
  color: #555;
}

/* Responsive Design */
@media (max-width: 600px) {
  .chatbot-container {
    width: 90%;
    height: 70vh;
    right: 5%;
    bottom: 10px;
  }

  #chat-widget {
    width: 50px;
    height: 50px;
    animation: bounce 2s infinite; /* Adjust animation if needed */
  }

  #chat-widget svg {
    width: 25px;
    height: 25px;
  }

  .title-icon {
    width: 30px;
    height: 30px;
  }

  .welcome-icon {
    width: 50px;
    height: 50px;
  }

  .welcome-message h2 {
    font-size: 16px;
  }

  .welcome-message p {
    font-size: 12px;
  }

  .wrapper .title {
    font-size: 18px;
  }

  .wrapper .typing-area .input-field button {
    padding: 5px 8px;
  }
}
