/* HopeQure concierge — same palette as the booking, checkout and enquiry modals, so the site
   has one voice rather than five. No red anywhere except the crisis line, and no black: the
   darkest value here is a clearly blue indigo, because a black panel on a mental-health site
   reads as clinical rather than calm. */

.hqc {
  --c-indigo: #3b3f7d;
  --c-indigo-deep: #2e3268;
  --c-teal: #0d6e6a;
  --c-teal-soft: #e6f4f2;
  --c-clay: #c05621;
  --c-ink: #3d4166;
  --c-muted: #767ba0;
  --c-line: #e6e7ef;

  position: fixed;
  /* Pinned to the bottom-right corner of the VIEWPORT, explicitly. It was appearing up near the
     hero instead, because this element carried its own `transform` — and any transform makes an
     element the containing block for its own fixed-position descendants, but more to the point a
     reveal animation on a fixed element is fragile: the moment anything in the cascade touches
     `transform` here the `bottom`/`right` anchoring is measured against the wrong box. The
     animation is opacity-only now, so the fixed anchor is never disturbed, and top/left are set
     to auto so no inherited value can pull it back into flow. */
  right: 20px;
  bottom: 24px;
  top: auto;
  left: auto;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 600;               /* under the forms (9999) — see the note in Program.cs about
                                 floating widgets stealing clicks from callback forms */
  font-family: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.hqc.hqc-in-view { opacity: 1; pointer-events: auto; }
.hqc.hqc-hidden { display: none; }

/* ---- the talk-to-us bubble ----
   A rounded pill: chat icon + label, not a bare star. The star told nobody it was a chat. */
.hqc-fab {
  display: inline-flex; align-items: center; gap: 9px;
  height: 52px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; cursor: pointer; position: relative;
  color: #fff; font-family: inherit;
  background: linear-gradient(135deg, var(--c-indigo), var(--c-teal));
  box-shadow: 0 10px 26px rgba(59, 63, 125, .30);
  transition: transform .16s ease, box-shadow .16s ease;
}
.hqc-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(59, 63, 125, .38); }
.hqc-fab:focus-visible { outline: 3px solid var(--c-teal); outline-offset: 3px; }
.hqc-fab-ic { flex: 0 0 auto; }
.hqc-fab-label { font-size: 14px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }

/* One soft pulse ring, so it is noticed once without nagging. Stops after a few seconds — a
   thing that pulses forever is an irritation, not an invitation. */
.hqc-ring {
  position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(13, 110, 106, .45);
  animation: hqcPulse 2.2s ease-out 3;
}
@keyframes hqcPulse {
  0%   { box-shadow: 0 0 0 0 rgba(13, 110, 106, .45); }
  70%  { box-shadow: 0 0 0 14px rgba(13, 110, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(13, 110, 106, 0); }
}

/* On a phone the label would crowd the edge — collapse to a round icon there. */
@media (max-width: 480px) {
  .hqc-fab { width: 54px; height: 54px; padding: 0; justify-content: center; border-radius: 50%; }
  .hqc-fab-label { display: none; }
}

.hqc-badge {
  position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%;
  background: #f2b544; border: 2px solid #fff;
}
.hqc.is-open .hqc-fab { display: none; }

/* ---- the panel ---- */
/* The [hidden] rule, restated with !important.

   The panel is hidden by setting the `hidden` attribute, and shown by the .hqc-panel rule below
   — which sets display:flex. An author display rule beats the browser's own [hidden]{display:none},
   so `hidden` did nothing: the panel was on screen from the moment the page loaded, the close
   button "did nothing" because there was nothing it could do, and the icon sat above a panel
   that should not have been there. Three bug reports, one cascade rule. */
.hqc-panel[hidden] { display: none !important; }

.hqc-panel {
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(59, 63, 125, .28), 0 0 0 1px var(--c-line);
}
.hqc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, var(--c-indigo) 0%, #4a4f95 45%, var(--c-teal) 135%);
}
.hqc-head b { font-size: 14.5px; display: block; }
.hqc-head small { font-size: 11.5px; color: #c7cdea; }
.hqc-close {
  border: 0; width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 13px; line-height: 1;
}
.hqc-close:hover { background: rgba(255, 255, 255, .26); }

.hqc-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }

.hqc-msg {
  max-width: 86%; padding: 10px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
}
.hqc-msg.bot { align-self: flex-start; background: var(--c-teal-soft); color: var(--c-ink); }
.hqc-msg.me  { align-self: flex-end;  background: linear-gradient(140deg, var(--c-indigo), #5257a4); color: #fff; }
.hqc-msg.quiet { background: #f6f7fb; color: var(--c-muted); font-size: 12.5px; }
.hqc-msg a { color: var(--c-teal); font-weight: 600; }

/* The one place red is allowed, because it is the one place it means what red means. */
.hqc-msg.crisis { background: #fdeee4; color: #8a3a12; border: 1px solid var(--c-clay); max-width: 100%; }
.hqc-msg.crisis b { color: #8a3a12; }

.hqc-msg.typing { padding: 12px 14px; }
.hqc-dots i {
  display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%;
  background: var(--c-muted); animation: hqcBlink 1.2s infinite;
}
.hqc-dots i:nth-child(2) { animation-delay: .2s; }
.hqc-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes hqcBlink { 0%, 60%, 100% { opacity: .25 } 30% { opacity: 1 } }

.hqc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hqc-chips button {
  border: 1px solid var(--c-line); background: #fff; color: var(--c-ink);
  font-size: 12.5px; padding: 7px 12px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.hqc-chips button:hover { border-color: var(--c-teal); color: var(--c-teal); }

.hqc-lead { margin: 0 0 8px; }
.hqc-doc {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 9px 0; border-top: 1px solid rgba(13, 110, 106, .16);
}
.hqc-doc b { font-size: 13.5px; display: block; }
.hqc-doc small { display: block; font-size: 11.5px; color: var(--c-muted); }
.hqc-doc small.hqc-price { color: var(--c-teal); font-weight: 600; }
.hqc-doc button {
  flex: 0 0 auto; border: 0; border-radius: 10px; padding: 8px 16px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: #fff; font-family: inherit;
  background: linear-gradient(135deg, var(--c-clay), #d4703a);
}
.hqc-note { margin: 10px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--c-muted); }

.hqc-in { display: flex; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--c-line); background: #fafbfe; }
.hqc-in input {
  flex: 1; min-width: 0; padding: 10px 13px; border-radius: 11px; font-family: inherit;
  border: 1.5px solid var(--c-line); font-size: 13.5px; color: var(--c-ink); background: #fff;
}
.hqc-in input:focus { outline: none; border-color: var(--c-teal); background: var(--c-teal-soft); }
.hqc-in button {
  flex: 0 0 42px; border: 0; border-radius: 11px; cursor: pointer; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--c-clay), #d4703a);
}
.hqc-foot { margin: 0; padding: 0 14px 11px; font-size: 10.5px; line-height: 1.5; color: var(--c-muted); background: #fafbfe; }

@media (max-width: 480px) {
  .hqc { right: 12px; bottom: 12px; left: 12px; }
  .hqc-fab { max-width: none; }
  .hqc-panel { width: 100%; height: min(78vh, 560px); }
}

/* Someone who has asked for less motion should not get a pill sliding in from the corner. */
@media (prefers-reduced-motion: reduce) {
  .hqc, .hqc-fab { transition: none; }
  .hqc-dots i { animation: none; opacity: .5; }
  .hqc-ring { animation: none; }
}

/* ---- slots, forms and the rest of the funnel, inside the chat ---- */
.hqc-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.hqc-slots button {
  border: 1.5px solid transparent; background: #fff; color: var(--c-ink);
  font-size: 13px; font-weight: 600; padding: 8px 4px; border-radius: 10px;
  cursor: pointer; font-family: inherit;
}
.hqc-slots button:hover { border-color: var(--c-teal); color: var(--c-teal); }

.hqc-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; }
.hqc-nav button {
  border: 1px solid rgba(13, 110, 106, .28); background: transparent; color: var(--c-teal);
  font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 9px;
  cursor: pointer; font-family: inherit;
}
.hqc-nav button[disabled] { opacity: .38; cursor: default; }

.hqc-form {
  align-self: stretch; background: #fafbfe; border: 1px solid var(--c-line);
  border-radius: 14px; padding: 13px 14px;
}
.hqc-form label {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--c-muted); margin: 9px 0 4px;
}
.hqc-form label:first-child { margin-top: 0; }
.hqc-f {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 10px;
  border: 1.5px solid var(--c-line); font-size: 13.5px; color: var(--c-ink);
  background: #fff; font-family: inherit;
}
.hqc-f:focus { outline: none; border-color: var(--c-teal); background: var(--c-teal-soft); }
.hqc-phone { display: flex; gap: 7px; }
.hqc-phone select { flex: 0 0 104px; }
.hqc-otp { text-align: center; font-size: 19px; letter-spacing: 6px; }

.hqc-consent {
  display: flex; gap: 8px; align-items: flex-start; text-transform: none; letter-spacing: 0;
  font-size: 11.5px; font-weight: 400; color: var(--c-muted); line-height: 1.5; margin-top: 11px;
}
.hqc-consent input { width: 15px; height: 15px; margin-top: 1px; accent-color: var(--c-teal); flex: 0 0 auto; }
.hqc-consent a { color: var(--c-teal); font-weight: 600; }

/* Amber, not red. A field that needs another go is not an emergency, and this widget keeps red
   for the one message where red means what red means. */
.hqc-err { margin: 9px 0 0; font-size: 12px; color: #8a5a12; background: #fdf3e0;
           border-radius: 8px; padding: 7px 10px; line-height: 1.45; }

.hqc-go {
  width: 100%; margin-top: 11px; border: 0; border-radius: 11px; padding: 11px;
  font-size: 13.5px; font-weight: 700; color: #fff; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, var(--c-clay), #d4703a);
}
.hqc-go[disabled] { opacity: .5; cursor: default; }
.hqc-link {
  width: 100%; margin-top: 7px; border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--c-teal); font-family: inherit; text-decoration: underline;
}

/* ---- drag ---- */
.hqc-head { cursor: grab; user-select: none; }
.hqc-head:active { cursor: grabbing; }
/* The close button keeps a normal cursor and its own pointer events, so the grab affordance on
   the bar behind it never suggests the X is draggable. */
.hqc-close { cursor: pointer; }
/* No transition while dragging — a 0.35s ease on a position that changes every frame reads as
   the panel lagging behind the finger. */
.hqc.hqc-dragging { transition: none; }
.hqc.hqc-dragging .hqc-panel { box-shadow: 0 30px 70px rgba(59, 63, 125, .34); }
.hqc.hqc-dragging .hqc-log { pointer-events: none; }

/* Inline actions inside a sentence — look like links, are buttons, never leave the chat. */
.hqc-inline { border: 0; background: none; padding: 0; font: inherit; color: var(--c-teal);
              font-weight: 600; text-decoration: underline; cursor: pointer; }
.hqc-cats { max-height: 190px; overflow-y: auto; }
