/* =========================================================
   TRUSENTA / DANA THEME FOR @n8n/chat — WITH FONT FIX
   ========================================================= */

/* Load default n8n styles (must stay at the top) */
@import url('https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css');

/* ---------------------------------------------------------
   BRANDING VARIABLES
   --------------------------------------------------------- */
:root {
  --chat--color-primary: #2B2B2B;
  --chat--color-primary-shade-50: #383838;
  --chat--color-primary-shade-100: #141414;

  /* Brand purple */
  --chat--color-secondary: #a855f7;
  --chat--color-secondary-shade-50: #9333ea;

  --chat--color-white: #ffffff;
  --chat--color-light: #f5f5f5;

  --chat--font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Chat window size */
  --chat--window--width: 350px;
  --chat--window--height: 650px;

  /* Toggle button – purple */
  --chat--toggle--background: #a855f7;
  --chat--toggle--hover--background: #9333ea;
  --chat--toggle--active--background: #7e22ce;
  --chat--toggle--color: #ffffff;
  --chat--toggle--size: 60px;

  /* User and bot message colors */
  --chat--message--user--background: var(--chat--color-secondary);
  --chat--message--user--color: #ffffff;

  --chat--message--bot--background: #ffffff;
  --chat--message--bot--color: #2B2B2B;

  --chat--message--pre--background: rgba(0, 0, 0, 0.03);

  /* Message text size (tweak this if needed) */
  --chat--message--font-size: 14px;
  --chat--message-line-height: 1.35;
}

/* ---------------------------------------------------------
   GLOBAL CONTAINER
   --------------------------------------------------------- */
#n8n-chat {
  font-family: var(--chat--font-family);
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

#n8n-chat .chat-container,
#n8n-chat .chat-window-wrapper {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

/* ---------------------------------------------------------
   TRANSPARENT CHAT WINDOW SHELL
   --------------------------------------------------------- */
#n8n-chat .chat-window {
  width: var(--chat--window--width);
  height: var(--chat--window--height);

  background: transparent !important;
  border: none !important;
  box-shadow: none !important;

  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

/* ---------------------------------------------------------
   HEADER WITH DANA AVATAR
   --------------------------------------------------------- */
#n8n-chat .chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;

  padding: 0.75rem !important;
  background: #2B2B2B !important;
  color: #ffffff !important;

  border-radius: 12px 12px 0 0;
}

/* Avatar */
#n8n-chat .chat-header::before {
  content: '';
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-image: url("https://trusau.blob.core.windows.net/assets/media/Dana%20AI%20-%20Face.jpg");
  background-size: cover;
  background-position: center;
}

/* Header title */
#n8n-chat .chat-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* Header subtitle */
#n8n-chat .chat-header p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ---------------------------------------------------------
   MESSAGE PANEL
   --------------------------------------------------------- */
#n8n-chat .chat-messages {
  flex: 1 1 auto;
  background: #f5f5f5 !important;
  overflow-y: auto;
  padding: 0 !important;
  margin: 0 !important;
}

/* Bubble padding remains compact */
#n8n-chat .chat-message {
  padding: 5px 9px !important;
}

/* Bot bubble style */
#n8n-chat .chat-message.bot {
  background: #ffffff !important;
  border: 1px solid #e3e3e3 !important;
  color: #2B2B2B !important;
}

/* User bubble style (purple) */
#n8n-chat .chat-message.user {
  background: #a855f7 !important;
  color: #ffffff !important;
  border: none !important;
}

/* Links in messages */
#n8n-chat a {
  color: var(--chat--color-secondary) !important;
  font-weight: 600;
  text-decoration: underline !important;
}
#n8n-chat a:hover {
  text-decoration: none !important;
}

#n8n-chat strong,
#n8n-chat b {
  font-weight: 600;
}

/* ---------------------------------------------------------
   🔧 FONT SIZE FIX FOR CURRENT @n8n/chat
   ---------------------------------------------------------
   Target all known wrappers where the actual text lives:
   - .chat-message-markdown (markdown wrapper)
   - .chat-message           (older bubble)
   - .n8n-chat-widget-message-bubble (newer widget)
   --------------------------------------------------------- */
#n8n-chat .chat-message-markdown *{
  font-size: var(--chat--message--font-size) !important;
  line-height: var(--chat--message-line-height) !important;

}

/* ---------------------------------------------------------
   INPUT BAR
   --------------------------------------------------------- */
#n8n-chat .chat-input {
  display: flex;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 0 12px 12px;
}

/* Textarea: border left + bottom only */
#n8n-chat .chat-input textarea {
  flex: 1 1 auto;
  background: #ffffff !important;

  border-left: 1px solid #e5e5e5 !important;
  border-bottom: 1px solid #e5e5e5 !important;
  border-top: none !important;
  border-right: none !important;

  padding: 10px !important;
  font-size: 13px !important;
  resize: none !important;
}

/* Send button: border right + bottom only */
#n8n-chat .chat-input button,
#n8n-chat .chat-input [type="submit"] {
  background: #ffffff !important;

  border-right: 1px solid #e5e5e5 !important;
  border-bottom: 1px solid #e5e5e5 !important;
  border-top: none !important;
  border-left: none !important;

  padding: 0 14px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Send icon = purple */
#n8n-chat .chat-input button svg,
#n8n-chat .chat-input [type="submit"] svg {
  fill: #a855f7 !important;
  stroke: #a855f7 !important;
}

/* Subtle hover for send button */
#n8n-chat .chat-input button:hover,
#n8n-chat .chat-input [type="submit"]:hover {
  background: #f3f4f6 !important;
}

/* ---------------------------------------------------------
   TYPING INDICATOR (dots purple, background transparent)
   --------------------------------------------------------- */

/* Make the typing container background transparent,
   but do NOT touch children or box-shadows */
#n8n-chat [class*="typing"] {
  background-color: transparent !important;
}

/* Color only the dots purple (they're spans/divs inside the typing container) */
#n8n-chat [class*="typing"] span {
  background-color: var(--chat--color-secondary) !important;
  border-color: var(--chat--color-secondary) !important;
}

/* -------------------------------------------
   SEND BUTTON STATES (SVG icon only)
   ------------------------------------------- */



/* DISABLED STATE — light purple */
#n8n-chat .chat-input-send-button:disabled svg path {
  stroke: #e9d5ff !important;
  fill: #e9d5ff !important;
}

/* ENABLED STATE — full purple */
#n8n-chat .chat-input-send-button:not(:disabled) svg path {
  stroke: var(--chat--color-secondary) !important;
  fill: var(--chat--color-secondary) !important;
}
