/* =============================================================
   assets/css/helper-chat.css — in-portal help chatbot
   ============================================================= */
.hc-root {
  --hc-navy: #0F1F3D;
  --hc-green: #5CB85C;
  --hc-bg: #FFFFFF;
  --hc-soft: #F4F5F7;
  --hc-line: #E3E5E8;
  --hc-text: #1A1A18;
  --hc-muted: #6B6F76;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--hc-text);
}

/* ---- Launcher ---- */
.hc-launcher {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--hc-navy);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(15, 31, 61, 0.3);
  overflow: hidden;
  padding: 0;
  transition: transform .15s ease;
  margin-left: auto;
}
.hc-launcher:hover { transform: scale(1.05); }
.hc-launcher:focus-visible { outline: 3px solid var(--hc-green); outline-offset: 3px; }
.hc-launcher img { width: 100%; height: 100%; object-fit: cover; }
.hc-root.is-open .hc-launcher { display: none; }

/* ---- Nudge bubble ---- */
.hc-nudge {
  position: absolute;
  right: 0; bottom: 72px;
  width: 250px;
  background: var(--hc-bg);
  border: 1px solid var(--hc-line);
  border-radius: 14px 14px 4px 14px;
  padding: 14px 16px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  animation: hc-pop .25s ease-out;
}
.hc-nudge-text { font-weight: 600; margin-right: 14px; margin-bottom: 10px; }
.hc-nudge-go {
  background: var(--hc-navy); color: #fff; border: none;
  border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.hc-nudge-close {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; font-size: 18px; line-height: 1;
  color: var(--hc-muted); cursor: pointer; padding: 2px 4px;
}
@keyframes hc-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Panel ---- */
.hc-panel {
  display: none;
  width: 380px;
  height: min(600px, calc(100vh - 40px));
  background: var(--hc-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  flex-direction: column;
  overflow: hidden;
  animation: hc-pop .2s ease-out;
}
.hc-root.is-open .hc-panel { display: flex; }

.hc-head {
  display: flex; align-items: center; gap: 10px;
  background: var(--hc-navy); color: #fff;
  padding: 12px 12px 12px 16px;
}
.hc-head-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.hc-head-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hc-head-avatar svg { width: 22px; height: 22px; }
.hc-head-text { flex: 1; min-width: 0; }
.hc-head-name { font-weight: 700; font-size: 15px; }
.hc-head-sub { font-size: 12px; opacity: 0.7; }
.hc-icon-btn {
  background: none; border: none; color: #fff; opacity: 0.75;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hc-icon-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

.hc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--hc-soft);
  display: flex; flex-direction: column; gap: 10px;
}

/* ---- Messages ---- */
.hc-msg { display: flex; flex-direction: column; max-width: 88%; }
.hc-msg--user { align-self: flex-end; align-items: flex-end; }
.hc-msg--assistant { align-self: flex-start; }
.hc-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.hc-msg--user .hc-bubble { background: var(--hc-navy); color: #fff; border-bottom-right-radius: 4px; }
.hc-msg--assistant .hc-bubble { background: var(--hc-bg); border: 1px solid var(--hc-line); border-bottom-left-radius: 4px; }
.hc-bubble p { margin: 0 0 6px; }
.hc-bubble p:last-child { margin-bottom: 0; }
.hc-bubble ol, .hc-bubble ul { margin: 4px 0 6px 18px; padding: 0; }
.hc-bubble li { margin: 2px 0; }
.hc-bubble a { color: #1565C0; font-weight: 600; }
.hc-bubble code { background: var(--hc-soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

.hc-feedback { display: flex; gap: 4px; margin-top: 4px; }
.hc-fb {
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--hc-muted); cursor: pointer; padding: 3px 5px; opacity: 0.6;
}
.hc-fb:hover { opacity: 1; border-color: var(--hc-line); }
.hc-fb.is-on { opacity: 1; color: var(--hc-navy); background: #E8EDF5; }

.hc-note {
  align-self: center;
  font-size: 12.5px; color: var(--hc-muted);
  text-align: center; max-width: 90%;
}
.hc-note a { color: #1565C0; font-weight: 600; }

.hc-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hc-chip {
  background: var(--hc-bg); border: 1px solid #C9D3E3; color: var(--hc-navy);
  border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-align: left;
}
.hc-chip:hover { background: #EEF3FA; }

.hc-typing { display: flex; gap: 4px; padding: 10px 13px; background: var(--hc-bg); border: 1px solid var(--hc-line); border-radius: 14px; align-self: flex-start; }
.hc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #B5BAC2; animation: hc-dot 1.2s infinite ease-in-out; }
.hc-typing span:nth-child(2) { animation-delay: .15s; }
.hc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---- Input ---- */
.hc-form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--hc-line);
  background: var(--hc-bg);
}
.hc-input {
  flex: 1; resize: none;
  border: 1px solid var(--hc-line); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 14px; line-height: 1.4;
  max-height: 120px;
}
.hc-input:focus { outline: none; border-color: var(--hc-navy); }
.hc-send {
  width: 40px; height: 40px; flex-shrink: 0;
  border: none; border-radius: 10px;
  background: var(--hc-green); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hc-foot {
  font-size: 11px; color: var(--hc-muted); text-align: center;
  padding: 0 12px 10px; background: var(--hc-bg);
}
.hc-foot a { color: var(--hc-muted); text-decoration: underline; }

/* ---- Phones: full screen ---- */
@media (max-width: 520px) {
  .hc-root { right: 14px; bottom: 14px; }
  .hc-root.is-open { right: 0; bottom: 0; left: 0; top: 0; }
  .hc-root.is-open .hc-panel { width: 100%; height: 100%; border-radius: 0; }
  .hc-input { font-size: 16px; } /* stops iOS zooming on focus */
}

/* ---- Character faces ---- */
.hc-duo { display: flex; width: 100%; height: 100%; }
.hc-duo img { width: 50%; height: 100%; object-fit: cover; }
.hc-head-avatar .hc-duo img, .hc-nudge-avatar .hc-duo img { width: 50%; }
.hc-head-avatar { background: #fff; }

.hc-msg-row { display: flex; align-items: flex-end; gap: 8px; }
.hc-msg-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.hc-msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-msg--assistant .hc-feedback { margin-left: 36px; }

.hc-nudge-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.hc-nudge-row .hc-nudge-text { margin: 0 14px 0 0; }
.hc-nudge-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.hc-nudge-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-nudge { width: 270px; }

/* ---- Character picker ---- */
.hc-picker { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.hc-picker-title { font-size: 17px; font-weight: 700; color: var(--hc-navy); text-align: center; }
.hc-picker-sub { font-size: 13px; color: var(--hc-muted); text-align: center; margin-bottom: 6px; }
.hc-pick {
  display: flex; align-items: center; gap: 14px;
  background: var(--hc-bg); border: 2px solid var(--hc-line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.hc-pick:hover, .hc-pick:focus-visible { border-color: var(--hc-navy); box-shadow: 0 4px 14px rgba(15,31,61,.12); outline: none; }
.hc-pick.is-current { border-color: var(--hc-green); }
.hc-pick img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.hc-pick-text { display: flex; flex-direction: column; gap: 2px; }
.hc-pick-name { font-weight: 700; font-size: 16px; color: var(--hc-navy); }
.hc-pick-role { font-size: 13px; color: var(--hc-muted); }
.hc-pick-tag {
  align-self: flex-start; margin-top: 4px;
  font-size: 11px; font-weight: 700; color: #1E7B34; background: #E6F4EA;
  padding: 2px 8px; border-radius: 10px;
}

@media print { .hc-root { display: none !important; } }
