/* Help assistant widget — shared by landing, /examples and /app.
   Self-contained: picks up the page's --primary when it has one. */

.hc-root {
  --hc-primary: var(--primary, #4f46e5);
  --hc-bg: #ffffff;
  --hc-subtle: #f5f6f8;
  --hc-text: #0f172a;
  --hc-muted: #64748b;
  --hc-border: #e2e8f0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--hc-text);
}

.hc-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--hc-primary);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  cursor: pointer;
}
.hc-fab:hover { filter: brightness(1.08); }
.hc-fab:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.35); outline-offset: 2px; }
.hc-root.hc-open .hc-fab { display: none; }

.hc-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9991;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 40px);
  display: none;
  flex-direction: column;
  background: var(--hc-bg);
  border: 1px solid var(--hc-border);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.hc-root.hc-open .hc-panel { display: flex; }

.hc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--hc-primary);
  color: #ffffff;
}
.hc-title { font-weight: 700; font-size: 14.5px; }
.hc-sub { font-size: 12px; opacity: 0.85; }
.hc-head-actions { display: flex; gap: 4px; }
.hc-icon-btn {
  border: 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.9;
}
.hc-icon-btn:hover { background: rgba(255, 255, 255, 0.16); opacity: 1; }

.hc-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--hc-subtle);
}

.hc-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.hc-msg-assistant {
  align-self: flex-start;
  background: var(--hc-bg);
  border: 1px solid var(--hc-border);
  border-bottom-left-radius: 4px;
}
.hc-msg-user {
  align-self: flex-end;
  background: var(--hc-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.hc-msg a { color: var(--hc-primary); font-weight: 600; }
.hc-msg ol, .hc-msg ul { margin: 4px 0; padding-left: 20px; }
.hc-msg p { margin: 0 0 6px; }
.hc-msg p:last-child { margin-bottom: 0; }
.hc-msg-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

.hc-typing { color: var(--hc-muted); font-style: italic; }

.hc-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-chip {
  border: 1px solid var(--hc-border);
  background: var(--hc-bg);
  color: var(--hc-text);
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}
.hc-chip:hover { border-color: var(--hc-primary); color: var(--hc-primary); }

.hc-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--hc-border);
  background: var(--hc-bg);
}
.hc-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--hc-border);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  color: var(--hc-text);
  max-height: 110px;
}
.hc-input:focus { outline: none; border-color: var(--hc-primary); }
.hc-send {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--hc-primary);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.hc-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 520px) {
  .hc-fab { right: 16px; bottom: 16px; }
  .hc-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }
}
