/* ==========================================================================
   MMHX Surgical — Website Chat Assistant
   Design tokens grounded in the brand: clinical trust, steel + teal,
   warm amber for action. Not a generic SaaS-card chat bubble.
   ========================================================================== */

#mmhx-chat-root {
  --mmhx-navy: #0e3b43;
  --mmhx-navy-ink: #0a2b31;
  --mmhx-teal: #1b6e77;
  --mmhx-teal-light: #e3f0ef;
  --mmhx-amber: #dc9a3a;
  --mmhx-amber-ink: #8a5c14;
  --mmhx-bg: #f5f8f7;
  --mmhx-surface: #ffffff;
  --mmhx-ink: #16262a;
  --mmhx-muted: #6c7d80;
  --mmhx-border: #d9e3e2;
  --mmhx-radius: 14px;
  --mmhx-shadow: 0 18px 40px -18px rgba(14, 59, 67, 0.35);
  font-family: "Manrope", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: fixed;
  z-index: 999999;
  bottom: 22px;
  right: 22px;
  color: var(--mmhx-ink);
}

#mmhx-chat-root * { box-sizing: border-box; }

/* ---------- Launcher ---------- */
.mmhx-launcher {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(155deg, var(--mmhx-navy) 0%, var(--mmhx-teal) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--mmhx-shadow);
  transition: transform 0.18s ease;
}
.mmhx-launcher:hover { transform: translateY(-2px); }
.mmhx-launcher svg { width: 26px; height: 26px; }
.mmhx-launcher .mmhx-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--mmhx-amber);
  border: 2px solid var(--mmhx-bg);
}

/* ---------- Panel ---------- */
.mmhx-panel {
  position: absolute;
  bottom: 78px;
  right: 0;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--mmhx-bg);
  border-radius: 20px;
  box-shadow: var(--mmhx-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  border: 1px solid var(--mmhx-border);
}
.mmhx-panel.mmhx-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.mmhx-header {
  background: linear-gradient(155deg, var(--mmhx-navy) 0%, var(--mmhx-navy-ink) 100%);
  color: #fff;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.mmhx-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--mmhx-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--mmhx-navy-ink);
  flex-shrink: 0;
}
.mmhx-header-text { flex: 1; min-width: 0; }
.mmhx-header-text .mmhx-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.mmhx-header-text .mmhx-status {
  font-size: 12px;
  color: #bcd8d4;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.mmhx-header-text .mmhx-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #52d17c;
  display: inline-block;
}
.mmhx-close {
  background: rgba(255,255,255,0.12);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mmhx-close:hover { background: rgba(255,255,255,0.22); }

/* ---------- Messages ---------- */
.mmhx-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mmhx-row { display: flex; }
.mmhx-row.mmhx-bot { justify-content: flex-start; }
.mmhx-row.mmhx-user { justify-content: flex-end; }

.mmhx-bubble {
  max-width: 82%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.45;
  border-radius: var(--mmhx-radius);
}
.mmhx-bot .mmhx-bubble {
  background: var(--mmhx-surface);
  border: 1px solid var(--mmhx-border);
  border-top-left-radius: 4px;
  color: var(--mmhx-ink);
}
.mmhx-user .mmhx-bubble {
  background: var(--mmhx-teal);
  color: #fff;
  border-top-right-radius: 4px;
}

.mmhx-typing { display: flex; gap: 4px; padding: 4px 2px; }
.mmhx-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mmhx-muted);
  animation: mmhx-bounce 1.1s infinite ease-in-out;
}
.mmhx-typing span:nth-child(2) { animation-delay: 0.15s; }
.mmhx-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mmhx-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Quick replies */
.mmhx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
  padding-left: 2px;
}
.mmhx-chip {
  border: 1px solid var(--mmhx-teal);
  color: var(--mmhx-teal);
  background: var(--mmhx-teal-light);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mmhx-chip:hover { background: #cfe6e4; }
.mmhx-chip.mmhx-chip-amber {
  border-color: var(--mmhx-amber);
  color: var(--mmhx-amber-ink);
  background: #fbeed9;
}
.mmhx-chip.mmhx-chip-amber:hover { background: #f5e0b8; }

/* Inline field error */
.mmhx-field-error {
  font-size: 12px;
  color: #b5432f;
  padding-left: 2px;
}

/* ---------- Footer / input ---------- */
.mmhx-footer {
  border-top: 1px solid var(--mmhx-border);
  background: var(--mmhx-surface);
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.mmhx-input {
  flex: 1;
  border: 1px solid var(--mmhx-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: var(--mmhx-bg);
  color: var(--mmhx-ink);
}
.mmhx-input:focus { border-color: var(--mmhx-teal); }
.mmhx-send {
  width: 40px;
  border-radius: 10px;
  border: none;
  background: var(--mmhx-navy);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mmhx-send:hover { background: var(--mmhx-navy-ink); }
.mmhx-send:disabled { opacity: 0.5; cursor: not-allowed; }

.mmhx-footer-note {
  font-size: 10.5px;
  color: var(--mmhx-muted);
  text-align: center;
  padding: 5px 0 2px;
  background: var(--mmhx-surface);
  flex-shrink: 0;
}

@media (max-width: 420px) {
  #mmhx-chat-root { right: 12px; bottom: 12px; }
  .mmhx-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); }
}
