/* OnMed marketing help chat — scoped to #help-pub-root */

#help-pub-root {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

#help-pub-root * {
  box-sizing: border-box;
}

#help-pub-root > * {
  pointer-events: auto;
}

#help-pub-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0c3287, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 24px rgba(12, 50, 135, 0.35);
  cursor: pointer;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#help-pub-toggle:hover {
  filter: brightness(1.05);
}

.help-pub-bubble .help-pub-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.help-pub-bubble .help-pub-link:hover {
  color: #0c3287;
}

#help-pub-panel {
  display: none;
  width: min(100vw - 24px, 380px);
  height: min(68dvh, 480px);
  max-height: min(68dvh, 480px);
  margin-bottom: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

#help-pub-panel.is-open {
  display: grid !important;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(200px, 1fr) auto auto;
  grid-template-areas:
    'hp-head'
    'hp-messages'
    'hp-chips'
    'hp-foot';
}

.help-pub-head {
  grid-area: hp-head;
  padding: 12px 14px;
  background: #0c3287;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-pub-head h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.help-pub-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.help-pub-messages {
  grid-area: hp-messages;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
}

.help-pub-msg {
  margin-bottom: 10px;
  max-width: 92%;
}

.help-pub-msg--bot {
  max-width: 100%;
}

.help-pub-msg--user {
  margin-left: auto;
  text-align: right;
}

.help-pub-bubble {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: left;
}

.help-pub-msg--bot .help-pub-bubble {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.help-pub-msg--user .help-pub-bubble {
  background: #0c3287;
  color: #fff;
}

.help-pub-chips {
  grid-area: hp-chips;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
  background: #f8fafc;
}

.help-pub-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.help-pub-chip:hover {
  border-color: #0c3287;
  color: #0c3287;
}

.help-pub-input-row {
  grid-area: hp-foot;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.help-pub-input-row input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.help-pub-input-row button {
  border: none;
  border-radius: 8px;
  background: #0c3287;
  color: #fff;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.help-pub-input-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.help-pub-typing {
  opacity: 0.7;
}
