/* Widget options live in docs-chat.html. Furo supplies the theme palette. */
#anything-llm-chat {
  --chat-reply-padding: .75rem;
  --chat-reply-gutter: .5rem;
  box-sizing: border-box;
  width: calc(100% - 2rem);
  background-color: var(--color-background-primary);
  color: var(--color-foreground-primary);
  border-color: var(--color-background-border);
}

#anything-llm-chat .allm-bg-white {
  background-color: var(--color-background-primary);
}

/* The streaming renderer only marks the reply text; history marks the bubble. */
#anything-llm-chat :is(.allm-anything-llm-assistant-message, div:has(> div > .allm-reply)) {
  background-color: var(--color-background-secondary) !important;
  color: var(--color-foreground-primary);
  min-width: 0;
  flex: 1;
  padding-inline: var(--chat-reply-padding);
  margin-inline: var(--chat-reply-gutter);
  box-shadow: none;
}

#anything-llm-chat .allm-reply {
  width: 100%;
  min-width: 0;
}

#anything-llm-chat :is(.allm-reply, .allm-anything-llm-assistant-message) :is(h1, h2, h3, h4) {
  font-size: 1.1em;
  line-height: 1.4;
  margin-block: .6em .2em;
}

#anything-llm-chat blockquote {
  background-color: var(--color-background-primary);
  border-left-color: var(--color-background-border);
  color: inherit;
}

#anything-llm-chat table {
  width: 100%;
  border-collapse: collapse;
}

#anything-llm-chat :is(th, td) {
  text-align: start !important; /* Markdown can set inline column alignment. */
  vertical-align: top;
  padding: .3em .5em;
  border-bottom: 1px solid var(--color-background-border);
  overflow-wrap: anywhere;
}

#anything-llm-chat :is(#anything-llm-header, div:has(> #message-input)) {
  border-color: var(--color-background-border) !important;
}

#anything-llm-chat #anything-llm-header img {
  background: white;
  border-radius: .35rem;
}

#anything-llm-chat :is(#message-input, #send-message-button svg) {
  color: var(--color-foreground-primary);
}

#anything-llm-chat #message-input::placeholder,
#anything-llm-chat #anything-llm-header :is(button, a),
#anything-llm-chat .allm-text-gray-400 {
  color: var(--color-foreground-secondary);
}

/* Reset Chat is the widget's footer button and has an inline text color. */
#anything-llm-chat > div > :last-child button {
  color: var(--color-foreground-secondary) !important;
}

/* The launcher lives outside the panel. Both controls have inline backgrounds. */
#anything-llm-embed-chat-button {
  background-color: var(--color-brand-primary) !important;
  color: var(--color-background-primary);
}

#anything-llm-embed-chat-button svg {
  color: inherit;
}

#anything-llm-chat button.msg-suggestion {
  background-color: var(--color-background-secondary) !important;
  color: var(--color-foreground-primary);
  border: 1px solid var(--color-background-border);
  box-shadow: none;
  text-align: start;
  padding: .6rem .85rem;
}

#anything-llm-chat button.msg-suggestion:is(:hover, :focus-visible) {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

#anything-llm-chat :is(button, a):focus-visible,
#anything-llm-embed-chat-button:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

#anything-llm-chat .allm-anything-llm-assistant-message .allm-whitespace-pre-line,
#anything-llm-chat .allm-reply {
  font-size: var(--chat-text-size, 15px);
  line-height: 1.55;
}

#anything-llm-chat .vb-chat-type {
  position: absolute;
  inset-inline-start: .75rem;
  display: flex;
  gap: .25rem;
}

#anything-llm-chat .vb-chat-type button {
  background: var(--color-background-secondary);
  color: var(--color-foreground-primary);
  border: 1px solid var(--color-background-border);
  border-radius: .35rem;
  padding: .2rem .45rem;
  cursor: pointer;
}

#anything-llm-chat .vb-chat-type button:disabled {
  opacity: .55;
  cursor: default;
}

/* Keep the widget's generated HTML indentation out of the code toolbar layout. */
#anything-llm-chat .allm-relative:has(> div > [data-code-snippet]) {
  white-space: normal;
}

#anything-llm-chat .allm-absolute:has(> [data-code-snippet]) {
  position: static;
}

#anything-llm-chat .allm-overflow-x-auto > pre {
  margin: 0;
  padding-block: .35rem;
}

