/* Isolated from theme form styles (global textarea/button rules). */
.ff-chatbot {
  --ff-chat-bg: #0f172a;
  --ff-chat-accent: #eab308;
  --ff-chat-panel: #ffffff;
  --ff-chat-border: #e2e8f0;
  --ff-chat-text: #0f172a;
  --ff-chat-muted: #64748b;
  --ff-chat-user: #1e293b;
  --ff-chat-bot: #f8fafc;
  --ff-chat-link: #1d4ed8;
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1200;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
}

.ff-chatbot *,
.ff-chatbot *::before,
.ff-chatbot *::after {
  box-sizing: border-box;
}

.ff-chatbot__launcher {
  width: 3.4rem;
  height: 3.4rem;
  border: 0 !important;
  border-radius: 999px;
  background: var(--ff-chat-bg) !important;
  color: var(--ff-chat-accent) !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  text-transform: none !important;
  width: 3.4rem !important;
  height: 3.4rem !important;
}

.ff-chatbot.is-open .ff-chatbot__launcher {
  display: none;
}

.ff-chatbot__panel {
  width: min(22.5rem, calc(100vw - 1.5rem));
  max-height: min(36rem, calc(100vh - 2rem));
  background: var(--ff-chat-panel);
  border: 1px solid var(--ff-chat-border);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ff-chatbot__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: var(--ff-chat-bg);
  color: #fff;
  flex-shrink: 0;
}

.ff-chatbot__header strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ff-chatbot__remaining {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #cbd5e1;
}

.ff-chatbot__close {
  border: 0 !important;
  background: transparent !important;
  color: #fff !important;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem !important;
  width: auto !important;
  height: auto !important;
  text-transform: none !important;
}

.ff-chatbot__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
}

.ff-chatbot__messages {
  padding: 0.9rem 0.9rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ff-chatbot__msg {
  display: flex;
}

.ff-chatbot__msg--user {
  justify-content: flex-end;
}

.ff-chatbot__bubble {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ff-chat-text);
  white-space: normal;
  overflow-wrap: anywhere;
}

.ff-chatbot__msg--user .ff-chatbot__bubble {
  background: var(--ff-chat-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ff-chatbot__msg--bot .ff-chatbot__bubble {
  background: #fff;
  border: 1px solid var(--ff-chat-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ff-chatbot__prompts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem 0.95rem;
}

.ff-chatbot__prompt {
  text-align: left;
  border: 1px solid #bfdbfe !important;
  background: #eff6ff !important;
  border-radius: 10px !important;
  padding: 0.55rem 0.7rem !important;
  font-size: 0.78rem !important;
  line-height: 1.35;
  color: var(--ff-chat-link) !important;
  cursor: pointer;
  width: 100% !important;
  height: auto !important;
  text-transform: none !important;
  font-weight: 600;
}

.ff-chatbot__prompt:hover {
  border-color: #93c5fd !important;
  background: #dbeafe !important;
}

.ff-chatbot__composer {
  flex-shrink: 0;
  border-top: 1px solid var(--ff-chat-border);
  background: #fff;
  padding: 0.75rem 0.85rem 0.55rem;
}

.ff-chatbot__form {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
}

.ff-chatbot__form label {
  display: none !important;
}

.ff-chatbot__form textarea,
.ff-chatbot textarea.ff-chatbot__input {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: 2.6rem !important;
  max-height: 5.5rem !important;
  resize: none !important;
  display: block !important;
  margin: 0 !important;
  border: 1px solid var(--ff-chat-border) !important;
  border-radius: 10px !important;
  padding: 0.65rem 0.75rem !important;
  font: inherit !important;
  font-size: 0.875rem !important;
  line-height: 1.35 !important;
  color: var(--ff-chat-text) !important;
  background: #fff !important;
  box-shadow: none !important;
}

.ff-chatbot__form textarea:focus,
.ff-chatbot textarea.ff-chatbot__input:focus {
  outline: none !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18) !important;
}

.ff-chatbot__form textarea::placeholder,
.ff-chatbot textarea.ff-chatbot__input::placeholder {
  color: #94a3b8 !important;
  font-size: 0.875rem !important;
  line-height: 1.35 !important;
  opacity: 1;
}

.ff-chatbot__form button[type='submit'],
.ff-chatbot__send {
  flex: 0 0 2.75rem !important;
  width: 2.75rem !important;
  min-width: 2.75rem !important;
  max-width: 2.75rem !important;
  height: 2.6rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: var(--ff-chat-bg) !important;
  color: var(--ff-chat-accent) !important;
  cursor: pointer;
  font-size: 1rem !important;
  line-height: 1 !important;
  text-transform: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.ff-chatbot__form button[type='submit']:hover,
.ff-chatbot__send:hover {
  background: #1e293b !important;
  color: #fff !important;
}

.ff-chatbot__form button:disabled,
.ff-chatbot__form textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ff-chatbot__footer {
  margin-top: 0.45rem;
  padding: 0;
  font-size: 0.68rem;
  color: var(--ff-chat-muted);
  text-align: center;
}
