/* ClanNode theme for the AnythingLLM embed widget (chat.clannode.com).
   Served from /embed/ next to the widget script (compose bind mount); every host page links it before the
   widget loads. The widget renders inside the page with allm-* utility classes, so the overrides are scoped
   to its containers and use !important to beat the widget's own stylesheet. Palette from clannode.com
   (src/app/globals.css). Written for anythingllm-embed shipped with AnythingLLM 1.17. */

:root {
  --cn-chat-bg: #101010;
  --cn-chat-surface: #191919;
  --cn-chat-raised: #222222;
  --cn-chat-border: #30302e;
  --cn-chat-text: #f5f5f3;
  --cn-chat-muted: #b0b0ad;
  --cn-chat-accent: #ffd744;
  --cn-chat-accent-strong: #eac139;
  --cn-chat-font:
    var(--font-sans, "Manrope"), "Titillium Web", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

/* Window */
#anything-llm-embed-chat-container #anything-llm-chat {
  background: var(--cn-chat-bg) !important;
  border-color: var(--cn-chat-border) !important;
  color: var(--cn-chat-text) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6) !important;
  font-family: var(--cn-chat-font) !important;
}
#anything-llm-embed-chat-container #anything-llm-chat .allm-bg-white {
  background-color: var(--cn-chat-bg) !important;
}
#anything-llm-embed-chat-container #anything-llm-chat .allm-font-sans {
  font-family: var(--cn-chat-font) !important;
}

/* Header: yellow bar with the CN tile */
#anything-llm-embed-chat-container #anything-llm-header {
  background: var(--cn-chat-accent) !important;
  border-bottom: 1px solid var(--cn-chat-accent-strong);
}
/* The tile sits on the left; the widget centres it by default. */
#anything-llm-embed-chat-container #anything-llm-header > div:first-child {
  justify-content: flex-start !important;
  padding-left: 18px;
}
#anything-llm-embed-chat-container #anything-llm-header img {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
#anything-llm-embed-chat-container #anything-llm-header button {
  color: #101010 !important;
  opacity: 0.8;
}
#anything-llm-embed-chat-container #anything-llm-header button:hover {
  background: rgba(16, 16, 16, 0.1) !important;
  opacity: 1;
}

/* Messages: assistant on a dark raised surface, the visitor on yellow (colours come from the data-* attributes) */
#anything-llm-embed-chat-container #chat-history .allm-text-gray-400 {
  color: var(--cn-chat-muted) !important;
}
#anything-llm-embed-chat-container #chat-history .allm-justify-start div {
  color: var(--cn-chat-text) !important;
}
#anything-llm-embed-chat-container #chat-history .allm-justify-start a {
  color: var(--cn-chat-accent) !important;
  text-decoration: underline;
}
#anything-llm-embed-chat-container #chat-history .allm-justify-start strong {
  color: #ffffff;
}
#anything-llm-embed-chat-container #chat-history .allm-justify-end div,
#anything-llm-embed-chat-container #chat-history .allm-justify-end a {
  color: #101010 !important;
}
#anything-llm-embed-chat-container #anything-llm-icon {
  border-radius: 8px;
}

/* Pending reply: the widget shows three falling dots and nothing else, and they are black on our
   dark bubble. Make them visible and add a short note that answers take a few seconds, so nobody
   expects an instant reply. The widget has no setting for this; the note hangs off the pending
   bubble and follows the page language (website and shop set <html lang>, the Panel does not, so
   it reads English there). */
#anything-llm-embed-chat-container #chat-history .allm-dot-falling {
  filter: invert(1) !important;
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling) {
  padding-bottom: 12px !important;
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling)::after {
  content: "Preparing your answer. Replies usually take about 10 seconds, a little longer when the chat is busy.";
  display: block;
  margin: 14px 4px 0;
  max-width: 260px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--cn-chat-muted);
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling):lang(ro)::after {
  content: "Pregătim răspunsul. De obicei durează cam 10 secunde, puțin mai mult când chatul este aglomerat.";
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling):lang(de)::after {
  content: "Die Antwort wird vorbereitet. Das dauert meist etwa 10 Sekunden, bei viel Betrieb etwas länger.";
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling):lang(fr)::after {
  content: "Réponse en préparation. Cela prend en général une dizaine de secondes, un peu plus en cas d'affluence.";
}
#anything-llm-embed-chat-container #chat-history div:has(> .allm-dot-falling):lang(es)::after {
  content: "Preparando la respuesta. Suele tardar unos 10 segundos, algo más cuando el chat está ocupado.";
}

/* Error boxes (the widget shows "Could not respond" when the server fails): dark red on the dark surface */
#anything-llm-embed-chat-container #chat-history .allm-bg-red-200 {
  background: var(--cn-chat-raised) !important;
  border: 1px solid #5a2a2a;
}
#anything-llm-embed-chat-container #chat-history .allm-bg-red-50 {
  background: transparent !important;
  color: #ffb4a8 !important;
}
#anything-llm-embed-chat-container #chat-history .allm-text-red-500 {
  color: #ffb4a8 !important;
}
#anything-llm-embed-chat-container #chat-history .allm-bg-red-300 {
  background: #3a1d1d !important;
  color: #ffd1c9 !important;
  border-left-color: #ff7b6b !important;
  font-family: var(--cn-chat-font) !important;
}

/* Input */
#anything-llm-embed-chat-container form,
#anything-llm-embed-chat-container form .allm-bg-white {
  background: var(--cn-chat-surface) !important;
}
#anything-llm-embed-chat-container form div.allm-rounded-2xl {
  background: var(--cn-chat-raised) !important;
  border: 1px solid var(--cn-chat-border);
}
#anything-llm-embed-chat-container #message-input {
  color: var(--cn-chat-text) !important;
  caret-color: var(--cn-chat-accent);
}
#anything-llm-embed-chat-container #message-input::placeholder {
  color: var(--cn-chat-muted) !important;
  opacity: 1;
}
/* Send button: transparent, yellow paper-plane (the icon carries its own dark colour class). */
#anything-llm-embed-chat-container #send-message-button {
  background: transparent !important;
  color: var(--cn-chat-accent) !important;
}
#anything-llm-embed-chat-container #send-message-button svg {
  color: var(--cn-chat-accent) !important;
  fill: currentColor;
  opacity: 1;
}
#anything-llm-embed-chat-container #send-message-button:hover svg {
  color: var(--cn-chat-accent-strong) !important;
}

/* Footer (reset chat) */
#anything-llm-embed-chat-container button[class*="allm-text-sm"] {
  color: var(--cn-chat-muted) !important;
}
#anything-llm-embed-chat-container button[class*="allm-text-sm"]:hover {
  color: var(--cn-chat-text) !important;
}

/* Scrollbars */
#anything-llm-embed-chat-container * {
  scrollbar-color: #3a3a38 var(--cn-chat-bg);
}

/* Launcher bubble (its yellow comes from data-button-color) */
#anything-llm-embed-chat-button-container #anything-llm-embed-chat-button {
  color: #101010 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45) !important;
}
