#nfd-ai-btn-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  transition: opacity 0.18s;
}
.nfd-ai-btn {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 30px;
  padding: 10px 16px;
  cursor: pointer;
  gap: 10px;
}
.nfd-ai-btn:hover {
  box-shadow: 0 2px 10px #aaa4;
}
.nfd-ai-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.nfd-ai-icon img {
    width: 40px;
    height: 40px;
}

.nfd-ai-text {
  font-size: 18px;
  font-weight: 500;
  margin-right: 6px;
}
.nfd-ai-arrow.material-icons {
  font-size: 24px;
  color: #0CA5FF;
  margin-left: 4px;
  border-radius: 50%;
  background: #ebf8ff;
  padding: 4px;
}
.nfd-ai-arrow.material-icons:hover {
  background: #0CA5FF;
  color: white;
}

/* Chatbox panel */
#nfd-ai-chatbox {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 360px;
  max-width: 90vw;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 32px #161c3322, 0 1.5px 3.5px #46c6f21a;
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.18s;
}
#nfd-ai-chatbox.open {
  display: flex;
  animation: chatbox-fade-in 0.23s cubic-bezier(0.68, -0.12, 0.47, 1.28);
}
@keyframes chatbox-fade-in {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.chatbox-header {
  background: #F0FAFF;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px 14px 0 0;
  border-bottom: 0.2px solid #36BCFF;
  font-weight: 500;
  gap: 8px;
}
.chatbox-close.material-icons {
  margin-left: auto;
  color: #717182;
  font-size: 22px;
  cursor: pointer;
  background: none;
  border: none;

  &:hover {
    color: #0CA5FF;
  }
}

/* Body with messages */
.chatbox-body {
  padding: 16px 16px 8px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 500px;
  max-height: 550px;
  overflow-y: auto;
}
.bot-msg {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  width: fit-content;
  max-width: 95%;
  margin-bottom: 4px;
  white-space: pre-wrap; /* spaces and new lines preserved */
  word-wrap: break-word;
}
.user-msg {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  min-height: 38px;
  border-radius: 12px;
  align-self: flex-end;
  padding: 9px 15px;
  color: #222222;
  font-size: 15px;
  margin-bottom: 3px;
  max-width: 95%;
}

/* Footer */
.chatbox-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #E5E7EB;
  padding: 9px 12px;
}
.chatbox-footer input {
  flex: 1;
  border: none;
  border-radius: 18px;
  border: 1px solid #E5E7EB;
  padding: 7.5px 15px;
  font-size: 15px;
  outline: none;
}
.chatbox-send {
  background: #0CA5FF;
  color: #222222;
  border-radius: 25%;
  padding: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.14s, opacity 0.18s;
  opacity: 1;
}
.chatbox-send:hover {
  background: #0CA5FF;
}
.chatbox-footnote {
  font-size: 12px;
  color: #62748E;
  text-align: center;
  padding-bottom: 6px;
  margin-top: -6px;
}
.chatbox-send.disabled {
  opacity: 0.35;
  background: #BABABA;
  cursor: not-allowed;
  pointer-events: none;
}
.chatbox-send:not(.disabled):hover {
  background: #0CA5FF;
}

.bot-msg-container {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.bot-msg-icon img {
  width: 30px;
  height: 30px;
  margin-top: 6px;
}

.bot-msg {
  background: #F0FAFF;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  max-width: 85%;
  word-break: break-word;
}


/* mobile device css */
@media (max-width: 768px) {
  #nfd-ai-chatbox.open {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100dvh; !important;
    border-radius: 0 !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column;
    background: #fff;
    z-index: 9999;
  }

   .chatbox-body {
    flex: 1;
    overflow-y: auto;
    height: 100%;
  }

  html, body {
    overscroll-behavior: none; /* prevent subtle scroll bounce */
  }
}

.chatbox-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 70px 0;
}
.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #0CA5FF;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}
.loading-msg {
  margin-top: 12px;
  font-size: 15px;
  color: #0CA5FF;
  text-align: center;
}