.saltech-chat-bubble { position: fixed; z-index: 99999; }
.saltech-chat-bubble--right { right: 20px; }
.saltech-chat-bubble--left  { left: 20px; }
.saltech-chat-bubble--bottom { bottom: 20px; }
.saltech-chat-bubble--top    { top: 20px; }

.saltech-chat-bubble__button {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.2); background: #1a73e8; color: #fff;
  font-size: 22px; cursor: pointer;
}

/* Base panel: NO display here; layout only */
.saltech-chat-bubble__panel {
  position: absolute; width: 320px; max-height: 60vh; /* display removed */
  flex-direction: column;
  background: #fff; border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,.18); overflow: hidden;
}

/* Attach panel to the opposite side of the button depending on corner */
.saltech-chat-bubble--right.saltech-chat-bubble--bottom .saltech-chat-bubble__panel { right: 0; bottom: 70px; }
.saltech-chat-bubble--left.saltech-chat-bubble--bottom  .saltech-chat-bubble__panel { left: 0;  bottom: 70px; }
.saltech-chat-bubble--right.saltech-chat-bubble--top    .saltech-chat-bubble__panel { right: 0;  top: 70px; }
.saltech-chat-bubble--left.saltech-chat-bubble--top     .saltech-chat-bubble__panel { left: 0;   top: 70px; }

.saltech-chat-bubble__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #f5f7fb; border-bottom: 1px solid #e9edf3;
  user-select: none;
}

.saltech-chat-bubble__close { border: none; background: transparent; font-size: 20px; cursor: pointer; }
.saltech-chat-bubble__messages { padding: 10px; overflow: auto; flex: 1; background: #fafbff; }

/* form */
.saltech-chat-bubble__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e9edf3; }
.saltech-chat-bubble__input { flex: 1; padding: 8px 10px; border: 1px solid #d2d7e2; border-radius: 8px; }
.saltech-chat-bubble__send { padding: 8px 12px; border-radius: 8px; border: 1px solid #d2d7e2; background: #fff; cursor: pointer; }

/* Hide by default; show when root has .is-open */
.saltech-chat-bubble__panel {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.saltech-chat-bubble.is-open .saltech-chat-bubble__panel {
  display: flex;         /* only set display here */
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Fullscreen toggle controls (optional, if you added the button) */
.saltech-chat-bubble__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.saltech-chat-bubble__fullscreen {
  border: 1px solid #d2d7e2;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* When fullscreen, hide the floating round bubble and stretch the panel */
.saltech-chat-bubble.is-fullscreen { 
  inset: 0;                 /* top/right/bottom/left: 0 */
  left: 0 !important;       /* override corner classes */
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
}

.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__button {
  display: none;
}

.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__header {
  cursor: default;
}

/* Ensure the messages stack top-to-bottom and allow left/right alignment */
.saltech-chat-bubble__messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Base message bubble style (mini column so timestamp can sit inside) */
.saltech-chat-bubble__message {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  display: inline-flex;
  flex-direction: column;  /* text + timestamp stacked */
  gap: 4px;
}

/* Text block inside message */
.saltech-chat-bubble__message-text {}

/* Timestamp inside the bubble (corner-aligned) */
.saltech-chat-bubble__timestamp {
  font-size: 11px;
  opacity: 0.75;
}

/* BOT = left side */
.saltech-chat-bubble__message--bot {
  align-self: flex-start;
  background: #f0f4ff;
  color: #333;
  border-bottom-left-radius: 4px;
}
.saltech-chat-bubble__message--bot .saltech-chat-bubble__timestamp {
  align-self: flex-start; /* timestamp hugs left */
}

/* USER = right side */
.saltech-chat-bubble__message--user {
  align-self: flex-end;
  background: #1a73e8;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.saltech-chat-bubble__message--user .saltech-chat-bubble__timestamp {
  align-self: flex-end; /* timestamp hugs right */
}

/* Bigger font when fullscreen */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__message {
  font-size: 16px;   /* was 14px */
  line-height: 1.5;
}
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__messages {
  gap: 10px;         /* a little more spacing between bubbles */
}

/* ---------- Typing indicator (three pulsing dots) ---------- */
@keyframes saltechDots {
  0%   { transform: translateY(0);   opacity: 0.4; }
  20%  { transform: translateY(-2px); opacity: 1; }
  40%  { transform: translateY(0);   opacity: 0.6; }
  100% { transform: translateY(0);   opacity: 0.4; }
}

.saltech-chat-bubble__typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 1em;
}

.saltech-chat-bubble__typing .dot {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  animation: saltechDots 1s infinite ease-in-out;
  opacity: 0.7;
}

/* styled like other popular bots */
.saltech-chat-bubble__message--typing {
  background: #f0f4ff;
  color: #333;
}


/*  Uniform buttons & spacing (drop-in)  */

/* Make form controls align nicely */
.saltech-chat-bubble__form {
    align-items: center;
  }
  
/* Input height to match buttons */
.saltech-chat-bubble__input {
  height: 40px;
  line-height: 40px;
}

/* Normalize “action” buttons (send + fullscreen) */
.saltech-chat-bubble__send,
.saltech-chat-bubble__fullscreen {
  height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Close (X) — same visual footprint as the others */
.saltech-chat-bubble__close {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px; /* keeps the “×” sized right */
  line-height: 1;
}

/* Header action group spacing */
.saltech-chat-bubble__actions {
  display: inline-flex;
  gap: 8px;           /* consistent gap between fullscreen & close */
  align-items: center;
}

/* Keep the round launcher distinct but consistent */
.saltech-chat-bubble__button {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/*  Make action buttons circular  */
.saltech-chat-bubble__send,
.saltech-chat-bubble__fullscreen,
.saltech-chat-bubble__close {
  width: 40px;
  height: 40px;
  border-radius: 50% !important; /* full circle */
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Icon sizing inside */
.saltech-chat-bubble__send { font-size: 16px; }
.saltech-chat-bubble__fullscreen { font-size: 16px; }
.saltech-chat-bubble__close { font-size: 18px; }

/* Circular action buttons */
.saltech-chat-bubble__send,
.saltech-chat-bubble__fullscreen,
.saltech-chat-bubble__close {
  width: 40px;
  height: 40px;
  border-radius: 50% !important;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 18px;
}

/* Paper plane icon for send button */
.saltech-chat-bubble__send::before {
  content: "➤";   /* angled arrow, resembles a paper plane send icon */
  font-size: 16px;
  line-height: 1;
}

/* Optional hover effect */
.saltech-chat-bubble__send:hover {
  filter: brightness(1.1);
}

/* Base message font (scales with screen width) */
.saltech-chat-bubble__message {
  font-size: clamp(14px, 1.6vw, 18px); /* min 14px, fluid up to 18px */
  line-height: 1.5;
}

/* Fullscreen — scale a bit more aggressively */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__message {
  font-size: clamp(16px, 2vw, 22px); /* min 16px, grows up to 22px */
  line-height: 1.6;
}

/* Input field should match message text size */
.saltech-chat-bubble__input { font-size: inherit; }

/* Send/Fullscreen/Close buttons: scale icons too */
.saltech-chat-bubble__send,
.saltech-chat-bubble__fullscreen,
.saltech-chat-bubble__close {
  font-size: clamp(14px, 1.5vw, 18px);
}


/*  Centered content in fullscreen (ChatGPT-style)  */

/* Tunable container width for the chat column */
.saltech-chat-bubble {
  --chat-max-width: clamp(600px, 70vw, 920px);  /* min, fluid, max */
  --chat-side-padding: clamp(12px, 3vw, 32px);  /* gutter padding */
}

/* Give the fullscreen panel room to breathe on big screens */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__panel {
  padding-inline: var(--chat-side-padding);
  padding-block: 12px;
  display: flex;
  flex-direction: column;
}

/* Center the main sections and cap the width */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__header,
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__messages,
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__form {
  width: 100%;
  max-width: var(--chat-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Optional: subtle vertical edges so the center column feels defined */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__messages {
  border-left: 1px solid #e9edf3;
  border-right: 1px solid #e9edf3;
  background: #fafbff; /* keep existing */
}

/* Keep message bubbles aligned left/right inside the centered column */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__message--bot { align-self: flex-start; }
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__message--user { align-self: flex-end; }


/*  Unified fullscreen background  */

/* Make panel background and gutter whitespace the same */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__panel {
  background: #fafbff;   /* matches chat area */
}

/* Remove inner box background so it blends */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__messages {
  background: transparent;
  border-left: none;
  border-right: none;
}

/* Header + form sit on same background */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__header,
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__form {
  background: #fafbff;
  border: none;
}


/* True fullscreen experience */

/* When chatbot is fullscreen, lock the body scroll */
body.saltech-no-scroll {
  overflow: hidden !important;
  height: 100%;
}

/* Make sure chat panel scrolls internally */
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__panel {
  overflow: hidden;       /* panel itself hidden */
  display: flex;
  flex-direction: column;
}
.saltech-chat-bubble.is-fullscreen .saltech-chat-bubble__messages {
  flex: 1;                /* take up remaining space */
  overflow-y: auto;       /* scroll inside panel */
}


/* Disabled state visuals */
.saltech-chat-bubble.is-busy .saltech-chat-bubble__input,
.saltech-chat-bubble.is-busy .saltech-chat-bubble__send {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ===== Markdown rendering niceties (bot replies) ===== */

/* Reset margins for typical markdown blocks within a bubble */
.saltech-chat-bubble__message-text > *:first-child { margin-top: 0; }
.saltech-chat-bubble__message-text > *:last-child  { margin-bottom: 0; }

.saltech-chat-bubble__message-text h1,
.saltech-chat-bubble__message-text h2,
.saltech-chat-bubble__message-text h3,
.saltech-chat-bubble__message-text h4,
.saltech-chat-bubble__message-text h5,
.saltech-chat-bubble__message-text h6 {
  font-weight: 600;
  line-height: 1.3;
  margin: 6px 0 4px;
}
.saltech-chat-bubble__message-text h1 { font-size: 1.2em; }
.saltech-chat-bubble__message-text h2 { font-size: 1.15em; }
.saltech-chat-bubble__message-text h3 { font-size: 1.1em; }

.saltech-chat-bubble__message-text p { margin: 6px 0; }

.saltech-chat-bubble__message-text ul,
.saltech-chat-bubble__message-text ol {
  margin: 6px 0 6px 1.25em;
  padding: 0;
}
.saltech-chat-bubble__message-text li { margin: 2px 0; }

.saltech-chat-bubble__message-text a {
  color: #1a73e8;
  text-decoration: underline;
  word-break: break-word;
}

/* Inline code and blocks */
.saltech-chat-bubble__message-text code,
.saltech-chat-bubble__message-text pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.saltech-chat-bubble__message-text code {
  background: #f6f8fa;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.95em;
}
.saltech-chat-bubble__message-text pre {
  background: #f6f8fa;
  padding: 10px 12px;
  border-radius: 8px;
  overflow: auto;
  margin: 6px 0;
  border: 1px solid #e9edf3;
}
.saltech-chat-bubble__message-text pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Blockquotes */
.saltech-chat-bubble__message-text blockquote {
  margin: 8px 0;
  padding: 6px 10px;
  border-left: 4px solid #d7def0;
  background: #f4f7ff;
  border-radius: 6px;
  color: #333;
}

/* Horizontal rule */
.saltech-chat-bubble__message-text hr {
  border: 0;
  border-top: 1px solid #e4e7ee;
  margin: 8px 0;
}

/* Tables */
.saltech-chat-bubble__message-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}
.saltech-chat-bubble__message-text th,
.saltech-chat-bubble__message-text td {
  border: 1px solid #e4e7ee;
  padding: 6px 8px;
  text-align: left;
}
.saltech-chat-bubble__message-text th {
  background: #f1f4fb;
  font-weight: 600;
}

/* --- Typing caret for bot streaming --- */
@keyframes saltechCaret {
    50% { border-right-color: transparent; }
  }
  .saltech-chat-bubble__message--bot .typing-caret {
    display: inline-block;
    border-right: 2px solid rgba(0,0,0,.35);
    animation: saltechCaret 600ms steps(1) infinite;
    height: 1em;
    vertical-align: bottom;
  }