/* ==========================================================================
   New Horizon AI Chatbot — chatbot.css v2
   Fully self-contained. No external fonts or resources.
   ========================================================================== */

#nhc-root {
  position: fixed;
  bottom: 1.75rem;
  z-index: 99999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
}

/* ── Bubble ────────────────────────────────────────────────────────────────── */
#nhc-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--nhc-clr, #3b559a);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 1px 4px rgba(0,0,0,.12);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  position: relative;
  outline: none;
}
#nhc-bubble:hover  { transform: scale(1.08); box-shadow: 0 8px 28px rgba(0,0,0,.28); }
#nhc-bubble:active { transform: scale(.95); }
#nhc-bubble:focus-visible { outline: 3px solid var(--nhc-clr,.3b559a); outline-offset: 3px; }

/* Ping ring */
#nhc-bubble::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--nhc-clr, #3b559a);
  opacity: 0;
  animation: nhc-ping 3s cubic-bezier(0,0,.2,1) infinite 3s;
}
@keyframes nhc-ping {
  0%       { transform: scale(1);   opacity: .5; }
  80%,100% { transform: scale(1.6); opacity: 0; }
}

/* Unread badge */
#nhc-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 19px; height: 19px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */
#nhc-panel {
  position: absolute;
  bottom: 72px;
  width: 370px;
  max-height: 590px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.17), 0 4px 16px rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: nhc-in .28s cubic-bezier(.34,1.56,.64,1);
  transform-origin: bottom center;
}
/* Panel is hidden by default; shown when #nhc-root has class nhc-open */
#nhc-panel {
  display: none;
}
#nhc-root.nhc-open #nhc-panel {
  display: flex;
}

@keyframes nhc-in {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Position variants */
#nhc-root[style*="right"] #nhc-panel { right: 0; }
#nhc-root[style*="left"]  #nhc-panel { left: 0; }

/* Mobile */
@media (max-width: 480px) {
  #nhc-panel {
    position: fixed;
    left: 1rem !important;
    right: 1rem !important;
    width: auto;
    max-width: none;
    max-height: min(72vh, 620px);
    margin: 0;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
  }
}

/* ── Header ────────────────────────────────────────────────────────────────── */
#nhc-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.125rem;
  background: var(--nhc-clr, #3b559a);
  flex-shrink: 0;
}
#nhc-hd-l {
  display: flex;
  align-items: center;
  gap: .75rem;
}
#nhc-hd-av {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
#nhc-hd-name {
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
#nhc-hd-status {
  font-size: .72rem;
  color: rgba(255,255,255,.78);
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .1rem;
}
#nhc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  animation: nhc-pulse-dot 2.5s ease-in-out infinite;
}
@keyframes nhc-pulse-dot {
  0%,100% { opacity: 1; }
  50%     { opacity: .45; }
}
#nhc-hd-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
  line-height: 1;
}
#nhc-hd-close:hover { background: rgba(255,255,255,.28); }

/* ── Messages ──────────────────────────────────────────────────────────────── */
#nhc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.125rem .875rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
  background: #f8fafc;
}
#nhc-msgs::-webkit-scrollbar       { width: 4px; }
#nhc-msgs::-webkit-scrollbar-track { background: transparent; }
#nhc-msgs::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }

/* Message rows */
.nhc-row {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  animation: nhc-msg-in .18s ease;
}
@keyframes nhc-msg-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nhc-row--bot  { align-self: flex-start; max-width: 90%; }
.nhc-row--user { align-self: flex-end;   max-width: 86%; flex-direction: row-reverse; }

.nhc-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--nhc-clr, #3b559a);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.nhc-row--user .nhc-av { background: #e2e8f0; color: #475569; }

.nhc-col { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }

.nhc-bub {
  padding: .5625rem .875rem;
  font-size: .875rem;
  line-height: 1.65;
  color: #1e293b;
  background: #fff;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border: 1px solid rgba(0,0,0,.06);
  word-break: break-word;
}
.nhc-row--user .nhc-bub {
  background: var(--nhc-clr, #3b559a);
  color: #fff;
  border-color: transparent;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 2px 8px rgba(59,85,154,.28);
}

/* Markdown inside bubbles */
.nhc-bub p           { margin: 0 0 .5rem; }
.nhc-bub p:last-child { margin-bottom: 0; }
.nhc-bub strong      { font-weight: 700; }
.nhc-bub em          { font-style: italic; }
.nhc-bub ul          { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.nhc-bub ol          { margin: .4rem 0 .4rem 1.25rem; padding: 0; }
.nhc-bub li          { margin-bottom: .25rem; }
.nhc-bub hr          { border: none; border-top: 1px solid rgba(0,0,0,.1); margin: .625rem 0; }

/* Section headings inside answers */
.nhc-bub .nhc-section {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--nhc-clr, #3b559a);
  margin: .75rem 0 .25rem;
  display: block;
}
.nhc-row--user .nhc-bub .nhc-section { color: rgba(255,255,255,.7); }

/* Timestamp */
.nhc-ts {
  font-size: .63rem;
  color: #94a3b8;
  padding: 0 .25rem;
}
.nhc-row--user .nhc-ts { text-align: right; }

/* ── Feedback row ──────────────────────────────────────────────────────────── */
.nhc-fb {
  display: flex;
  align-items: center;
  gap: .375rem;
  padding-left: .25rem;
  margin-top: .1rem;
}
.nhc-fb-label { font-size: .63rem; color: #94a3b8; }
.nhc-fb-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 99px;
  padding: .1rem .45rem;
  font-size: .7rem;
  cursor: pointer;
  color: #94a3b8;
  transition: all .15s;
  line-height: 1.4;
}
.nhc-fb-btn:hover    { border-color: var(--nhc-clr, #3b559a); color: var(--nhc-clr, #3b559a); }
.nhc-fb-btn.nhc-yes  { border-color: #22c55e; color: #16a34a; background: #f0fdf4; }
.nhc-fb-btn.nhc-no   { border-color: #ef4444; color: #dc2626; background: #fff1f2; }
.nhc-fb-done { font-size: .63rem; color: #22c55e; }

/* ── Typing indicator ──────────────────────────────────────────────────────── */
#nhc-typing {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .625rem .875rem;
  background: #fff;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border: 1px solid rgba(0,0,0,.06);
  align-self: flex-start;
  width: fit-content;
}
#nhc-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: nhc-bounce 1.3s ease-in-out infinite;
}
#nhc-typing span:nth-child(2) { animation-delay: .18s; }
#nhc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes nhc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── Quick-reply chips (suggestions & followups) ───────────────────────────── */
#nhc-sugs {
  padding: .625rem .875rem;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  flex-shrink: 0;
  transition: max-height .3s ease, opacity .25s ease, padding .25s ease;
  overflow: hidden;
}
#nhc-sugs.nhc-hidden {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.nhc-chip {
  padding: .3rem .7rem;
  background: #f0f4ff;
  color: var(--nhc-clr, #3b559a);
  border: 1.5px solid rgba(59,85,154,.18);
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.5;
}
.nhc-chip:hover {
  background: var(--nhc-clr, #3b559a);
  color: #fff;
  border-color: var(--nhc-clr, #3b559a);
  transform: translateY(-1px);
}

/* Follow-up chips (below a bot answer) */
.nhc-followups {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}

/* ── Input bar ─────────────────────────────────────────────────────────────── */
#nhc-bar {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem .875rem;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}
#nhc-inp {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: .5625rem .875rem;
  font-size: .875rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.55;
  max-height: 96px;
  overflow-y: auto;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#nhc-inp:focus {
  border-color: var(--nhc-clr, #3b559a);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nhc-clr, #3b559a) 12%, transparent);
}
#nhc-inp::placeholder { color: #94a3b8; }
#nhc-send {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--nhc-clr, #3b559a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
#nhc-send:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: scale(1.06);
}
#nhc-send:disabled { opacity: .38; cursor: not-allowed; }

/* ── Footer credit ─────────────────────────────────────────────────────────── */
#nhc-credit {
  text-align: center;
  font-size: .625rem;
  color: #cbd5e1;
  padding: .3rem 0 .5rem;
  background: #fff;
  letter-spacing: .04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── System / error messages ───────────────────────────────────────────────── */
.nhc-sys {
  text-align: center;
  font-size: .72rem;
  color: #94a3b8;
  padding: .1rem 0;
  align-self: center;
}
.nhc-err .nhc-bub {
  background: #fff1f2;
  color: #881337;
  border-color: #fda4af;
}
