#simplyit-chatbot {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1e293b;
  line-height: 1.5;
}

/* Recreate the element defaults the widget relies on without leaking styles globally. */
:where(#simplyit-chatbot, #simplyit-chatbot *, #simplyit-chatbot *::before, #simplyit-chatbot *::after) {
  box-sizing: border-box;
}

:where(
  #simplyit-chatbot button,
  #simplyit-chatbot input,
  #simplyit-chatbot textarea,
  #simplyit-chatbot select,
  #simplyit-chatbot optgroup
) {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
}

:where(#simplyit-chatbot button, #simplyit-chatbot input, #simplyit-chatbot textarea) {
  margin: 0;
  text-transform: none;
}

:where(#simplyit-chatbot button, #simplyit-chatbot [role="button"]) {
  cursor: pointer;
  background-color: transparent;
  background-image: none;
  border: 0;
}

:where(#simplyit-chatbot button:disabled, #simplyit-chatbot [role="button"]:disabled) {
  cursor: default;
}

:where(
  #simplyit-chatbot p,
  #simplyit-chatbot h1,
  #simplyit-chatbot h2,
  #simplyit-chatbot h3,
  #simplyit-chatbot h4,
  #simplyit-chatbot h5,
  #simplyit-chatbot h6
) {
  margin: 0;
}

:where(#simplyit-chatbot ul, #simplyit-chatbot ol) {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(#simplyit-chatbot img, #simplyit-chatbot svg) {
  display: block;
  vertical-align: middle;
}

#simplyit-chatbot svg {
  overflow: hidden;
}

#chat-window {
  overflow: hidden;
}

#chat-form {
  margin: 0;
}

#chat-form > :first-child {
  min-width: 0;
}

#chat-input {
  min-width: 0;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
}

#chat-input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

#chat-fab,
#chat-send,
#chat-clear,
#chat-resize,
#chat-close,
#error-dismiss {
  -webkit-appearance: none;
  appearance: none;
}

/* Theme reset styles can still target native buttons, so harden the header icon controls directly. */
#simplyit-chatbot #chat-clear,
#simplyit-chatbot #chat-resize,
#simplyit-chatbot #chat-close,
#simplyit-chatbot #error-dismiss {
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  color: inherit;
  cursor: pointer !important;
}

#simplyit-chatbot #chat-clear:hover,
#simplyit-chatbot #chat-resize:hover,
#simplyit-chatbot #chat-close:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

#simplyit-chatbot #chat-clear:focus-visible,
#simplyit-chatbot #chat-resize:focus-visible,
#simplyit-chatbot #chat-close:focus-visible,
#simplyit-chatbot #error-dismiss:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

#chat-input {
  resize: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Simple scrollbar styling for message area */
#simplyit-chatbot .simplyit-chatbot-nice-scrollbar::-webkit-scrollbar { width: 10px; height: 10px; }
#simplyit-chatbot .simplyit-chatbot-nice-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(100, 116, 139, 0.5); border-radius: 9999px; }
#simplyit-chatbot .simplyit-chatbot-nice-scrollbar::-webkit-scrollbar-track { background-color: transparent; }

/* CSS Tooltip */
#simplyit-chatbot .simplyit-chatbot-tooltip { position: relative; }
#simplyit-chatbot .simplyit-chatbot-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: #1e293b;
  color: white;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
  pointer-events: none;
}
#simplyit-chatbot .simplyit-chatbot-tooltip:hover::after { opacity: 1; visibility: visible; }

/* Thinking indicator dots */
#simplyit-chatbot .thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#simplyit-chatbot .thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: rgb(99 102 241); /* indigo-500 */
  opacity: 0.2;
  animation: simplyit-chatbot-thinking-pulse 1.5s infinite ease-in-out;
}
#simplyit-chatbot .thinking-dot:nth-child(1) { animation-delay: 0s; }
#simplyit-chatbot .thinking-dot:nth-child(2) { animation-delay: 0.3s; }
#simplyit-chatbot .thinking-dot:nth-child(3) { animation-delay: 0.6s; }
@keyframes simplyit-chatbot-thinking-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* Chat FAB pulsing animation */
@keyframes simplyit-chatbot-chat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--chat-pulse-color, rgba(99, 102, 241, 0.7)); }
  50% { box-shadow: 0 0 0 15px var(--chat-pulse-color, rgba(99, 102, 241, 0)); }
}
#simplyit-chatbot .chat-fab-pulse {
  animation: simplyit-chatbot-chat-pulse 2s infinite;
}

/* Formatted content styles */
#simplyit-chatbot .formatted-content h1,
#simplyit-chatbot .formatted-content h2,
#simplyit-chatbot .formatted-content h3 {
  line-height: 1.4;
}
#simplyit-chatbot .formatted-content h1 { font-weight: 700; font-size: 1.25rem; margin-top: 1rem; margin-bottom: 0.75rem; }
#simplyit-chatbot .formatted-content h2 { font-weight: 600; font-size: 1.125rem; margin-top: 1rem; margin-bottom: 0.5rem; }
#simplyit-chatbot .formatted-content h3 { font-weight: 600; font-size: 1rem; margin-top: 0.75rem; margin-bottom: 0.5rem; }
#simplyit-chatbot .formatted-content p {
  line-height: 1.5;
  margin-bottom: 0.5rem;
}
#simplyit-chatbot .formatted-content strong { font-weight: 600; }
#simplyit-chatbot .formatted-content em { font-style: italic; }
#simplyit-chatbot .formatted-content ul,
#simplyit-chatbot .formatted-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  list-style: disc;
}
#simplyit-chatbot .formatted-content ol { list-style: decimal; }
#simplyit-chatbot .formatted-content li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
  color: inherit;
}
#simplyit-chatbot .formatted-content br { line-height: 1.2; }

/* Tables */
#simplyit-chatbot .formatted-content table {
  border-collapse: collapse;
  margin: 0.75rem 0;
  width: 100%;
  overflow-x: auto;
  display: block;
}
#simplyit-chatbot .formatted-content th,
#simplyit-chatbot .formatted-content td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.75rem;
  text-align: left;
}
#simplyit-chatbot .formatted-content th {
  font-weight: 600;
  background-color: #f8fafc;
}
#simplyit-chatbot .formatted-content tr:nth-child(even) td {
  background-color: #f8fafc;
}

/* Chat link styles */
#simplyit-chatbot .formatted-content a {
  color: inherit;
  opacity: 0.8;
  text-decoration: underline;
  word-break: break-all;
}
#simplyit-chatbot .formatted-content a:hover { opacity: 1; }

/* Chat window resize styles */
#simplyit-chatbot .chat-expanded {
  width: 95vw !important;
  max-width: 900px !important;
  height: 85vh !important;
}
#simplyit-chatbot .chat-expanded #chat-messages { height: calc(85vh - 140px) !important; }
#simplyit-chatbot .chat-expanded #chat-input { max-height: 120px !important; }

/* Mobile full-screen chat - behaves like a dedicated page */
@media (max-width: 640px) {
  #simplyit-chatbot .chat-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
  }
  #simplyit-chatbot .chat-fullscreen #chat-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }
  #simplyit-chatbot .chat-fullscreen #chat-form {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)) !important;
  }
  #simplyit-chatbot .chat-fullscreen #chat-form > :first-child {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    align-self: center !important;
  }
  #simplyit-chatbot .chat-fullscreen #chat-messages {
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
  }
  /* Fix input size when keyboard is open and prevent iOS focus zoom. */
  #simplyit-chatbot .chat-fullscreen #chat-form { flex-shrink: 0 !important; }
  #simplyit-chatbot .chat-fullscreen #chat-input {
    font-size: 16px !important;
    line-height: 1.5 !important;
    min-height: 44px !important;
    max-height: 96px !important;
    height: auto !important;
  }
  #simplyit-chatbot .chat-fullscreen #chat-send {
    flex: 0 0 auto !important;
    min-height: 44px !important;
    padding: 0.625rem 0.875rem !important;
    white-space: nowrap !important;
    align-self: center !important;
  }
  /* Hide FAB when chat is fullscreen on mobile */
  #simplyit-chatbot .chat-fullscreen ~ #chat-fab,
  #simplyit-chatbot:has(.chat-fullscreen) #chat-fab {
    display: none !important;
  }
}

/* Error snackbar transition */
#simplyit-chatbot #error-snackbar {
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
#simplyit-chatbot #error-snackbar.show {
  transform: translateY(0);
  opacity: 1;
}

/* Hide FAB on mobile when chat window is active */
#simplyit-chatbot .fab-mobile-hidden {
  opacity: 0;
  pointer-events: none;
}
