@import url("https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap");

/* --- GLOBAL TOGGLER STYLES --- */
#chatbot-toggler {
  position: fixed !important;
  bottom: 60px !important;
  right: 35px !important;
  height: 56px !important;
  width: 56px !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #527ff4 0%, #3f68c7 100%) !important;
  transition: all 0.3s ease !important;
  z-index: 99999 !important;
  box-shadow: 0 4px 16px rgba(82, 127, 244, 0.4) !important;
}

button#chatbot-toggler:hover {
  background: linear-gradient(135deg, #3f68c7 0%, #2f58b7 100%) !important;
  transform: scale(1.08) !important;
  box-shadow: 0 6px 20px rgba(82, 127, 244, 0.5) !important;
}

body.show-chatbot button#chatbot-toggler {
  transform: rotate(90deg) !important;
}

button#chatbot-toggler span {
  color: #fff !important;
  position: absolute !important;
  font-size: 24px !important;
  transition: opacity 0.2s ease !important;
}

body.show-chatbot button#chatbot-toggler span:first-child,
button#chatbot-toggler span:last-child {
  opacity: 0 !important;
}

body.show-chatbot button#chatbot-toggler span:last-child {
  opacity: 1 !important;
}

/* --- CHATBOT POPUP BASE (DESKTOP DEFAULT) --- */
div.chatbot-popup {
  position: fixed !important;
  right: 25px !important;
  bottom: 90px !important;
  width: 420px !important;
  height: 600px !important;
  background: #fff !important;
  overflow: hidden !important;
  border-radius: 16px !important;
  opacity: 0 !important;
  transform: scale(0.5) !important;
  transform-origin: bottom right !important;
  pointer-events: none !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(82, 127, 244, 0.1) !important;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
  z-index: 99998 !important;
  display: block !important;
}

body.show-chatbot div.chatbot-popup {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: scale(1) !important;
}

/* HEADER */
div.chatbot-popup .chat-header {
  position: relative;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #527ff4 0%, #3f68c7 100%);
  padding: 18px 22px;
  justify-content: space-between;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(82, 127, 244, 0.2);
}

div.chatbot-popup .chat-header .header-info {
  display: flex;
  gap: 10px;
  align-items: center;
}

div.chatbot-popup .header-info .chatbot-logo {
  height: 35px;
  width: 35px;
  padding: 6px;
  fill: #527ff4;
  flex-shrink: 0;
  background: #fff;
  border-radius: 50%;
}

div.chatbot-popup .header-info .logo-text {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

div.chatbot-popup .chat-header #close-chatbot {
  border: none;
  color: #fff;
  height: 40px;
  width: 40px;
  font-size: 1.5rem;
  margin-right: -10px;
  padding-top: 2px;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: 0.2s ease;
}

div.chatbot-popup .chat-header #close-chatbot:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* BODY */
div.chatbot-popup .chat-body {
  padding: 20px;
  display: flex;
  gap: 16px;
  height: 460px;
  margin-bottom: 82px;
  overflow-y: auto;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #d4e0ff transparent;
  background: linear-gradient(to bottom, #fafbff 0%, #f5f7ff 100%);
}

div.chatbot-popup .chat-body::-webkit-scrollbar {
  width: 6px;
}

div.chatbot-popup .chat-body::-webkit-scrollbar-track {
  background: transparent;
}

div.chatbot-popup .chat-body::-webkit-scrollbar-thumb {
  background: #d4e0ff;
  border-radius: 10px;
}

div.chatbot-popup .chat-body .message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

div.chatbot-popup .chat-body .bot-message .bot-avatar {
  height: 35px;
  width: 35px;
  padding: 6px;
  fill: #fff;
  flex-shrink: 0;
  align-self: flex-end;
  background: #527ff4;
  border-radius: 50%;
}

div.chatbot-popup .chat-body .user-message {
  flex-direction: column;
  align-items: flex-end;
}

div.chatbot-popup .chat-body .message .message-text {
  padding: 12px 16px;
  max-width: 75%;
  font-size: 0.95rem;
  word-wrap: break-word;
  line-height: 1.5;
  font-family: "Inter", sans-serif;
}

div.chatbot-popup .chat-body .bot-message .message-text {
  background: linear-gradient(135deg, #f2f6ff 0%, #e8f0ff 100%);
  color: #2a2a2a;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 2px 8px rgba(82, 127, 244, 0.08);
}

div.chatbot-popup .chat-body .user-message .message-text {
  color: #fff;
  background: linear-gradient(135deg, #527ff4 0%, #4070e8 100%);
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 8px rgba(82, 127, 244, 0.25);
}

div.chatbot-popup .chat-body .user-message .attachment {
  max-width: 100%;
  max-height: 300px;
  height: auto;
  border-radius: 8px;
  margin-top: 8px;
}

/* THINKING INDICATOR */
div.chatbot-popup .chat-body .bot-message .thinking-indicator {
  display: flex;
  gap: 4px;
  padding-block: 15px;
}

div.chatbot-popup .chat-body .bot-message .thinking-indicator .dot {
  height: 7px;
  width: 7px;
  opacity: 0.7;
  border-radius: 50%;
  background: #527ff4;
  animation: dotPulse 1.8s ease-in-out infinite;
}

div.chatbot-popup .chat-body .bot-message .thinking-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

div.chatbot-popup .chat-body .bot-message .thinking-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 44% { 
    transform: translateY(0); 
  }
  28% { 
    opacity: 0.4; 
    transform: translateY(-4px); 
  }
  44% { 
    opacity: 0.2; 
  }
}

/* FOOTER */
div.chatbot-popup .chat-footer {
  position: absolute;
  z-index: 1;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 12px 18px 16px;
  border-top: 1px solid #e0e7ff;
}

div.chatbot-popup .chat-footer .chat-form {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 25px;
  outline: 1px solid #d4d9f2;
  transition: 0.2s ease;
}

div.chatbot-popup .chat-footer .chat-form:focus-within {
  outline: 2px solid #527ff4;
}

div.chatbot-popup .chat-form .message-input {
  border: none;
  outline: none;
  height: 40px;
  min-height: 40px;
  max-height: 100px;
  width: 100%;
  resize: none;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: inherit;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

div.chatbot-popup .chat-form .message-input::-webkit-scrollbar {
  width: 4px;
}

div.chatbot-popup .chat-form .message-input::-webkit-scrollbar-thumb {
  background: #d4d9f2;
  border-radius: 10px;
}

div.chatbot-popup .chat-form .chat-controls {
  display: flex;
  height: 40px;
  gap: 3px;
  align-items: center;
  align-self: flex-end;
  padding-right: 6px;
}

div.chatbot-popup .chat-form .chat-controls button {
  height: 32px;
  width: 32px;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #527ff4;
  background: none;
  border-radius: 50%;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

div.chatbot-popup .chat-form .chat-controls #send-message {
  color: #fff;
  display: none;
  background: #527ff4;
}

div.chatbot-popup .chat-form .message-input:valid ~ .chat-controls #send-message {
  display: flex;
}

div.chatbot-popup .chat-form .chat-controls #send-message:hover {
  background: #3f68c7;
}

div.chatbot-popup .chat-form .chat-controls button:hover {
  background: #f2f6ff;
}

/* --- RESPONSIVENESS (TABLET) --- */
@media screen and (min-width: 601px) and (max-width: 1024px) {
  div.chatbot-popup {
    width: min(90vw, 450px) !important;
    height: 70vh !important;
    max-height: 650px !important;
    right: 20px !important;
    bottom: 80px !important;
  }

  div.chatbot-popup .chat-body {
    height: calc(70vh - 145px) !important; 
    max-height: calc(650px - 145px) !important;
  }

  button#chatbot-toggler {
    bottom: 25px !important;
    right: 30px !important;
  }
}

/* --- RESPONSIVENESS (MOBILE) --- */
@media screen and (max-width: 600px) {
  div.chatbot-popup {
    width: 100% !important;
    height: 100% !important;
    right: 0 !important;
    bottom: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    transform: translateY(100%) !important;
    transform-origin: center !important;
  }

  body.show-chatbot div.chatbot-popup {
    transform: translateY(0) !important;
  }

  div.chatbot-popup .chat-header .header-info .logo-text {
    font-size: 1.1rem !important;
  }

  div.chatbot-popup .chat-body {
    height: calc(100vh - 145px) !important; 
    margin-bottom: 0 !important;
    padding-bottom: 20px !important;
  }

  div.chatbot-popup .chat-body .message .message-text {
    max-width: 85% !important;
  }

  div.chatbot-popup .chat-footer {
    padding: 10px 15px 12px !important;
  }
  
  div.chatbot-popup .chat-footer .chat-form {
    border-radius: 25px !important;
  }

  div.chatbot-popup .chat-form .message-input {
    font-size: 16px !important;
  }

  div.chatbot-popup .chat-footer .chat-form .chat-controls button {
    height: 36px !important;
    width: 36px !important;
  }
}



