/* Floating Chat Button */
#chatbot-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background-color: #0d6efd;
  color: white;
  border-radius: 16px;
  padding: 16px 20px;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background-color 0.2s ease;
}
#chatbot-bubble:hover {
  background-color: #0b5ed7;
}
#chatbot-bubble .bubble-icon {
  font-size: 24px;
  align-self: flex-end;
}
#chatbot-bubble .bubble-line-1 {
  font-weight: bold;
  font-size: 16px;
}
#chatbot-bubble .bubble-line-2 {
  font-size: 14px;
}
#chatbot-bubble .bubble-line-3 {
  font-size: 14px;
  font-weight: 500;
}

/* Chat Window */
#chatbot-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 400px;
  max-height: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 10000;
}

#chatbot-header {
  background: #0d6efd;
  color: white;
  padding: 12px 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chatbot-body {
  padding: 12px;
  height: 400px;
  overflow-y: auto;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

#chatbot-input {
  display: flex;
  border-top: 1px solid #ddd;
  padding: 10px;
  gap: 8px;
  background-color: #fff;
}

#chatbot-input input {
  flex-grow: 1;
  padding: 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

/* Clean focus state */
#chatbot-input input:focus,
#chatbot-input input:focus-visible {
  outline: none;
  border: 2px solid #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.4);
}

/* Fix for Firefox's default focus ring */
#chatbot-input input:-moz-focusring {
  outline: none;
}


/* Send Button */
#chatbot-input button {
  background: #0d6efd;
  border: none;
  color: white;
  padding: 0 16px;
  cursor: pointer;
}

/* Message bubbles */
.chatbot-msg {
  padding: 8px 12px;
  margin: 5px 0;
  border-radius: 10px;
  max-width: 85%;
  word-wrap: break-word;
}

.chatbot-msg.user {
  background-color: #d1e7dd;
  align-self: flex-end;
  text-align: right;
}

.chatbot-msg.bot {
  background-color: #e9ecef;
  align-self: flex-start;
  line-height: 1.4;
}

/* Inner wrapper for bot HTML messages */
.chatbot-msg.bot .bot-message-wrapper > * {
  margin-bottom: 6px;
}

/* Link Styling */
.chatbot-msg.bot a {
  color: #0044cc;
  text-decoration: none;
}

.chatbot-msg.bot a:hover {
  text-decoration: underline;
}

/* Typing indicator */
#chatbot-typing {
  font-style: italic;
  color: #888;
  margin-top: 5px;
  font-size: 14px;
}

/* Bot Message Wrapper Styling */
.bot-message-wrapper {
  line-height: 1.5;
  font-size: 14px;
  color: #212529;
}

.bot-message-wrapper div {
  margin-bottom: 8px;
}

/* Part and support links */
.chatbot-msg.bot a {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
}

.chatbot-msg.bot a:hover {
  text-decoration: underline;
}

.choose-model-btn {
  margin: 0.3em 0;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 4px;
  background-color: #f1f1f1;
  border: 1px solid #ccc;
  cursor: pointer;
}
.choose-model-btn:hover:not(:disabled) {
  background-color: #e2e2e2;
}

/* Welcome message */
.chatbot-welcome {
  background-color: #f1f1f1;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 15px;
  color: #333;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chatbot-sr-wrap {
  background-color: #f9f9f9;
  padding: 1em;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-top: 1em;
  font-family: inherit;
}

.chatbot-sr-intro,
.chatbot-sr-instructions {
  margin-bottom: 0.75em;
  font-size: 0.95em;
  line-height: 1.4;
}

.chatbot-sr-group label {
  font-weight: bold;
  margin-bottom: 0.3em;
}

.chatbot-sr-group input {
  width: 100%;
  padding: 0.5em;
  font-size: 0.9em;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.chatbot-sr-submit {
  margin-top: 0.75em;
}

.chatbot-sr-submit button {
  padding: 0.5em 1em;
  font-size: 0.95em;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.chatbot-sr-submit button:hover {
  background-color: #0056b3;
}

.chatbot-sr-context {
  margin-top: 0.75em;
  font-size: 0.85em;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
  #chatbot-window {
    right: 5%;
    left: 5%;
    width: 90%;
    max-height: 80%;
  }

  #chatbot-bubble {
    bottom: 16px;
    right: 12px;
    left: auto;
    max-width: 280px;
    width: calc(100% - 24px); /* allows for 12px margin on both sides */
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.3;
    border-radius: 14px;
    box-sizing: border-box;
  }

  #chatbot-bubble .bubble-line-1 {
    font-size: 15px;
  }

  #chatbot-bubble .bubble-line-2,
  #chatbot-bubble .bubble-line-3 {
    font-size: 13px;
  }

  #chatbot-bubble .bubble-icon {
    font-size: 20px;
    margin-top: 4px;
    align-self: flex-end;
  }
}



