.moc-chatbot {
  --moc-chatbot-blue: #2563eb;
  --moc-chatbot-blue-dark: #1d4ed8;
  --moc-chatbot-ink: #1e2235;
  --moc-chatbot-muted: #aeb9cc;
  --moc-chatbot-border: #e1e6f9;
  --moc-chatbot-soft: #f5f5f5;
  --moc-chatbot-page: #cbe8c0;
  color: var(--moc-chatbot-ink);
  font-family: "Open Sans", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.moc-chatbot * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.moc-chatbot-launcher {
  align-items: center;
  background: #ffffff;
  border: 0;
  border-radius: 50%;
  bottom: 14px;
  box-shadow: 0 3px 18px rgba(0, 17, 119, 0.16);
  cursor: pointer;
  display: inline-flex;
  height: 54px;
  justify-content: center;
  padding: 0;
  position: fixed;
  right: 18px;
  width: 54px;
  z-index: 2147483000;
  animation: moc-chatbot-avatar-in 0.34s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.12s both;
  transform-origin: right bottom;
  transition: box-shadow 0.2s linear, transform 0.2s;
}

.moc-chatbot-launcher::after {
  background: #25d366;
  border: 2px solid #ffffff;
  border-radius: 50%;
  bottom: 1px;
  content: "";
  height: 13px;
  position: absolute;
  right: 1px;
  width: 13px;
  animation: moc-chatbot-online-pulse 1.8s ease-in-out 0.6s infinite;
}

.moc-chatbot-launcher:hover {
  transform: translateY(-1px);
}

.moc-chatbot-launcher img {
  border-radius: 50%;
  height: 50px;
  object-fit: cover;
  width: 50px;
}

.moc-chatbot-launcher span {
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.moc-chatbot-panel {
  background: #ffffff;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 6px 30px rgba(0, 17, 119, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: right bottom;
}

.moc-chatbot-panel.hidden,
.moc-chatbot-input-row.hidden {
  display: none;
}

.moc-chatbot-launcher:focus-visible,
.moc-chatbot-close:focus-visible,
.moc-chatbot-restart:focus-visible,
.moc-chatbot-option:focus-visible,
.moc-chatbot-send:focus-visible,
.moc-chatbot-input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.moc-chatbot-mode-launcher .moc-chatbot-panel {
  bottom: 86px;
  height: min(610px, calc(100vh - 108px));
  max-width: calc(100vw - 28px);
  position: fixed;
  right: 20px;
  width: 377px;
  z-index: 2147482999;
}

.moc-chatbot-mode-launcher .moc-chatbot-panel:not(.hidden):not(.moc-chatbot-preview) {
  animation: moc-chatbot-panel-in 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.moc-chatbot-mode-launcher .moc-chatbot-panel.moc-chatbot-preview {
  background: transparent;
  bottom: 84px;
  box-shadow: none;
  height: auto;
  max-height: calc(100vh - 110px);
  overflow: visible;
  right: 20px;
  width: 240px;
  animation: moc-chatbot-preview-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.18s both;
  transform-origin: right bottom;
}

.moc-chatbot-mode-embed {
  align-items: center;
  background: var(--moc-chatbot-page);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 448px);
  min-height: 600px;
  padding: 34px;
}

.moc-chatbot-mode-embed::before {
  color: #333333;
  content: "Let's chat";
  display: block;
  font-size: 24px;
  font-weight: 700;
  justify-self: center;
  line-height: 1.2;
}

.moc-chatbot-mode-embed .moc-chatbot-panel {
  align-self: center;
  height: min(560px, calc(100% - 8px));
  justify-self: center;
  max-width: 100%;
  position: relative;
  width: min(448px, 100%);
  animation: moc-chatbot-panel-in 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.moc-chatbot-header {
  align-items: center;
  background: transparent;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px 0;
  position: relative;
  z-index: 2;
}

.moc-chatbot-preview .moc-chatbot-header {
  display: none;
}

.moc-chatbot-avatar {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 17, 119, 0.08);
  height: 34px;
  object-fit: cover;
  width: 34px;
  animation: moc-chatbot-avatar-in 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.08s both;
  transform-origin: center;
}

.moc-chatbot-controls {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.moc-chatbot-restart,
.moc-chatbot-close {
  align-items: center;
  background: transparent;
  border: 0;
  color: #818999;
  cursor: pointer;
  display: inline-flex;
  font-size: 30px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
  transition: color 0.18s linear, transform 0.18s ease;
}

.moc-chatbot-restart {
  color: #7b8797;
  font-size: 27px;
}

.moc-chatbot-close:hover,
.moc-chatbot-restart:hover {
  color: #475467;
  transform: scale(1.08);
}

.moc-chatbot-messages {
  background: #ffffff;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 27px 14px 52px;
}

.moc-chatbot-preview .moc-chatbot-messages {
  background: transparent;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 110px);
  overflow: visible;
  padding: 0;
}

.moc-chatbot-message {
  display: flex;
  flex-direction: column;
  margin: 0 0 10px;
  animation: moc-chatbot-message-in 0.24s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.moc-chatbot-message-user {
  align-items: flex-end;
}

.moc-chatbot-bubble {
  border-radius: 0 0 18px 18px;
  color: #445465;
  font-size: 16px;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 11px 16px 12px;
}

.moc-chatbot-message-bot .moc-chatbot-bubble {
  background: var(--moc-chatbot-soft);
  color: #445465;
}

.moc-chatbot-message-user .moc-chatbot-bubble {
  background: #ffffff;
  border: 1px solid var(--moc-chatbot-border);
  border-radius: 1.3em;
  color: var(--moc-chatbot-ink);
  font-size: 14px;
  padding: 8px 14px;
}

.moc-chatbot-preview .moc-chatbot-message-bot .moc-chatbot-bubble {
  background: #ffffff;
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px var(--moc-chatbot-border),
    0 2px 4px rgba(0, 17, 119, 0.02),
    0 4px 15px rgba(0, 17, 119, 0.02);
  color: var(--moc-chatbot-ink);
  padding: 16px;
  animation: moc-chatbot-preview-in 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.22s both;
  transform-origin: right bottom;
}

.moc-chatbot-preview .moc-chatbot-message-user,
.moc-chatbot-preview .moc-chatbot-message-user .moc-chatbot-bubble {
  display: none;
}

.moc-chatbot-image-node {
  display: block;
  height: auto;
  margin: 0 0 10px;
  max-width: 100%;
  width: 100%;
}

.moc-chatbot-bubble p {
  margin: 0 0 4px;
}

.moc-chatbot-bubble p:last-child,
.moc-chatbot-bubble ul:last-child {
  margin-bottom: 0;
}

.moc-chatbot-bubble ul {
  margin: 8px 0;
  padding-left: 20px;
}

.moc-chatbot-bubble li {
  margin: 4px 0;
}

.moc-chatbot-time {
  color: var(--moc-chatbot-muted);
  font-size: 12px;
  line-height: 1.2;
  margin: 6px 0 0;
}

.moc-chatbot-preview .moc-chatbot-time {
  display: none;
}

.moc-chatbot-message-user .moc-chatbot-time {
  text-align: right;
}

.moc-chatbot-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 3px 0 12px;
}

.moc-chatbot-preview .moc-chatbot-options {
  align-items: flex-end;
  gap: 8px;
  margin: 5px 0 0;
}

.moc-chatbot-option {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--moc-chatbot-blue);
  border-radius: 1.3em;
  box-shadow:
    inset 0 0 0 1px transparent,
    0 2px 4px rgba(0, 17, 119, 0.02),
    0 4px 15px rgba(0, 17, 119, 0.02);
  color: var(--moc-chatbot-blue);
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  font-weight: 400;
  line-height: 20px;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 15px 8px 32px;
  position: relative;
  text-align: left;
  text-decoration: none;
  animation: moc-chatbot-option-in 0.24s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--moc-option-delay, 120ms) both;
  transform-origin: right center;
  transition: background 0.2s linear, box-shadow 0.2s linear, transform 0.2s;
  white-space: normal;
  width: fit-content;
}

.moc-chatbot-option::before {
  background-color: #e1e1e1;
  border-radius: 50%;
  content: "";
  height: 12px;
  left: 12px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: background 0.2s linear;
  width: 12px;
  animation: moc-chatbot-dot-in 0.22s ease-out var(--moc-dot-delay, 200ms) both;
}

.moc-chatbot-option:hover {
  box-shadow:
    inset 0 0 0 1px transparent,
    0 2px 4px rgba(0, 17, 119, 0.14),
    0 6px 10px rgba(0, 17, 119, 0.02);
  transform: translateY(-1px);
}

.moc-chatbot-option:hover::before {
  background-color: var(--moc-chatbot-blue);
}

.moc-chatbot-link {
  color: var(--moc-chatbot-blue);
}

.moc-chatbot-input-row {
  align-items: center;
  background: #ffffff;
  border-top: 1px solid var(--moc-chatbot-border);
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 11px;
  animation: moc-chatbot-input-in 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.moc-chatbot-input {
  border: 1px solid var(--moc-chatbot-border);
  border-radius: 8px;
  color: var(--moc-chatbot-ink);
  flex: 1 1 auto;
  font-size: 14px;
  min-width: 0;
  padding: 10px 11px;
}

.moc-chatbot-send {
  background: var(--moc-chatbot-blue);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 14px;
}

.moc-chatbot-send:hover {
  background: var(--moc-chatbot-blue-dark);
}

/* Links inside AI replies must read as clickable — the booking link is the
   main call to action in that mode. */
.moc-chatbot-bubble a {
  color: var(--moc-chatbot-blue);
  font-weight: 600;
  text-decoration: underline;
  word-break: break-word;
}

.moc-chatbot-bubble a:hover {
  color: var(--moc-chatbot-blue-dark);
}

/* ---- Voice controls + AI typing indicator ---- */

.moc-chatbot-mic,
.moc-chatbot-speaker {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--moc-chatbot-border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  font-size: 16px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.moc-chatbot-mic:hover,
.moc-chatbot-speaker:hover {
  background: #e2e8f0;
}

.moc-chatbot-mic.hidden,
.moc-chatbot-speaker.hidden {
  display: none;
}

.moc-chatbot-mic:focus-visible,
.moc-chatbot-speaker:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.moc-chatbot-mic-active {
  animation: moc-chatbot-mic-pulse 1.4s ease-in-out infinite;
  background: #fee2e2;
  border-color: #fca5a5;
}

@keyframes moc-chatbot-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.moc-chatbot-typing .moc-chatbot-bubble {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}

.moc-chatbot-typing .moc-chatbot-bubble span {
  animation: moc-chatbot-typing-bounce 1.1s ease-in-out infinite;
  background: #94a3b8;
  border-radius: 50%;
  display: block;
  height: 7px;
  width: 7px;
}

.moc-chatbot-typing .moc-chatbot-bubble span:nth-child(2) { animation-delay: 0.15s; }
.moc-chatbot-typing .moc-chatbot-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes moc-chatbot-typing-bounce {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.moc-chatbot-error {
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  animation: moc-chatbot-message-in 0.18s ease-out both;
}

@keyframes moc-chatbot-preview-in {
  0% {
    opacity: 0;
    transform: translateY(4%) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes moc-chatbot-panel-in {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes moc-chatbot-message-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes moc-chatbot-option-in {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes moc-chatbot-dot-in {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.6);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes moc-chatbot-avatar-in {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.88);
  }
  80% {
    opacity: 1;
    transform: translateY(0) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes moc-chatbot-online-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(37, 211, 102, 0);
  }
}

@keyframes moc-chatbot-input-in {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .moc-chatbot *,
  .moc-chatbot *::before,
  .moc-chatbot *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 760px) {
  .moc-chatbot-mode-embed {
    display: block;
    min-height: 620px;
    padding: 24px 12px;
  }

  .moc-chatbot-mode-embed::before {
    margin: 8px 0 20px;
    text-align: center;
  }

  .moc-chatbot-mode-embed .moc-chatbot-panel {
    height: 520px;
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .moc-chatbot-mode-launcher .moc-chatbot-panel {
    bottom: 80px;
    height: min(620px, calc(100vh - 96px));
    max-width: calc(100vw - 20px);
    right: 10px;
    width: calc(100vw - 20px);
  }

  /* Phones: the open chat takes the full screen so the on-screen keyboard
     cannot bury the composer. dvh tracks the collapsing browser chrome. */
  .moc-chatbot-mode-launcher .moc-chatbot-panel:not(.hidden):not(.moc-chatbot-preview) {
    border-radius: 0;
    bottom: 0;
    height: 100dvh;
    left: 0;
    max-height: 100dvh;
    max-width: 100vw;
    right: 0;
    top: 0;
    width: 100vw;
  }

  .moc-chatbot-mode-launcher .moc-chatbot-panel:not(.hidden):not(.moc-chatbot-preview) .moc-chatbot-header {
    padding-top: max(11px, env(safe-area-inset-top));
  }

  .moc-chatbot-mode-launcher .moc-chatbot-panel:not(.hidden):not(.moc-chatbot-preview) .moc-chatbot-input-row {
    padding-bottom: max(11px, env(safe-area-inset-bottom));
  }

  /* The full-screen panel already owns the viewport — a floating launcher on
     top of it would intercept taps meant for the composer. */
  .moc-chatbot-expanded .moc-chatbot-launcher {
    display: none;
  }

  .moc-chatbot-messages {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* 16px stops iOS Safari from zooming the page when the field takes focus. */
  .moc-chatbot-input {
    font-size: 16px;
  }

  .moc-chatbot-close,
  .moc-chatbot-restart,
  .moc-chatbot-mic,
  .moc-chatbot-speaker,
  .moc-chatbot-send {
    min-height: 44px;
    min-width: 44px;
  }

  .moc-chatbot-mode-launcher .moc-chatbot-panel.moc-chatbot-preview {
    bottom: 78px;
    right: 16px;
    width: min(240px, calc(100vw - 32px));
  }

  .moc-chatbot-launcher {
    bottom: 14px;
    right: 16px;
  }

  .moc-chatbot-messages {
    padding-left: 24px;
    padding-right: 24px;
  }

  .moc-chatbot-option {
    font-size: 15px;
    max-width: 100%;
  }
}
