#float-ai-chatbot-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #003366;
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  cursor: pointer;
  z-index: 10000;
}

#ai-chatbot-box {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 33%;
  max-height: 90vh;
  background: #fff;
  border: 1px solid #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Fullscreen mode for chatbox */
#ai-chatbot-box.fullscreen-mode {
  top: 10vh;
  left: 10vw;
  right: 10vw;
  bottom: 10vh;
  width: 80vw !important;
  height: 80vh !important;
  max-width: none;
  max-height: none;
  border-radius: 16px;
  z-index: 10001;
  position: fixed;
  display: flex;
  flex-direction: column;
}

/* Responsive: Fullscreen on small screens */
@media (max-width: 768px) {
  #ai-chatbot-box.fullscreen-mode {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
  }
}

/* Responsive styles */
@media (max-width: 1024px) {
  #ai-chatbot-box {
    width: 50%;
    right: 12px;
    bottom: 70px;
    max-height: 85vh;
  }
}

@media (max-width: 768px) {
  #ai-chatbot-box {
    width: 90vw;
    right: 5vw;
    left: 5vw;
    bottom: 0;
    max-height: 80vh;
    border-radius: 12px 12px 0 0;
  }

  #float-ai-chatbot-button {
    right: 5vw;
    bottom: 16px;
  }
}

@media (max-width: 480px) {
  #ai-chatbot-box {
    width: 100vw;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 75vh;
    border-radius: 0;
  }

  #ai-chatbot-header {
    font-size: 1em;
    padding: 10px 10px;
  }

  #ai-chatbot-footer {
    padding: 6px 6px;
  }

  #ai-chatbot-messages {
    padding: 8px 4px;
  }

  #ai-chatbot-input {
    font-size: 0.98em;
    min-height: 36px;
    max-height: 60px;
    padding: 6px 8px;
  }

  #ai-chatbot-send {
    min-width: 36px;
    height: 36px;
    font-size: 1em;
    padding: 0 8px;
  }

  #ai-chatbot-char-counter {
    font-size: 0.88em;
  }
}

#ai-chatbot-header {
  background: #003366;
  color: #fff;
  padding: 12px 16px;
  font-size: 1.1em;
  font-weight: bold;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#ai-chatbot-header span {
  flex: 1;
}

#ai-chatbot-disclaimer {
  background: transparent;
  font-size: 0.9em;
  cursor: pointer;
  margin-left: 12px;
  line-height: 1;

  color: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.12);
  padding: 8px 8px;
  border-radius: 6px;
  font-weight: 600;
}

#ai-chatbot-disclaimer:hover {
  background: rgba(255, 255, 255, 0.06);
}


#ai-chatbot-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.3em;
  cursor: pointer;
  margin-left: 12px;
  padding: 0 4px;
  line-height: 1;
}

#ai-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

#ai-chatbot-footer {
  border-top: 1px solid #eee;
  padding: 8px 12px;
  background: #f4f7fa;
  display: flex;
  align-items: flex-end;
  position: relative;
}

#ai-chatbot-input-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0;
}

#ai-chatbot-input-row-inner {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

#ai-chatbot-input {
  flex: 1 1 auto;
  padding: 8px 12px;
  border: 1px solid #b3c2d1;
  border-radius: 4px;
  resize: none;
  font-size: 1em;
  min-height: 40px;
  max-height: 80px;
  box-sizing: border-box;
}

#ai-chatbot-send {
  flex: 0 0 auto;
  margin-left: 0;
  padding: 0 12px;
  background: #003366;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 40px;
}

#ai-chatbot-send .plane-icon,
#ai-chatbot-send .stop-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

#ai-chatbot-char-counter {
  margin-top: 2px;
  margin-left: 2px;
  font-size: 0.92em;
  color: #5a6b7d;
  user-select: none;
  align-self: flex-start;
  white-space: nowrap;
  position: static;
}

.ai-chatbot-msg.user {
  text-align: right;
  color: #003366;
  margin-bottom: 6px;
  /* lighter, less saturated blue */
  background: #f4f8fb;
  border-radius: 18px 18px 4px 18px;
  display: block;
  padding: 10px 16px;
  max-width: 80%;
  word-break: break-word;
}

.ai-chatbot-msg.ai {
  text-align: left;
  color: #fff;
  margin-bottom: 6px;
  /* bluer, more saturated background */
  background: #2361a9;
  border-radius: 18px 18px 18px 4px;
  display: block;
  padding: 10px 16px;
  max-width: 80%;
  word-break: break-word;
}

.ai-chatbot-msg.system-info {
  text-align: center;
  color: #555;
  margin-bottom: 6px;
  background: #e3eaf2;
  border-radius: 12px;
  display: block;
  padding: 8px 14px;
  max-width: 80%;
  word-break: break-word;
}

.ai-chatbot-msg.system-error {
  text-align: center;
  color: #a94442;
  margin-bottom: 6px;
  background: #ffeaea;
  border-radius: 12px;
  display: block;
  padding: 8px 14px;
  max-width: 80%;
  word-break: break-word;
}

.ai-chatbot-msg.ai h1,
.ai-chatbot-msg.ai h2,
.ai-chatbot-msg.ai h3,
.ai-chatbot-msg.ai h4,
.ai-chatbot-msg.ai h5 {
  font-size: 1.15rem;
  margin: 0.5em 0;
  line-height: 1.1;
  color: white;
}

.ai-chatbot-msg.ai h1 {
  font-size: 1.75rem;
}

.ai-chatbot-msg.ai h2 {
  font-size: 1.25rem;
}

.ai-chatbot-msg a {
  color: inherit;
  text-decoration: underline;
}

.ai-chatbot-msg a:hover {
  color: #d5ebff;
}

.ai-chatbot-msg-outer {
  display: flex;
}

.ai-chatbot-msg-outer.user {
  justify-content: flex-end;
}

/* Loading indicator (three dots blinking) */
.ai-chatbot-loading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 24px;
  padding: 0 8px;
  gap: 4px;
}

.ai-chatbot-loading .dot {
  width: 8px;
  height: 8px;
  margin: 0 2px;
  border-radius: 50%;
  background: #eaf2fb; /* lighter color for contrast on blue bubble */
  opacity: 0.8;
  animation: ai-chatbot-blink 1.2s infinite both;
  display: inline-block;
}

.ai-chatbot-loading .dot1 {
  animation-delay: 0s;
}

.ai-chatbot-loading .dot2 {
  animation-delay: 0.2s;
}

.ai-chatbot-loading .dot3 {
  animation-delay: 0.4s;
}

@keyframes ai-chatbot-blink {
  0%, 80%, 100% {
    opacity: 0.6;
  }
  40% {
    opacity: 1;
  }
}

.ai-chatbot-disclaimer {
  text-align: left;
  font-size: 0.9em;
}

.ai-chatbot-disclaimer h2 {
  font-size: 1.2em;
  margin-block: 0;
}
