@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes wave {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

#chat-toggle {
  position: fixed;
  bottom: 25px;
  left: 25px;
  width: 48px;
  height: 48px;
  background: rgba(29, 146, 217, 7.2);
  background: linear-gradient(135deg,rgba(29, 146, 217, 1) 0%, rgba(71, 63, 197, 1) 71%);
  color: #f8f9fa;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease,
  box-shadow 0.3s ease;
}
#chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.2);
}
#chat-toggle:active {
  transform: scale(1.1);
}
  /* status icon */
  #chat-toggle::before{
    content: "";
    position: absolute;
    top: 4px;
    right: 0;
    width: 12px;
    height: 12px;
    background: #37F713;
    border: none;
    border-radius: 50%;
    box-shadow: 0 0 4px #DCED11, 0 0 8px #37F713;
    animation:  ease 1s infinite incoming-message;
  }
    /* incoming message animation */
    @keyframes incoming-message {
      0%{
        transform: scale(1);
        box-shadow: 0 0 4px #DCED11, 0 0 8px #37F713;
      }
      50%{
        transform: scale(.95);
        box-shadow: 0 0 2px #DCED11, 0 0 4px #37F713;
      }
      100%{
        transform: scale(1);
        box-shadow: 0 0 4px #DCED11, 0 0 8px #37F713;
      }
    }

#chat-toggle i {
  position: absolute;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease;
}
#chat-toggle .fa-times {
  transform: rotate(90deg) scale(0.5);
  opacity: 0;
}
#chat-toggle.active .fa-comment-dots {
  transform: rotate(-90deg) scale(0.5);
  opacity: 0;
}
#chat-toggle.active .fa-times {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

#chat-widget {
  position: fixed;
  bottom: 100px;
  left: 5vw;
  right: 5vw;
  width: auto;
  max-width: 350px;
  height: 450px;
  max-height: 70vh;
  margin: 0 auto;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: solid 1px rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15),
    0 5px 10px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transform: translateY(15px) scale(0.98);
  transform-origin: bottom center;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (min-width: 450px) {
  #chat-widget {
    left: 25px;
    right: auto; 
    width: 350px;
    margin: 0; 
    transform-origin: bottom left; 
  }
}

#chat-widget.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.chat-header {
  background: linear-gradient(135deg,rgba(29, 146, 217, 1) 0%, rgba(71, 63, 197, 1) 71%);
  color: #f8f9fa;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
  /* bot icon */
  .chat-header .chatbotImage{
    width: 32px;
  }

.chat-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  flex-grow: 1;
}
#chat-close-btn {
  background: none;
  border: none;
  color: #f8f9fa;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
#chat-close-btn:hover {
  opacity: 1;
}

.chat-messages {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: #f7f8fa;
  scrollbar-width: thin;
  scrollbar-color: rgba(72, 63, 197, 0.6) #f7f8fa;
}
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background-color: #bbb;
  border-radius: 10px;
  border: 2px solid #f7f8fa;
}

.message {
  display: flex;
  align-items: flex-end;
  max-width: 90%;
  animation: fadeInUp 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}
.user-message {
  align-self: flex-end;
}
.bot-message {
  align-self: flex-start;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
  border: solid 1px rgba(0, 0, 0, 0.1);
}

.message-content {
  padding: 0.6rem 1rem;
  border-radius: 12px;
  line-height: 1.4;
  word-wrap: break-word;
  color: var(--text-dark);
}
.message-content p {
  margin: 0;
  font-size: 0.95rem;
}

.bot-message .message-content {
  background-color: rgba(255, 255, 255, 0.2);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.user-message .message-content {
  background: linear-gradient(135deg,rgba(29, 146, 217, 0.85) 0%, rgba(71, 63, 197, 0.85) 71%);
  color:  #f8f9fa;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator .dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0 2px;
  animation: wave 1.2s infinite ease-in-out;
}
.typing-indicator .dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-indicator .dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.quick-replies {
  align-self: flex-start;
  padding-left: 42px;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qr-button {
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.qr-button:hover {
  background: var(--primary-color);
  color:  #f8f9fa;
}

.chat-footer {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-top: 1px solid rgb(0, 0, 0, .1);
  background-color: #f8f9fa;
  flex-shrink: 0;
}
#chat-input {
  flex-grow: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: transparent;
  border-radius: 4px;
  padding: 0.6rem .8rem;
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.2s ease;
  min-width: 0;
}
#chat-input:focus {
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
}
#chat-send-btn {
  background: var(--aurora);
  color: #f8f8f8;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  margin-left: 0.75rem;
  transition: background 0.2s ease,
    transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
  flex-shrink: 0;
}
#chat-send-btn:hover {
  background: linear-gradient(135deg,rgba(29, 146, 217, 1) 0%, rgba(71, 63, 197, 1) 71%);
  transform: scale(1.05);
}
#chat-send-btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}
/* cursor blinking*/
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: rgba(0, 0, 0, 0.1); }
}

.message-content p.typing-cursor::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 4px;
  border-right: 2px solid var(--primary-color);
  animation: blink-caret 1s step-end infinite;
  vertical-align: bottom;
}

.chat-footer.disabled {
  opacity: 0.6;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

#typing-indicator .message-content {
  background-color: transparent;
  padding: 0.6rem 0;
  color: #6d7588; 
  font-weight: 600;
  font-size: 1.2rem;
}

@keyframes typing-dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
  100% { content: '.'; }
}

#typing-indicator .message-content::after {
  content: '.';
  animation: typing-dots 1.5s infinite;
}

.message-content strong {
  font-weight: 600; 
}

.message-content ol,
.message-content ul {
  padding-left: 20px; 
  margin-top: 5px;
  margin-bottom: 5px;
}

.message-content li {
  margin-bottom: 4px; 
}