/* Mahoney Digital site chat widget */
.md-chat-root {
  --md-ink: #0b1120;
  --md-brand: #0d9488;
  --md-brand-dark: #0f766e;
  --md-cream: #f8f6f1;
  font-family: Inter, system-ui, sans-serif;
  z-index: 9999;
}

.md-chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--md-brand-dark) 0%, var(--md-brand) 100%);
  color: #fff;
  box-shadow: 0 10px 25px -5px rgb(13 148 136 / 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.md-chat-fab:hover {
  transform: scale(1.05);
}

.md-chat-fab:focus-visible {
  outline: 2px solid var(--md-brand);
  outline-offset: 3px;
}

.md-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(520px, calc(100vh - 7rem));
  background: #fff;
  border: 1px solid #ebe8e1;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgb(11 17 32 / 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.md-chat-panel[hidden] {
  display: none !important;
}

.md-chat-header {
  background: var(--md-ink);
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.md-chat-header h2 {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.md-chat-header p {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  color: #94a3b8;
}

.md-chat-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  font-size: 1.1rem;
}

.md-chat-close:hover {
  color: #fff;
  background: rgb(255 255 255 / 0.08);
}

.md-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--md-cream);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-chat-bubble {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.md-chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #ebe8e1;
  color: #1e293b;
  border-bottom-left-radius: 0.25rem;
}

.md-chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--md-brand-dark), var(--md-brand));
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.md-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.5rem;
  background: var(--md-cream);
}

.md-chat-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f766e;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
}

.md-chat-chip:hover {
  border-color: var(--md-brand);
  background: rgb(13 148 136 / 0.08);
}

.md-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #ebe8e1;
  background: #fff;
}

.md-chat-form input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

.md-chat-form input:focus {
  border-color: var(--md-brand-dark);
  box-shadow: 0 0 0 2px rgb(13 148 136 / 0.15);
}

.md-chat-form button {
  border: none;
  border-radius: 0.75rem;
  padding: 0 0.9rem;
  background: linear-gradient(135deg, var(--md-brand-dark), var(--md-brand));
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}

.md-chat-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.md-chat-typing {
  font-size: 0.75rem;
  color: #64748b;
  padding: 0 0.25rem;
}

/* Above mobile sticky CTA bar */
@media (max-width: 767px) {
  body.has-mobile-cta .md-chat-fab {
    bottom: 5.25rem;
  }
  body.has-mobile-cta .md-chat-panel {
    bottom: 9.25rem;
    height: min(480px, calc(100vh - 11rem));
  }
}
