@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

.studio-chatbot-root {
  position: fixed;
  bottom: 20px;
  z-index: 99999;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.studio-chatbot-right {
  right: 20px;
}

.studio-chatbot-left {
  left: 20px;
}

.studio-chatbot-fab {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--studio-chatbot-primary, #af3700), #ff8e5e);
  color: #fff;
  box-shadow: 0 18px 40px rgba(175, 55, 0, 0.28);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  font-size: 19px;
  font-weight: 700;
  overflow: hidden;
}

.studio-chatbot-root.is-dragging .studio-chatbot-fab {
  cursor: grabbing;
}

.studio-chatbot-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-chatbot-panel {
  position: absolute;
  bottom: 76px;
  left: 0;
  width: min(380px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 116px));
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f8fafc;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 220ms ease;
  overscroll-behavior: contain;
}

.studio-chatbot-panel.has-booking-form .studio-chatbot-messages,
.studio-chatbot-panel.has-booking-form .studio-chatbot-input,
.studio-chatbot-panel.has-dynamic-form .studio-chatbot-messages,
.studio-chatbot-panel.has-dynamic-form .studio-chatbot-input {
  display: none;
}

.studio-chatbot-right .studio-chatbot-panel {
  left: auto;
  right: 20px;
  transform-origin: bottom right;
}

.studio-chatbot-left .studio-chatbot-panel {
  left: 0;
  right: auto;
  transform-origin: bottom left;
}

@media (max-width: 640px) {
  .studio-chatbot-panel {
    bottom: 76px;
    width: min(380px, calc(100vw - 28px));
    height: min(640px, calc(100vh - 116px));
    border-radius: 24px;
  }

  .studio-chatbot-right .studio-chatbot-panel {
    left: auto;
    right: 0 !important;
  }

  .studio-chatbot-left .studio-chatbot-panel {
    left: 0 !important;
    right: auto !important;
  }
}

.studio-chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.studio-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(16px);
}

.studio-chatbot-panel {
  --studio-chatbot-header-height: 75px;
}

.studio-chatbot-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.studio-chatbot-header-copy {
  min-width: 0;
}

.studio-chatbot-header-copy strong,
.studio-chatbot-header-copy p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-chatbot-header-copy strong {
  font-size: 14px;
}

.studio-chatbot-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
}

.studio-chatbot-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: #22c55e;
  vertical-align: middle;
}

.studio-chatbot-close {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.studio-chatbot-close:hover,
.studio-chatbot-close-form:hover {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
}

.studio-chatbot-close:active,
.studio-chatbot-close-form:active {
  transform: scale(0.96);
}

.studio-chatbot-close span,
.studio-chatbot-close-form span {
  position: absolute;
  inset: 0;
}

.studio-chatbot-close span::before,
.studio-chatbot-close span::after,
.studio-chatbot-close-form span::before,
.studio-chatbot-close-form span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.studio-chatbot-close span::before,
.studio-chatbot-close-form span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.studio-chatbot-close span::after,
.studio-chatbot-close-form span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.studio-chatbot-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--studio-chatbot-primary, #af3700), #ffb38f);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 700;
  color: #fff;
}

.studio-chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-chatbot-messages {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow: auto;
  background:
    radial-gradient(circle at top right, rgba(255, 142, 94, 0.08), transparent 28%),
    #f8fafc;
}

.studio-chatbot-message {
  max-width: 88%;
  font-size: 13px;
  line-height: 1.55;
}

.studio-chatbot-message > div:first-child {
  padding: 12px 14px;
  border-radius: 18px;
}

.studio-chatbot-message.bot > div:first-child {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 6px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
}

.studio-chatbot-message > div:first-child a {
  color: #0f766e;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.studio-chatbot-message.user > div:first-child a {
  color: #fff;
}

.studio-chatbot-message.user {
  align-self: flex-end;
}

.studio-chatbot-message.user > div:first-child {
  background: linear-gradient(135deg, var(--studio-chatbot-primary, #af3700), #ff8e5e);
  color: #fff;
  border-top-right-radius: 6px;
  box-shadow: 0 12px 24px rgba(175, 55, 0, 0.18);
}

.studio-chatbot-message-pending > div:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.studio-chatbot-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.studio-chatbot-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #94a3b8;
  animation: studio-chatbot-typing 1.1s infinite ease-in-out;
}

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

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

.studio-chatbot-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  max-width: 100%;
}

.studio-chatbot-buttons button {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  border: 1px solid #fed7c7;
  background: #fff4ef;
  color: #9a3412;
  border-radius: 14px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

.studio-chatbot-submit-booking,
.studio-chatbot-submit-dynamic-form,
.studio-chatbot-input button {
  border: none;
  background: linear-gradient(135deg, var(--studio-chatbot-primary, #af3700), #ff8e5e);
  color: #fff;
  border-radius: 14px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 12px 22px rgba(175, 55, 0, 0.16);
}

.studio-chatbot-root.is-waiting .studio-chatbot-input button,
.studio-chatbot-root.is-waiting .studio-chatbot-input input {
  opacity: 0.72;
}

.studio-chatbot-input button:disabled,
.studio-chatbot-input input:disabled {
  cursor: wait;
}

.studio-chatbot-booking,
.studio-chatbot-dynamic-form {
  position: absolute;
  top: var(--studio-chatbot-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  box-sizing: border-box;
  padding: 14px 16px 16px;
  background: rgba(255, 255, 255, 0.94);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 2;
}

.studio-chatbot-booking:not([hidden]),
.studio-chatbot-dynamic-form:not([hidden]) {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.studio-chatbot-form-header,
.studio-chatbot-dynamic-form-copy-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.studio-chatbot-form-header strong {
  font-size: 14px;
  color: #0f172a;
}

.studio-chatbot-booking {
  gap: 8px;
}

.studio-chatbot-booking textarea {
  min-height: 120px;
  height: 120px;
  resize: vertical;
}

.studio-chatbot-dynamic-form textarea {
  min-height: 96px;
}

.studio-chatbot-dynamic-form {
  gap: 12px;
}

.studio-chatbot-dynamic-form-inner {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.studio-chatbot-dynamic-form-fields {
  display: grid;
  gap: 8px;
  align-content: start;
}

.studio-chatbot-dynamic-form-copy {
  display: grid;
  gap: 4px;
}

.studio-chatbot-dynamic-form-copy strong {
  font-size: 14px;
  color: #0f172a;
}

.studio-chatbot-dynamic-form-copy p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}

.studio-chatbot-dynamic-field {
  display: grid;
  gap: 6px;
}

.studio-chatbot-dynamic-field label {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.studio-chatbot-booking input,
.studio-chatbot-booking textarea,
.studio-chatbot-dynamic-form input,
.studio-chatbot-dynamic-form textarea,
.studio-chatbot-dynamic-form select,
.studio-chatbot-input input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  box-shadow: none;
}

.studio-chatbot-booking input::placeholder,
.studio-chatbot-booking textarea::placeholder,
.studio-chatbot-dynamic-form input::placeholder,
.studio-chatbot-dynamic-form textarea::placeholder,
.studio-chatbot-input input::placeholder {
  color: #94a3b8;
}

.studio-chatbot-booking input:focus,
.studio-chatbot-booking textarea:focus,
.studio-chatbot-dynamic-form input:focus,
.studio-chatbot-dynamic-form textarea:focus,
.studio-chatbot-dynamic-form select:focus,
.studio-chatbot-input input:focus {
  outline: none;
  border-color: rgba(175, 55, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(175, 55, 0, 0.12);
}

.studio-chatbot-submit-dynamic-form {
  margin-top: 2px;
}

.studio-chatbot-close-form {
  position: relative;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
}

.studio-chatbot-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
}

@keyframes studio-chatbot-typing {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .studio-chatbot-root[data-mobile="0"] {
    display: none;
  }

  .studio-chatbot-root {
    bottom: 14px;
  }

  .studio-chatbot-right {
    left: auto;
    right: 14px;
  }

  .studio-chatbot-left {
    left: 14px;
    right: auto;
  }

  .studio-chatbot-fab {
    width: 56px;
    height: 56px;
  }

  .studio-chatbot-panel {
    width: calc(100vw - 28px);
    height: min(82vh, 640px);
    max-height: calc(100dvh - 84px);
    bottom: 68px;
  }

  .studio-chatbot-right .studio-chatbot-panel {
    left: auto;
    right: 0;
  }

  .studio-chatbot-left .studio-chatbot-panel {
    left: 0;
    right: auto;
  }

  .studio-chatbot-header {
    padding: 14px;
  }

  .studio-chatbot-messages {
    padding: 12px;
    gap: 8px;
  }

  .studio-chatbot-message {
    max-width: 92%;
  }

  .studio-chatbot-message > div:first-child {
    padding: 11px 12px;
  }

  .studio-chatbot-booking,
  .studio-chatbot-dynamic-form {
    padding: 12px;
    gap: 8px;
    height: auto;
    max-height: none;
  }

  .studio-chatbot-form-header,
  .studio-chatbot-dynamic-form-copy-wrap {
    margin-bottom: 8px;
  }

  .studio-chatbot-booking input,
  .studio-chatbot-booking textarea,
  .studio-chatbot-dynamic-form input,
  .studio-chatbot-dynamic-form textarea,
  .studio-chatbot-dynamic-form select,
  .studio-chatbot-input input {
    min-height: 42px;
    padding: 10px 11px;
    font-size: 16px;
  }

  .studio-chatbot-booking textarea {
    min-height: 140px;
    height: 140px;
  }

  .studio-chatbot-dynamic-form textarea {
    min-height: 96px;
  }

  .studio-chatbot-submit-booking,
  .studio-chatbot-submit-dynamic-form {
    width: 100%;
    min-height: 42px;
  }

  .studio-chatbot-input {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .studio-chatbot-input button {
    width: 100%;
    min-height: 42px;
  }

  .studio-chatbot-buttons {
    gap: 8px;
  }

  .studio-chatbot-buttons button {
    padding: 7px 10px;
    font-size: 11px;
  }
}
