/* Shared public chat widget. Brand color is --mh-brand, set from tenant config. */

.mh-chat-root {
  --mh-ink: #1a1a1a;
  --mh-soft: #4a5459;
  --mh-brand: #333333;
  --mh-paper: #ffffff;
  --mh-tint: #f4f6f6;
  --mh-line: #d0d5d4;
  --mh-crisis: #7a1f1f;
  --mh-crisis-bg: #f8ecec;
  font-family: Lora, Georgia, "Times New Roman", serif;
  color: var(--mh-ink);
}

.mh-chat-fab {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40;
  border: 0; border-radius: 62.5rem; padding: 1rem 1.5rem;
  background: var(--mh-brand); color: #fff; font: inherit; font-weight: 600;
  font-family: "Source Sans 3", system-ui, sans-serif; cursor: pointer;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.25);
}
.mh-chat-fab:hover { filter: brightness(0.92); }
.mh-chat-fab:focus-visible { outline: 2px solid var(--mh-brand); outline-offset: 2px; }

.mh-chat-panel {
  position: fixed; right: 1.5rem; bottom: 4.5rem; z-index: 41;
  width: min(24rem, calc(100vw - 1.5rem));
  max-height: min(36rem, calc(100vh - 6rem));
  display: flex; flex-direction: column;
  background: var(--mh-paper); border: 1px solid var(--mh-line);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(26, 26, 26, 0.18);
}
.mh-chat-panel[hidden] { display: none !important; }

.mh-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem;
  background: var(--mh-tint); border-bottom: 1px solid var(--mh-line);
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.mh-chat-header strong { font-size: 0.95rem; color: var(--mh-brand); }
.mh-chat-header button {
  border: 0; background: transparent; color: var(--mh-soft);
  font-size: 1.25rem; line-height: 1; cursor: pointer;
}

.mh-chat-body {
  flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: 1rem;
  background: var(--mh-tint);
}

.mh-chat-msg {
  max-width: 92%; padding: 0.5rem 1rem; border-radius: 8px;
  font-size: 0.95rem; line-height: 1.45; white-space: pre-wrap;
}
.mh-chat-msg.agent {
  align-self: flex-start; background: #fff; border: 1px solid var(--mh-line);
}
.mh-chat-msg.patient {
  align-self: flex-end;
  background: color-mix(in srgb, var(--mh-brand) 12%, transparent);
}

.mh-chat-chips {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem;
}
.mh-chat-chips button {
  text-align: left; border: 2px solid var(--mh-brand); background: #fff;
  color: var(--mh-brand); border-radius: 8px; padding: 0.5rem 1rem;
  font: inherit; font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.mh-chat-chips button:hover {
  background: color-mix(in srgb, var(--mh-brand) 8%, #fff);
}

.mh-chat-form {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 0.5rem 0; font-family: "Source Sans 3", system-ui, sans-serif;
}
.mh-chat-form label {
  font-size: 0.875rem; font-weight: 600; color: var(--mh-soft);
}
.mh-chat-form input {
  border: 1px solid var(--mh-soft); border-radius: 2px;
  padding: 0.5rem 1rem; font: inherit; font-size: 1rem;
  background: #fff; color: var(--mh-ink);
}
.mh-chat-form input:focus-visible {
  outline: 2px solid var(--mh-brand); outline-offset: 1px; border-color: var(--mh-brand);
}
.mh-chat-form .actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.mh-chat-form .actions button {
  border: 0; border-radius: 62.5rem; padding: 0.5rem 1rem;
  font: inherit; font-weight: 600; cursor: pointer;
}
.mh-chat-form .primary { background: var(--mh-brand); color: #fff; }
.mh-chat-form .primary:hover { filter: brightness(0.92); }
.mh-chat-form .quiet {
  background: transparent; color: var(--mh-soft);
  border: 1px solid var(--mh-line) !important;
}

.mh-chat-composer {
  display: flex; gap: 0.5rem; padding: 1rem;
  border-top: 1px solid var(--mh-line); background: #fff;
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.mh-chat-composer input {
  flex: 1; border: 1px solid var(--mh-soft); border-radius: 2px;
  padding: 0.5rem 1rem; font: inherit;
}
.mh-chat-composer input:focus-visible {
  outline: 2px solid var(--mh-brand); outline-offset: 1px; border-color: var(--mh-brand);
}
.mh-chat-composer button {
  border: 0; border-radius: 62.5rem; padding: 0.5rem 1rem;
  background: var(--mh-brand); color: #fff; font-weight: 600; cursor: pointer;
}
.mh-chat-composer button:hover { filter: brightness(0.92); }
.mh-chat-composer[hidden] { display: none !important; }

.mh-chat-crisis {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(26, 26, 26, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.mh-chat-crisis[hidden] { display: none !important; }
.mh-chat-crisis-card {
  max-width: 28rem; width: 100%;
  background: var(--mh-crisis-bg); color: var(--mh-crisis);
  border: 2px solid var(--mh-crisis); border-radius: 8px;
  padding: 1.5rem; font-family: "Source Sans 3", system-ui, sans-serif;
}
.mh-chat-crisis-card h2 {
  font-size: 1.125rem; margin: 0 0 1rem; letter-spacing: 0.02em;
}
.mh-chat-crisis-card p { margin: 0; line-height: 1.5; font-size: 1rem; }

@media (max-width: 32.5rem) {
  .mh-chat-panel {
    right: 0.5rem; left: 0.5rem; bottom: 4.5rem; width: auto;
  }
  .mh-chat-fab { right: 1rem; bottom: 1rem; }
}
