.saic-chatbot-root {
  --saic-primary: #2563eb;
  --saic-user-text: #fff;
  --saic-user-bg: #2563eb;
  --saic-bot-bg: #f4f7fb;
  --saic-window-bg: #fff;
  --saic-send: #111827;
  --saic-border: #d9e2ef;
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #111827;
  width: fit-content;
  max-width: calc(100vw - 24px);
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  visibility: visible;
  opacity: 1;
}

.saic-chatbot-root.saic-not-ready,
.saic-chatbot-root:empty {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

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

.saic-chatbot-root * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.saic-chatbot-root.saic-bottom-right {
  right: 22px;
  bottom: 22px;
}

.saic-chatbot-root.saic-bottom-left {
  left: 22px;
  bottom: 22px;
}

.saic-chatbot-root.saic-bottom-full {
  left: 16px;
  right: 16px;
  bottom: 12px;
  width: auto;
  max-width: none;
}

.saic-chatbot-root .saic-chat-window {
  width: min(380px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 112px));
  max-height: 620px;
  display: none;
  flex-direction: column;
  background: var(--saic-window-bg);
  border: 1px solid var(--saic-border);
  border-radius: 22px;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.24);
  overflow: hidden;
  margin-bottom: 14px;
}

.saic-chatbot-root.is-open .saic-chat-window {
  display: flex;
  animation: saic-pop 0.18s ease-out;
}

.saic-chatbot-root .saic-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--saic-primary);
  color: #fff;
}

.saic-chatbot-root .saic-chat-header strong {
  flex: 1;
  font-size: 15px;
}

.saic-chatbot-root .saic-close {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 30px;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border: 0;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  font-size: 18px !important;
  line-height: 1 !important;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
}

.saic-chatbot-root .saic-mini-icon,
.saic-chatbot-root .saic-floating-button {
  display: inline-grid;
  place-items: center;
}

.saic-chatbot-root .saic-mini-icon svg,
.saic-chatbot-root .saic-floating-button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.saic-chatbot-root .saic-mini-icon img,
.saic-chatbot-root .saic-floating-button img {
  display: block !important;
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

.saic-chatbot-root .saic-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--saic-window-bg) 94%, #f8fafc);
}

.saic-chatbot-root .saic-msg {
  width: fit-content;
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 16px;
  margin-bottom: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.saic-chatbot-root .saic-msg.bot {
  background: var(--saic-bot-bg);
  border-bottom-left-radius: 6px;
}

.saic-chatbot-root .saic-msg.user {
  margin-inline-start: auto;
  background: var(--saic-user-bg);
  color: var(--saic-user-text);
  border-bottom-right-radius: 6px;
}

.saic-chatbot-root[dir="rtl"] .saic-msg.bot {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 6px;
}

.saic-chatbot-root[dir="rtl"] .saic-msg.user {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 16px;
}

.saic-chatbot-root .saic-sources {
  margin-top: 10px;
  font-size: 12px;
}

.saic-chatbot-root .saic-sources ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
}

.saic-chatbot-root .saic-sources a {
  color: var(--saic-primary);
  text-decoration: underline;
}

.saic-chatbot-root .saic-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  min-height: 140px;
  margin: 12px 14px 6px;
  padding: 14px;
  border: 2px solid color-mix(in srgb, var(--saic-border) 42%, #111827);
  border-radius: 24px;
  background: #ffffff;
  direction: ltr;
}

.saic-chatbot-root .saic-chat-form textarea {
  resize: none;
  min-height: 92px;
  max-height: 130px;
  padding: 4px 0;
  border-radius: 0;
  border: 0;
  background: #ffffff !important;
  color: #111827 !important;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  direction: inherit;
  text-align: start;
}

.saic-chatbot-root[dir="rtl"] .saic-chat-form textarea {
  direction: rtl;
  text-align: right;
}

.saic-chatbot-root .saic-chat-form button,
.saic-chatbot-root .saic-fallback-form button {
  border: 0;
  border-radius: 16px;
  padding: 0 16px;
  min-height: 42px;
  background: var(--saic-send);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.saic-chatbot-root .saic-chat-form button {
  display: grid !important;
  place-items: center !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: var(--saic-primary);
}

.saic-chatbot-root .saic-chat-form button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.saic-chatbot-root button:disabled {
  cursor: wait !important;
  opacity: 0.65;
}

.saic-chatbot-root .saic-input-note {
  padding: 0 18px 18px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  background: var(--saic-window-bg);
}

.saic-chatbot-root .saic-floating-button {
  display: grid;
  width: 62px !important;
  height: 62px !important;
  min-width: 62px !important;
  min-height: 62px !important;
  max-width: 62px !important;
  max-height: 62px !important;
  border: 0;
  border-radius: 50% !important;
  background: var(--saic-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.25);
  animation: saic-pulse 2.4s infinite;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  padding: 0;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
}

.saic-chatbot-root.saic-bottom-right .saic-floating-button {
  margin-left: auto !important;
  margin-right: 0 !important;
}

.saic-chatbot-root.saic-bottom-left .saic-floating-button {
  margin-left: 0 !important;
  margin-right: auto !important;
}

.saic-chatbot-root.saic-bottom-full .saic-floating-button {
  width: 100%;
  height: 54px;
  border-radius: 16px;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.saic-chatbot-root .saic-floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.3);
}

.saic-chatbot-root.saic-corporate .saic-chat-window,
.saic-chatbot-root.saic-corporate .saic-chat-form textarea,
.saic-chatbot-root.saic-corporate .saic-chat-form button {
  border-radius: 8px;
}

.saic-chatbot-root.saic-minimal .saic-chat-window {
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.saic-chatbot-root.saic-mobile .saic-chat-window {
  width: min(520px, calc(100vw - 28px));
}

.saic-chatbot-root.saic-bottom-full.saic-mobile .saic-chat-window {
  width: calc(100vw - 24px);
  height: min(70vh, 620px);
  border-radius: 18px 18px 0 0;
}

.saic-chatbot-root.saic-glass .saic-chat-window {
  background: color-mix(in srgb, var(--saic-window-bg) 76%, transparent);
  backdrop-filter: blur(16px);
}

.saic-chatbot-root .saic-typing {
  min-width: 58px;
}

.saic-chatbot-root .saic-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-radius: 50%;
  background: #667085;
  animation: saic-dot 1s infinite ease-in-out;
}

.saic-chatbot-root .saic-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.saic-chatbot-root .saic-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.saic-chatbot-root .saic-fallback-form {
  display: grid;
  gap: 9px;
  background: var(--saic-bot-bg);
  border: 1px solid var(--saic-border);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 12px;
}

.saic-chatbot-root .saic-fallback-form p {
  margin: 0 0 4px;
}

.saic-chatbot-root .saic-fallback-form input,
.saic-chatbot-root .saic-fallback-form textarea {
  width: 100%;
  border: 1px solid var(--saic-border);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  box-sizing: border-box;
  background: #ffffff !important;
  color: #111827 !important;
  box-shadow: none !important;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.saic-chatbot-root .saic-fallback-form textarea {
  min-height: 74px;
  resize: vertical;
}

.saic-chatbot-root .saic-fallback-form.is-submitting {
  position: relative;
}

.saic-chatbot-root .saic-fallback-form.is-submitting input,
.saic-chatbot-root .saic-fallback-form.is-submitting textarea {
  opacity: 0.72;
}

.saic-chatbot-root .saic-fallback-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.saic-chatbot-root .saic-button-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: saic-spin 0.75s linear infinite;
}

.saic-chatbot-root .saic-hp {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
}

@keyframes saic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--saic-primary) 32%, transparent), 0 14px 34px rgba(15, 23, 42, 0.25); }
  50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--saic-primary) 0%, transparent), 0 14px 34px rgba(15, 23, 42, 0.25); }
}

@keyframes saic-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-5px); opacity: 1; }
}

@keyframes saic-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes saic-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .saic-chatbot-root {
    left: auto;
    right: 12px;
    bottom: 12px;
    width: fit-content;
    max-width: calc(100vw - 24px);
  }

  .saic-chatbot-root.saic-bottom-left {
    left: 12px;
    right: auto;
  }

  .saic-chatbot-root.saic-bottom-right {
    left: auto;
    right: 12px;
  }

  .saic-chatbot-root.saic-bottom-full {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  .saic-chatbot-root .saic-chat-window {
    width: calc(100vw - 24px);
    height: min(76vh, 620px);
  }
  .saic-chatbot-root .saic-floating-button {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
    border-radius: 50% !important;
  }

  .saic-chatbot-root.saic-bottom-full .saic-floating-button {
    width: 100% !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    max-width: none !important;
    border-radius: 16px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .saic-chatbot-root .saic-floating-button,
  .saic-chatbot-root .saic-typing span,
  .saic-chatbot-root.is-open .saic-chat-window {
    animation: none;
  }
}
