.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: 50%;
  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-launcher-circle .dealerx-ai-chat-launcher {
  justify-content: center;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
}

.dealerx-ai-chat-launcher-circle .dealerx-ai-chat-launcher-label {
  display: none;
}

.dealerx-ai-chat-launcher.dealerx-ai-chat-launcher-has-image {
  width: var(--dealerx-ai-chat-launcher-size, 56px);
  height: var(--dealerx-ai-chat-launcher-size, 56px);
  min-height: var(--dealerx-ai-chat-launcher-size, 56px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.dealerx-ai-chat-launcher.dealerx-ai-chat-launcher-has-image .dealerx-ai-chat-launcher-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.dealerx-ai-chat-launcher.dealerx-ai-chat-launcher-has-image .dealerx-ai-chat-launcher-label {
  display: none;
}

.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 {
  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 {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 112px));
  max-height: min(620px, calc(100vh - 112px));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: var(--dealerx-ai-chat-panel-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-widget-open.dealerx-ai-chat-floating-close {
  bottom: 96px;
}

.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-end-button {
  white-space: nowrap;
}

.dealerx-ai-chat-header-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.dealerx-ai-chat-header-avatar {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--dealerx-ai-chat-header-image-size, 42px);
  height: var(--dealerx-ai-chat-header-image-size, 42px);
  flex: 0 0 var(--dealerx-ai-chat-header-image-size, 42px);
  overflow: hidden;
  border-radius: 50%;
  color: var(--dealerx-ai-chat-launcher-text, #ffffff);
  background: var(--dealerx-ai-chat-launcher-bg, #111827);
  font-size: 12px;
  font-weight: 800;
}

.dealerx-ai-chat-header-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dealerx-ai-chat-close-icon {
  width: 32px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon {
  position: absolute;
  right: 0;
  bottom: -72px;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  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);
  font-size: 32px;
  font-weight: 300;
}

.dealerx-ai-chat-widget-open.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon:not([hidden]) {
  display: inline-flex;
}

.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon::before,
.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform-origin: center;
}

.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.dealerx-ai-chat-floating-close .dealerx-ai-chat-close-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.dealerx-ai-chat-floating-close.dealerx-ai-chat-position-bottom-left .dealerx-ai-chat-close-icon {
  right: auto;
  left: 0;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-panel {
  border-color: rgba(148, 163, 184, 0.2);
  border-radius: max(var(--dealerx-ai-chat-panel-radius, 18px), 18px);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.2);
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-header {
  padding: 16px;
  border-bottom: 1px solid #e8edf4;
  color: #172033;
  background: #ffffff;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-header-avatar {
  display: inline-flex;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-subtitle {
  color: #718096;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-end-button {
  min-height: 32px;
  padding: 0 12px;
  border-color: var(--dealerx-ai-chat-launcher-bg, #2563eb);
  border-radius: var(--dealerx-ai-chat-input-radius, 10px);
  color: var(--dealerx-ai-chat-launcher-bg, #2563eb);
  background: #ffffff;
  font-weight: 600;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-end-button:hover {
  color: #ffffff;
  background: var(--dealerx-ai-chat-launcher-bg, #2563eb);
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-body {
  min-height: 0;
  max-height: none;
  padding: 16px;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-messages {
  gap: 12px;
  scrollbar-color: #aeb7c4 transparent;
  scrollbar-width: thin;
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-message-bubble {
  padding: 11px 14px;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-footer {
  grid-template-columns: minmax(0, 1fr) 42px;
  margin: 12px;
  padding: 4px;
  border: 2px solid var(--dealerx-ai-chat-launcher-bg, #2563eb);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.dealerx-ai-chat-style-modern .dealerx-ai-chat-input {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  outline: 0;
}

.dealerx-ai-chat-widget-root.dealerx-ai-chat-style-modern .dealerx-ai-chat-send {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  color: var(--dealerx-ai-chat-launcher-bg, #2563eb) !important;
  background: transparent !important;
  font-size: 26px;
  font-weight: 400;
}

.dealerx-ai-chat-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  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: var(--dealerx-ai-chat-bubble-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: var(--dealerx-ai-chat-bubble-radius, 13px);
}

.dealerx-ai-chat-message-user .dealerx-ai-chat-message-bubble[dir="rtl"] {
  border-bottom-right-radius: var(--dealerx-ai-chat-bubble-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: #1d4ed8;
  font-weight: 700;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}

.dealerx-ai-chat-message-html a::after {
  display: inline-block;
  margin-inline-start: 4px;
  font-size: 0.8em;
  line-height: 1;
  text-decoration: none;
  content: "\2197";
  transform: translateY(-1px);
}

.dealerx-ai-chat-message-html a:hover {
  color: #1e40af;
  text-decoration-thickness: 3px;
}

.dealerx-ai-chat-message-html a:focus-visible {
  border-radius: 3px;
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 3px;
}

.dealerx-ai-chat-message-line:last-child {
  margin-bottom: 0;
}

.dealerx-ai-chat-typing {
  color: #64748b;
  font-size: 12px;
}

.dealerx-ai-chat-footer {
  display: grid;
  flex: 0 0 auto;
  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: var(--dealerx-ai-chat-input-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: 50%;
  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;
  }

  .dealerx-ai-chat-widget-open.dealerx-ai-chat-floating-close {
    bottom: 84px;
  }

  .dealerx-ai-chat-floating-close .dealerx-ai-chat-panel {
    max-height: calc(100vh - 160px);
  }

  .dealerx-ai-chat-widget-root.dealerx-ai-chat-widget-open.dealerx-ai-chat-composer-focused {
    top: calc(var(--dealerx-ai-chat-viewport-offset-top, 0px) + 8px);
    right: auto;
    bottom: auto;
    left: calc(var(--dealerx-ai-chat-viewport-offset-left, 0px) + 8px);
    width: calc(var(--dealerx-ai-chat-viewport-width, 100vw) - 16px);
    max-width: calc(var(--dealerx-ai-chat-viewport-width, 100vw) - 16px);
    height: calc(var(--dealerx-ai-chat-viewport-height, 100dvh) - 16px);
    box-sizing: border-box;
  }

  .dealerx-ai-chat-widget-open.dealerx-ai-chat-composer-focused .dealerx-ai-chat-panel {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
  }

  .dealerx-ai-chat-widget-root .dealerx-ai-chat-input {
    font-size: 16px;
  }

  .dealerx-ai-chat-widget-open.dealerx-ai-chat-composer-focused .dealerx-ai-chat-close-icon {
    display: none !important;
  }
}

.dealerx-ai-chat-languages {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: var(--dealerx-ai-chat-input-radius, 10px);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dealerx-ai-chat-language-prompt {
  margin: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.dealerx-ai-chat-language-options {
  display: flex;
  gap: 4px;
  width: 100%;
}

.dealerx-ai-chat-languages[hidden] {
  display: none;
}

.dealerx-ai-chat-widget-root .dealerx-ai-chat-language {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 1 0 !important;
  width: auto !important;
  min-width: 0 !important;
  height: var(--dealerx-ai-chat-language-height, 28px) !important;
  min-height: var(--dealerx-ai-chat-language-height, 28px) !important;
  max-height: var(--dealerx-ai-chat-language-height, 28px) !important;
  margin: 0 !important;
  padding: 0 5px !important;
  border-color: var(--dealerx-ai-chat-language-border, #cbd5e1) !important;
  border-style: solid !important;
  border-width: var(--dealerx-ai-chat-language-border-width, 1px) !important;
  border-radius: var(--dealerx-ai-chat-language-radius, 10px) !important;
  color: var(--dealerx-ai-chat-language-text, #334155) !important;
  background: var(--dealerx-ai-chat-language-bg, #ffffff) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
  font-family: inherit !important;
  font-size: var(--dealerx-ai-chat-language-font-size, 11px) !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  text-transform: none !important;
  white-space: nowrap !important;
  cursor: pointer;
}

.dealerx-ai-chat-widget-root .dealerx-ai-chat-language:hover,
.dealerx-ai-chat-widget-root .dealerx-ai-chat-language:focus,
.dealerx-ai-chat-widget-root .dealerx-ai-chat-language-selected {
  border-color: var(--dealerx-ai-chat-language-border, #cbd5e1) !important;
  color: var(--dealerx-ai-chat-language-text, #334155) !important;
  background: var(--dealerx-ai-chat-language-bg, #ffffff) !important;
}

.dealerx-ai-chat-language:focus-visible {
  outline: 3px solid rgba(109, 40, 217, 0.24);
  outline-offset: 2px;
}
