#white-studio-ai-chat,
#white-studio-ai-chat * {
  box-sizing: border-box;
}

#white-studio-ai-chat {
  --ws-ai-purple: #6f2bd3;
  --ws-ai-purple-dark: #5420ad;
  --ws-ai-ink: #1c1b20;
  --ws-ai-muted: #6f6c77;
  --ws-ai-border: rgba(35, 30, 45, 0.14);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  color: var(--ws-ai-ink);
  font-family: Montserrat, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.ws-ai-chat__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 68px;
  height: 58px;
  padding: 0 16px;
  border: 0;
  border-radius: 29px;
  color: #fff;
  background: linear-gradient(135deg, #8040e3, var(--ws-ai-purple));
  box-shadow: 0 14px 36px rgba(74, 28, 149, 0.34);
  cursor: pointer;
  font: 700 13px/1 Montserrat, Arial, sans-serif;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ws-ai-chat__toggle:hover,
.ws-ai-chat__toggle:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(74, 28, 149, 0.42);
}

.ws-ai-chat__toggle-mark,
.ws-ai-chat__brand {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.ws-ai-chat__toggle-mark {
  width: 27px;
  height: 27px;
}

.ws-ai-chat__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 110px));
  max-height: 740px;
  overflow: hidden;
  border: 1px solid var(--ws-ai-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 72px rgba(28, 20, 42, 0.28);
}

.ws-ai-chat__panel[hidden] {
  display: none;
}

.ws-ai-chat__header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 70px;
  padding: 13px 14px;
  color: #fff;
  background: linear-gradient(135deg, #7a36dc, #5f25c4);
}

.ws-ai-chat__brand {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
}

.ws-ai-chat__heading {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.ws-ai-chat__heading strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-ai-chat__heading span {
  margin-top: 2px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-ai-chat__close {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font: 300 28px/1 Arial, sans-serif;
}

.ws-ai-chat__close:hover,
.ws-ai-chat__close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.ws-ai-chat__messages {
  flex: 1 1 auto;
  min-height: 150px;
  padding: 18px 14px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f6f5f8;
}

.ws-ai-chat__message {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 11px;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(37, 28, 52, 0.06);
  font-size: 13px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ws-ai-chat__message--assistant {
  margin-right: auto;
  border: 1px solid rgba(35, 30, 45, 0.07);
  border-bottom-left-radius: 4px;
  background: #fff;
}

.ws-ai-chat__message--user {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  color: #fff;
  background: var(--ws-ai-purple);
}

.ws-ai-chat__message--typing {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ws-ai-muted);
}

.ws-ai-chat__typing-label {
  font-size: 11px;
}

.ws-ai-chat__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ws-ai-chat__typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ws-ai-purple);
  animation: ws-ai-typing 1s ease-in-out infinite;
}

.ws-ai-chat__typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.ws-ai-chat__typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes ws-ai-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ws-ai-chat__form {
  flex: 0 0 auto;
  padding: 12px 14px 10px;
  border-top: 1px solid var(--ws-ai-border);
  background: #fff;
}

.ws-ai-chat__fields {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
}

.ws-ai-chat__contact-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(111, 43, 211, 0.2);
  border-radius: 9px;
  color: var(--ws-ai-purple-dark);
  background: rgba(111, 43, 211, 0.06);
  cursor: pointer;
  font: 500 10px/1.25 Montserrat, Arial, sans-serif;
  text-align: left;
}

.ws-ai-chat__contact-summary[hidden] {
  display: none;
}

.ws-ai-chat__contact-summary [data-ws-contact-summary] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-ai-chat__contact-block--collapsed .ws-ai-chat__fields {
  display: none;
}

.ws-ai-chat__field {
  display: block;
  min-width: 0;
  margin: 0;
  color: var(--ws-ai-muted);
  font-size: 10px;
  line-height: 1.2;
}

.ws-ai-chat__field > span {
  display: block;
  margin: 0 0 4px;
}

.ws-ai-chat__field b {
  font: inherit;
  font-weight: 500;
}

.ws-ai-chat__field small {
  font: inherit;
  opacity: 0.78;
}

.ws-ai-chat__field input,
.ws-ai-chat__field textarea {
  display: block;
  width: 100%;
  margin: 0;
  border: 1px solid var(--ws-ai-border);
  border-radius: 9px;
  outline: none;
  color: var(--ws-ai-ink);
  background: #fff;
  font: 13px/1.35 Montserrat, Arial, sans-serif;
}

.ws-ai-chat__field input {
  height: 38px;
  padding: 8px 10px;
}

.ws-ai-chat__field textarea {
  min-height: 64px;
  max-height: 130px;
  padding: 10px;
  resize: vertical;
}

.ws-ai-chat__field input:focus,
.ws-ai-chat__field textarea:focus {
  border-color: var(--ws-ai-purple);
  box-shadow: 0 0 0 2px rgba(111, 43, 211, 0.12);
}

.ws-ai-chat__field--message {
  margin-top: 8px;
}

.ws-ai-chat__notice,
.ws-ai-chat__legal {
  margin: 7px 0;
  color: var(--ws-ai-muted);
  font-size: 9px;
  line-height: 1.35;
}

.ws-ai-chat__consent {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 7px 0 9px;
  color: #4d4a54;
  cursor: pointer;
  font-size: 9px;
  line-height: 1.36;
  text-align: left;
}

.ws-ai-chat__consent input {
  appearance: auto;
  flex: 0 0 15px;
  width: 15px !important;
  height: 15px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--ws-ai-purple);
}

.ws-ai-chat__consent a {
  color: var(--ws-ai-purple-dark);
  text-decoration: underline;
}

.ws-ai-chat__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ws-ai-chat__status {
  min-height: 16px;
  color: var(--ws-ai-muted);
  font-size: 10px;
}

.ws-ai-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 126px;
  min-height: 39px;
  padding: 9px 14px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: var(--ws-ai-purple);
  cursor: pointer;
  font: 700 12px/1 Montserrat, Arial, sans-serif;
}

.ws-ai-chat__send:hover,
.ws-ai-chat__send:focus-visible {
  background: var(--ws-ai-purple-dark);
}

.ws-ai-chat__send:disabled {
  cursor: wait;
  opacity: 0.58;
}

.ws-ai-chat__legal {
  margin-bottom: 0;
  text-align: center;
}

.ws-ai-chat__sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ws-ai-chat[dir="rtl"] .ws-ai-chat__heading,
.ws-ai-chat[dir="rtl"] .ws-ai-chat__field,
.ws-ai-chat[dir="rtl"] .ws-ai-chat__notice,
.ws-ai-chat[dir="rtl"] .ws-ai-chat__consent,
.ws-ai-chat[dir="rtl"] .ws-ai-chat__legal,
.ws-ai-chat[dir="rtl"] .ws-ai-chat__message {
  text-align: right;
}

.ws-ai-chat[dir="rtl"] .ws-ai-chat__send span[aria-hidden="true"] {
  transform: rotate(180deg);
}

@media (max-width: 520px) {
  #white-studio-ai-chat {
    right: 8px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .ws-ai-chat__toggle {
    min-width: 56px;
    width: 56px;
    height: 56px;
    padding: 0;
  }

  .ws-ai-chat__toggle-label {
    display: none;
  }

  .ws-ai-chat__panel {
    right: 0;
    bottom: 66px;
    width: calc(100vw - 16px);
    max-width: none;
    height: min(650px, calc(100dvh - 86px));
    max-height: none;
    border-radius: 16px;
  }

  .ws-ai-chat__messages {
    padding-top: 14px;
  }

  .ws-ai-chat__fields {
    grid-template-columns: 1fr;
  }

  .ws-ai-chat__field input {
    height: 36px;
  }

  .ws-ai-chat__field textarea {
    min-height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-ai-chat__toggle,
  .ws-ai-chat__typing-dots i {
    transition: none;
    animation: none;
  }
}
