/* ==========================================================
   HireUup Assistant — floating chat (bottom-right).
   WhatsApp sits bottom-left (whatsapp.css), so the two never
   overlap. On phones the open chat fills the screen.
   ========================================================== */
.hu-chat {
  --c-primary: var(--hu-primary, #4B1FA6);
  --c-violet: var(--hu-violet, #7C3AED);
  --c-deep: var(--hu-deep, #29115C);
  --c-lilac: var(--hu-lilac, #F1EBFF);
  --c-ink: var(--hu-ink, #171717);
  --c-text: var(--hu-text, #3F3F46);
  --c-muted: var(--hu-muted, #6B7280);
  --c-line: var(--hu-line, #E5E7EB);
  --c-bg-alt: var(--hu-bg-alt, #F8F9FC);
  --c-gap: 24px;
  --c-lift: 0px;
  font-family: var(--hu-font, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-text);
}
.hu-chat *, .hu-chat *::before, .hu-chat *::after { box-sizing: border-box; }

/* ---------- Launcher ---------- */
.hu-chat__launcher {
  position: fixed; right: var(--c-gap); bottom: calc(var(--c-gap) + var(--c-lift) + env(safe-area-inset-bottom, 0px)); z-index: 999990;
  display: grid; place-items: center; width: 60px; height: 60px; margin: 0; padding: 0;
  border: 0; border-radius: 20px; cursor: pointer; color: #fff;
  background: linear-gradient(140deg, #7C3AED 0%, #4B1FA6 55%, #29115C 100%);
  box-shadow: 0 14px 30px -10px rgba(41, 17, 92, .6), 0 2px 6px rgba(41, 17, 92, .25), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .2s ease, box-shadow .2s ease, border-radius .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.hu-chat__launcher[hidden] { display: none; }
.hu-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(41, 17, 92, .7), 0 2px 6px rgba(41, 17, 92, .25); }
.hu-chat__launcher:focus-visible { outline: 3px solid #C4B5FD; outline-offset: 3px; }
.hu-chat__launcher svg { grid-area: 1 / 1; transition: opacity .2s ease, transform .25s ease; }
.hu-chat__ico-close { opacity: 0; transform: rotate(-60deg) scale(.6); }
.hu-chat.is-open .hu-chat__launcher { border-radius: 50%; }
.hu-chat.is-open .hu-chat__ico-open { opacity: 0; transform: rotate(60deg) scale(.6); }
.hu-chat.is-open .hu-chat__ico-close { opacity: 1; transform: none; }
.hu-chat__badge { display: none; position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: #22C55E; border: 2.5px solid #fff; }
.hu-chat.is-new .hu-chat__badge { display: block; animation: hu-chat-ping 2.4s ease-out infinite; }
@keyframes hu-chat-ping { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } }

/* ---------- Panel ---------- */
.hu-chat__panel {
  position: fixed; right: var(--c-gap); bottom: calc(var(--c-gap) + var(--c-lift) + 72px + env(safe-area-inset-bottom, 0px)); z-index: 999991;
  display: flex; flex-direction: column; width: 384px; max-width: calc(100vw - 2 * var(--c-gap));
  height: min(620px, calc(100vh - var(--c-lift) - 140px)); height: min(620px, calc(100dvh - var(--c-lift) - 140px));
  overflow: hidden; border-radius: 24px; background: #fff; border: 1px solid rgba(75, 31, 166, .12);
  box-shadow: 0 40px 80px -30px rgba(41, 17, 92, .5), 0 8px 24px -12px rgba(41, 17, 92, .25);
  transform-origin: bottom right; animation: hu-chat-in .22s cubic-bezier(.2, .8, .2, 1);
}
.hu-chat__panel[hidden] { display: none; }
@keyframes hu-chat-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.hu-chat__head {
  display: flex; align-items: center; gap: 10px; padding: 14px 10px 14px 16px; color: #fff;
  background: linear-gradient(120deg, #29115C 0%, #4B1FA6 60%, #7C3AED 100%);
}
.hu-chat__avatar { flex-shrink: 0; display: block; width: 40px; height: 40px; border-radius: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .28); }
.hu-chat__avatar svg { display: block; width: 40px; height: 40px; }
.hu-chat__who { flex: 1; min-width: 0; }
.hu-chat__title { margin: 0; font-family: var(--hu-font-display, inherit); font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; color: #fff; }
.hu-chat__status { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .82); }
.hu-chat__live { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 2px rgba(74, 222, 128, .25); }
.hu-chat__hbtn {
  display: grid; place-items: center; width: 38px; height: 38px; margin: 0; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: #fff; cursor: pointer; transition: background-color .15s ease;
}
.hu-chat__hbtn:hover { background: rgba(255, 255, 255, .14); }
.hu-chat__hbtn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; background: rgba(255, 255, 255, .14); }

/* ---------- Conversation ---------- */
.hu-chat__log {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 10px;
  background: linear-gradient(180deg, #FAF8FF 0%, #fff 140px);
  scroll-behavior: smooth;
}
.hu-chat__log:focus-visible { outline: 2px solid var(--c-violet); outline-offset: -2px; }
.hu-chat__row { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 10px; }
.hu-chat__row--user { justify-content: flex-end; }
.hu-chat__mini { flex-shrink: 0; display: block; width: 28px; height: 28px; border-radius: 9px; overflow: hidden; }
.hu-chat__mini svg { display: block; width: 28px; height: 28px; }
.hu-chat__bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 16px; overflow-wrap: anywhere;
  font-size: 14.5px; line-height: 1.55;
}
.hu-chat__row--bot .hu-chat__bubble { background: #fff; color: var(--c-ink); border: 1px solid var(--c-line); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.hu-chat__row--user .hu-chat__bubble { background: linear-gradient(135deg, #5B2BC4 0%, #4B1FA6 100%); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.hu-chat__row--error .hu-chat__bubble { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }
.hu-chat__row--note { justify-content: center; }
.hu-chat__row--note .hu-chat__bubble { max-width: 92%; padding: 7px 12px; border: 0; border-radius: 10px; background: var(--c-lilac); color: var(--c-deep); font-size: 13px; text-align: center; box-shadow: none; }
.hu-chat__bubble p { margin: 0 0 8px; }
.hu-chat__bubble p:last-child, .hu-chat__bubble ul:last-child, .hu-chat__bubble ol:last-child { margin-bottom: 0; }
.hu-chat__bubble ul, .hu-chat__bubble ol { margin: 0 0 8px; padding-left: 20px; }
.hu-chat__bubble li { margin: 3px 0; }
.hu-chat__bubble li::marker { color: var(--c-violet); }
.hu-chat__bubble strong { font-weight: 700; color: inherit; }
.hu-chat__bubble a { color: var(--c-primary); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.hu-chat__bubble a:hover { color: var(--c-violet); }
.hu-chat__row--error .hu-chat__bubble a { color: #991B1B; }

.hu-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px 36px; }
.hu-chat__chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; margin: 0; padding: 6px 12px;
  border: 1px solid rgba(75, 31, 166, .28); border-radius: 999px; background: #fff; color: var(--c-primary);
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.hu-chat__chip:hover { background: var(--c-lilac); border-color: var(--c-violet); color: var(--c-deep); }
.hu-chat__chip:focus-visible { outline: 2px solid var(--c-violet); outline-offset: 2px; }
.hu-chat__chip:disabled { opacity: .5; cursor: default; }
.hu-chat__chip--link { background: var(--c-lilac); border-color: transparent; }
.hu-chat__chip--link:hover { background: #E4D9FF; }
.hu-chat__chip--retry { border-color: #FCA5A5; color: #991B1B; }
.hu-chat__chip--retry:hover { background: #FEF2F2; border-color: #DC2626; color: #7F1D1D; }

.hu-chat__typing { display: inline-flex; align-items: center; gap: 4px; padding: 14px 14px; }
.hu-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-violet); opacity: .35; animation: hu-chat-dot 1.2s infinite ease-in-out; }
.hu-chat__typing i:nth-child(3) { animation-delay: .15s; }
.hu-chat__typing i:nth-child(4) { animation-delay: .3s; }
@keyframes hu-chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Composer ---------- */
.hu-chat__form { position: relative; display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px 6px; border-top: 1px solid var(--c-line); background: #fff; }
.hu-chat__input {
  flex: 1; min-width: 0; min-height: 44px; max-height: 120px; margin: 0; padding: 11px 14px; resize: none;
  border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-bg-alt); color: var(--c-ink);
  font: inherit; font-size: 15px; line-height: 1.4; box-shadow: none;
}
.hu-chat__input::placeholder { color: #8B8F98; }
.hu-chat__input:focus { outline: none; border-color: var(--c-violet); background: #fff; box-shadow: 0 0 0 3px rgba(124, 58, 237, .18); }
.hu-chat__send {
  flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 14px;
  background: var(--c-primary); color: #fff; cursor: pointer; transition: background-color .15s ease, transform .15s ease;
}
.hu-chat__send:hover { background: var(--c-violet); }
.hu-chat__send:active { transform: scale(.96); }
.hu-chat__send:focus-visible { outline: 3px solid #C4B5FD; outline-offset: 2px; }
.hu-chat__send:disabled { background: #A78BFA; cursor: wait; }
.hu-chat__count { position: absolute; right: 70px; top: -22px; padding: 1px 8px; border-radius: 999px; background: #fff; font-size: 12px; color: var(--c-muted); }
.hu-chat__count:empty { display: none; }
.hu-chat__note { margin: 0; padding: 4px 14px 10px; background: #fff; font-size: 11.5px; line-height: 1.4; color: var(--c-muted); text-align: center; }
.hu-chat__note a { color: var(--c-primary); text-decoration: underline; }

.hu-chat .screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Never cover other fixed UI ---------- */
body.nav-open .hu-chat__launcher { display: none; }
/* Job pages on tablets/phones have a fixed Apply / Call bar along the bottom. */
@media (max-width: 920px) {
  .single-job .hu-chat { --c-lift: 72px; }
}

/* ---------- Phones: compact launcher, full-screen chat ---------- */
@media (max-width: 600px) {
  .hu-chat { --c-gap: 16px; }
  .hu-chat__launcher { width: 56px; height: 56px; border-radius: 18px; }
  .hu-chat__panel {
    inset: 0; right: 0; bottom: auto; top: 0; z-index: 1000001; width: 100%; max-width: none;
    height: 100vh; height: 100dvh; border: 0; border-radius: 0; animation-name: hu-chat-up;
  }
  .hu-chat__head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .hu-chat__note { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .hu-chat.is-open .hu-chat__launcher { display: none; }
  .hu-chat__input { font-size: 16px; } /* Prevent iOS zoom on focus. */
  .hu-chat__bubble { max-width: 86%; }
}
@keyframes hu-chat-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
html.hu-chat-lock, html.hu-chat-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .hu-chat__panel, .hu-chat.is-new .hu-chat__badge, .hu-chat__typing i { animation: none; }
  .hu-chat__launcher, .hu-chat__launcher svg { transition: none; }
  .hu-chat__log { scroll-behavior: auto; }
}
@media (forced-colors: active) {
  .hu-chat__launcher, .hu-chat__send, .hu-chat__chip, .hu-chat__bubble { border: 1px solid CanvasText; }
}
@media print { .hu-chat { display: none !important; } }
