.dealerx-ai-chat-widget-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dealerx-ai-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: var(--dealerx-ai-chat-launcher-text, #ffffff);
  background: var(--dealerx-ai-chat-launcher-bg, #111827);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.28);
  cursor: pointer;
}

.dealerx-ai-chat-position-bottom-left {
  right: auto;
  left: 24px;
}

.dealerx-ai-chat-size-compact .dealerx-ai-chat-panel {
  width: min(340px, calc(100vw - 32px));
}

.dealerx-ai-chat-size-large .dealerx-ai-chat-panel {
  width: min(440px, calc(100vw - 32px));
}

.dealerx-ai-chat-launcher:focus-visible,
.dealerx-ai-chat-icon-button:focus-visible,
.dealerx-ai-chat-send:focus-visible,
.dealerx-ai-chat-quick-question:focus-visible {
  outline: 3px solid rgba(109, 40, 217, 0.36);
  outline-offset: 2px;
}

.dealerx-ai-chat-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #111827;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.dealerx-ai-chat-launcher-image {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
}

.dealerx-ai-chat-launcher-label {
  font-size: 15px;
  font-weight: 700;
}

.dealerx-ai-chat-panel {
  width: min(380px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 112px));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.dealerx-ai-chat-widget-open .dealerx-ai-chat-panel {
  margin-bottom: 0;
}

.dealerx-ai-chat-widget-open .dealerx-ai-chat-launcher {
  display: none;
}

.dealerx-ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--dealerx-ai-chat-header-text, #ffffff);
  background: var(--dealerx-ai-chat-header-bg, #111827);
}

.dealerx-ai-chat-title-wrap {
  display: grid;
  min-width: 0;
}

.dealerx-ai-chat-title {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.2;
}

.dealerx-ai-chat-subtitle {
  color: #cbd5e1;
  font-size: 12px;
}

.dealerx-ai-chat-controls {
  display: inline-flex;
  gap: 8px;
  flex: none;
}

.dealerx-ai-chat-icon-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #ffffff;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.dealerx-ai-chat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 420px;
  padding: 14px;
  background: var(--dealerx-ai-chat-body-bg, #f8fafc);
}

.dealerx-ai-chat-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dealerx-ai-chat-message {
  display: flex;
}

.dealerx-ai-chat-message-user {
  justify-content: flex-end;
}

.dealerx-ai-chat-message-assistant {
  justify-content: flex-start;
}

.dealerx-ai-chat-message-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 13px;
  color: var(--dealerx-ai-chat-assistant-text, #111827);
  background: var(--dealerx-ai-chat-assistant-bg, #ffffff);
  border: 1px solid #e2e8f0;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dealerx-ai-chat-message-assistant .dealerx-ai-chat-message-bubble {
  border-bottom-left-radius: 4px;
}

.dealerx-ai-chat-message-user .dealerx-ai-chat-message-bubble {
  color: var(--dealerx-ai-chat-user-text, #ffffff);
  border-color: #6d28d9;
  background: var(--dealerx-ai-chat-user-bg, #6d28d9);
  border-bottom-right-radius: 4px;
}

.dealerx-ai-chat-message-bubble[dir="rtl"],
.dealerx-ai-chat-message-bubble[dir="rtl"] .dealerx-ai-chat-message-html,
.dealerx-ai-chat-message-bubble[dir="rtl"] .dealerx-ai-chat-message-line {
  text-align: right;
}

.dealerx-ai-chat-message-bubble[dir="ltr"],
.dealerx-ai-chat-message-bubble[dir="ltr"] .dealerx-ai-chat-message-html,
.dealerx-ai-chat-message-bubble[dir="ltr"] .dealerx-ai-chat-message-line {
  text-align: left;
}

.dealerx-ai-chat-message-assistant .dealerx-ai-chat-message-bubble[dir="rtl"] {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 13px;
}

.dealerx-ai-chat-message-user .dealerx-ai-chat-message-bubble[dir="rtl"] {
  border-bottom-right-radius: 13px;
  border-bottom-left-radius: 4px;
}

.dealerx-ai-chat-message-line {
  margin: 0 0 8px;
}

.dealerx-ai-chat-message-html p,
.dealerx-ai-chat-message-html ul,
.dealerx-ai-chat-message-html ol,
.dealerx-ai-chat-message-html h3,
.dealerx-ai-chat-message-html h4 {
  margin: 0 0 8px;
}

.dealerx-ai-chat-message-html p:last-child,
.dealerx-ai-chat-message-html ul:last-child,
.dealerx-ai-chat-message-html ol:last-child,
.dealerx-ai-chat-message-html h3:last-child,
.dealerx-ai-chat-message-html h4:last-child {
  margin-bottom: 0;
}

.dealerx-ai-chat-message-html h3,
.dealerx-ai-chat-message-html h4 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.dealerx-ai-chat-message-html ul,
.dealerx-ai-chat-message-html ol {
  padding-inline-start: 18px;
}

.dealerx-ai-chat-message-html li {
  margin: 0 0 4px;
}

.dealerx-ai-chat-message-html a {
  color: currentColor;
  font-weight: 700;
  text-decoration: underline;
}

.dealerx-ai-chat-message-line:last-child {
  margin-bottom: 0;
}

.dealerx-ai-chat-quick-questions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.dealerx-ai-chat-quick-question {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid #d7deea;
  border-radius: 999px;
  color: var(--dealerx-ai-chat-quick-text, #334155);
  background: var(--dealerx-ai-chat-quick-bg, #ffffff);
  font-size: 12px;
  cursor: pointer;
}

.dealerx-ai-chat-typing {
  color: #64748b;
  font-size: 12px;
}

.dealerx-ai-chat-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.dealerx-ai-chat-input {
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  color: var(--dealerx-ai-chat-input-text, #111827);
  background: var(--dealerx-ai-chat-input-bg, #ffffff);
  border-radius: 10px;
  font-size: 14px;
}

.dealerx-ai-chat-widget-root .dealerx-ai-chat-send {
  min-height: 40px;
  padding: 0 14px;
  border: 0 !important;
  border-radius: 10px;
  color: var(--dealerx-ai-chat-send-text, #ffffff) !important;
  background: var(--dealerx-ai-chat-send-bg, #00b884) !important;
  font-weight: 700;
  cursor: pointer;
}

.dealerx-ai-chat-error {
  padding: 10px 12px;
  border-radius: 10px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 13px;
}

@media (max-width: 575.98px) {
  .dealerx-ai-chat-widget-root {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .dealerx-ai-chat-panel {
    width: 100%;
    max-height: calc(100vh - 96px);
  }

  .dealerx-ai-chat-launcher {
    float: right;
  }
}
