/* Leads Merchant guided chat widget — matches site colors (Inter / Poppins, #2563eb) */
#lm-chat-root {
  --lm-blue: #2563eb;
  --lm-blue-hover: #1d4ed8;
  --lm-blue-soft: #eff6ff;
  --lm-text: #1e293b;
  --lm-muted: #475569;
  --lm-line: #e2e8f0;
  --lm-bg: #ffffff;
  --lm-bot-bg: #f1f5f9;
  --lm-radius: 16px;
  --lm-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --lm-head: Poppins, Inter, system-ui, sans-serif;
  position: fixed;
  z-index: 2147483646;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  font-family: var(--lm-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--lm-text);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
#lm-chat-root *,
#lm-chat-root *::before,
#lm-chat-root *::after {
  box-sizing: border-box;
}

/* Launcher */
#lm-chat-root .lm-launcher {
  position: relative;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lm-blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
#lm-chat-root .lm-launcher:hover {
  background: var(--lm-blue-hover);
  transform: translateY(-1px);
}
#lm-chat-root .lm-launcher:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 3px;
}
#lm-chat-root .lm-launcher[aria-expanded="true"] {
  display: none;
}
#lm-chat-root .lm-launcher svg {
  width: 26px;
  height: 26px;
  display: block;
}

/* Panel */
#lm-chat-root .lm-panel {
  display: none;
  position: relative;
  z-index: 2147483646;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  background: var(--lm-bg);
  border-radius: var(--lm-radius);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  border: 1px solid var(--lm-line);
}
#lm-chat-root.lm-open .lm-panel {
  display: flex;
}
#lm-chat-root .lm-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--lm-blue);
  color: #fff;
  padding: 12px 12px 12px 16px;
}
#lm-chat-root .lm-header-text {
  flex: 1 1 auto;
  min-width: 0;
}
#lm-chat-root .lm-title {
  margin: 0;
  font-family: var(--lm-head);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: #fff;
}
#lm-chat-root .lm-subtitle {
  margin: 1px 0 0;
  font-size: 12px;
  opacity: 0.9;
  font-weight: 400;
}
#lm-chat-root .lm-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lm-chat-root .lm-close:hover,
#lm-chat-root .lm-close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}
#lm-chat-root .lm-close:focus-visible {
  box-shadow: 0 0 0 2px #fff;
}
#lm-chat-root .lm-close svg {
  width: 20px;
  height: 20px;
}

/* Transcript */
#lm-chat-root .lm-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: #fff;
  scroll-behavior: smooth;
}
#lm-chat-root .lm-msg {
  display: flex;
  margin: 0 0 10px;
  max-width: 92%;
}
#lm-chat-root .lm-msg--bot {
  align-self: flex-start;
  margin-right: auto;
}
#lm-chat-root .lm-msg--user {
  align-self: flex-end;
  margin-left: auto;
  justify-content: flex-end;
}
#lm-chat-root .lm-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#lm-chat-root .lm-msg--bot .lm-bubble {
  background: var(--lm-bot-bg);
  color: var(--lm-text);
  border-bottom-left-radius: 4px;
}
#lm-chat-root .lm-msg--user .lm-bubble {
  background: var(--lm-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Choices */
#lm-chat-root .lm-choices {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 14px 14px;
  background: #fff;
  border-top: 1px solid var(--lm-line);
}
#lm-chat-root .lm-choices:empty {
  display: none;
}
#lm-chat-root .lm-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: 2px solid var(--lm-blue);
  border-radius: 50px;
  background: #fff;
  color: var(--lm-blue);
  font-family: var(--lm-head);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#lm-chat-root .lm-choice:hover,
#lm-chat-root .lm-choice:focus-visible {
  background: var(--lm-blue);
  color: #fff;
  outline: none;
}
#lm-chat-root .lm-choice:focus-visible {
  box-shadow: 0 0 0 3px #bfdbfe;
}
#lm-chat-root .lm-choice:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Form */
#lm-chat-root .lm-form-wrap {
  flex: 0 0 auto;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--lm-line);
  background: #fff;
  max-height: 62%;
  overflow-y: auto;
}
#lm-chat-root .lm-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#lm-chat-root .lm-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#lm-chat-root .lm-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--lm-text);
}
#lm-chat-root .lm-optional {
  font-weight: 400;
  color: var(--lm-muted);
}
#lm-chat-root .lm-form input[type="text"],
#lm-chat-root .lm-form input[type="email"],
#lm-chat-root .lm-form input[type="tel"],
#lm-chat-root .lm-form select,
#lm-chat-root .lm-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: var(--lm-font);
  font-size: 16px; /* prevents iOS zoom */
  color: var(--lm-text);
  background: #fff;
  appearance: none;
}
#lm-chat-root .lm-form textarea {
  min-height: 56px;
  resize: vertical;
  line-height: 1.4;
}
#lm-chat-root .lm-form input:focus-visible,
#lm-chat-root .lm-form select:focus-visible,
#lm-chat-root .lm-form textarea:focus-visible {
  outline: 2px solid var(--lm-blue);
  outline-offset: 1px;
  border-color: var(--lm-blue);
}
#lm-chat-root .lm-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--lm-muted);
  line-height: 1.4;
}
#lm-chat-root .lm-consent input {
  margin-top: 3px;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--lm-blue);
}
#lm-chat-root .lm-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#lm-chat-root .lm-error {
  color: #b91c1c;
  font-size: 12px;
  margin: 0;
}
#lm-chat-root .lm-submit {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 50px;
  background: var(--lm-blue);
  color: #fff;
  font-family: var(--lm-head);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
#lm-chat-root .lm-submit:hover,
#lm-chat-root .lm-submit:focus-visible {
  background: var(--lm-blue-hover);
  outline: none;
}
#lm-chat-root .lm-submit:focus-visible {
  box-shadow: 0 0 0 3px #bfdbfe;
}
#lm-chat-root .lm-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 480px) {
  #lm-chat-root {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  #lm-chat-root .lm-panel {
    width: calc(100vw - 20px);
    height: min(640px, calc(100dvh - 20px - env(safe-area-inset-bottom, 0px)));
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #lm-chat-root .lm-launcher,
  #lm-chat-root .lm-choice,
  #lm-chat-root .lm-log {
    transition: none;
    scroll-behavior: auto;
  }
  #lm-chat-root .lm-launcher:hover {
    transform: none;
  }
}
