/* HEVEA HK — AI Chat Widget */
:root {
  --hkc-navy:   #0B1B2E;
  --hkc-navy2:  #112338;
  --hkc-blue:   #2563EB;
  --hkc-blue-d: #1D4ED8;
  --hkc-blue-lt:#EFF6FF;
  --hkc-acc:    #4B8FD4;
  --hkc-sl:     #64748B;
  --hkc-border: rgba(255,255,255,.08);
  --hkc-r:      16px;
  --hkc-fn:     'Inter', system-ui, sans-serif;
}

/* ── Trigger button ──────────────────────────────────────── */
#hkc-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--hkc-navy);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(11,27,46,.4), 0 0 0 0 rgba(37,99,235,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  outline: none;
}
#hkc-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(11,27,46,.5), 0 0 0 6px rgba(37,99,235,.15);
}
#hkc-trigger.open { transform: scale(1) rotate(0deg); }
#hkc-trigger-icon-chat { transition: opacity .2s, transform .2s; }
#hkc-trigger-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
  transition: opacity .2s, transform .2s;
}
#hkc-trigger.open #hkc-trigger-icon-chat { opacity: 0; transform: rotate(90deg); }
#hkc-trigger.open #hkc-trigger-icon-close { opacity: 1; transform: rotate(0deg); }

/* Notification dot */
#hkc-notif {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #EF4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: hkc-pulse 2s infinite;
}
@keyframes hkc-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: .8; }
}
#hkc-trigger.open #hkc-notif { display: none; }

/* ── Chat window ─────────────────────────────────────────── */
#hkc-wrap {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 370px;
  height: 540px;
  background: #fff;
  border-radius: var(--hkc-r);
  box-shadow: 0 24px 60px rgba(11,27,46,.22), 0 0 0 1px rgba(11,27,46,.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9997;
  font-family: var(--hkc-fn);
  transform: translateY(20px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.2,.64,1), opacity .25s ease;
}
#hkc-wrap.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────── */
#hkc-header {
  background: var(--hkc-navy);
  padding: 18px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
#hkc-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 30% 50%, rgba(37,99,235,.2) 0%, transparent 70%);
  pointer-events: none;
}
#hkc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(37,99,235,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(37,99,235,.4);
  position: relative;
  z-index: 1;
}
#hkc-header-text { flex: 1; position: relative; z-index: 1; }
#hkc-header-name {
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
#hkc-header-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
#hkc-header-sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  display: inline-block;
}
#hkc-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  flex-shrink: 0;
  transition: background .15s;
  position: relative;
  z-index: 1;
}
#hkc-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Messages area ──────────────────────────────────────── */
#hkc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F8FAFC;
  scroll-behavior: smooth;
}
#hkc-messages::-webkit-scrollbar { width: 4px; }
#hkc-messages::-webkit-scrollbar-track { background: transparent; }
#hkc-messages::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

/* Bot message */
.hkc-msg-bot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.hkc-msg-bot-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hkc-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hkc-bubble-bot {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px 14px 14px 4px;
  padding: 11px 14px;
  font-size: .855rem;
  color: #1E293B;
  line-height: 1.65;
  max-width: 82%;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.hkc-bubble-bot strong { color: var(--hkc-navy); }
.hkc-bubble-bot a { color: var(--hkc-blue); text-decoration: underline; }
.hkc-bubble-bot ul { padding-left: 16px; margin: 6px 0 0; }
.hkc-bubble-bot li { margin-bottom: 3px; }

/* User message */
.hkc-msg-user {
  display: flex;
  justify-content: flex-end;
}
.hkc-bubble-user {
  background: var(--hkc-blue);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 11px 14px;
  font-size: .855rem;
  line-height: 1.65;
  max-width: 82%;
}

/* Timestamp */
.hkc-ts {
  font-size: .68rem;
  color: #94A3B8;
  text-align: center;
  margin: 4px 0;
}

/* Typing indicator */
#hkc-typing {
  display: none;
  align-items: flex-end;
  gap: 8px;
}
#hkc-typing.show { display: flex; }
.hkc-typing-dots {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px 14px 14px 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.hkc-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  animation: hkc-bounce .9s ease-in-out infinite;
}
.hkc-typing-dots span:nth-child(2) { animation-delay: .15s; }
.hkc-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes hkc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-5px); }
}

/* ── Quick replies ───────────────────────────────────────── */
#hkc-quick {
  padding: 8px 16px 4px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  background: #F8FAFC;
  border-top: 1px solid #F1F5F9;
  flex-shrink: 0;
}
.hkc-quick-btn {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  color: var(--hkc-navy);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--hkc-fn);
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.hkc-quick-btn:hover {
  border-color: var(--hkc-blue);
  background: var(--hkc-blue-lt);
  color: var(--hkc-blue);
}

/* ── Input bar ──────────────────────────────────────────── */
#hkc-input-bar {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
#hkc-input {
  flex: 1;
  border: 1.5px solid #E2E8F0;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: .875rem;
  font-family: var(--hkc-fn);
  color: #1E293B;
  outline: none;
  resize: none;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color .2s;
}
#hkc-input:focus { border-color: var(--hkc-blue); }
#hkc-input::placeholder { color: #94A3B8; }
#hkc-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hkc-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  transition: background .2s, transform .15s;
}
#hkc-send:hover { background: var(--hkc-blue-d); transform: scale(1.05); }
#hkc-send:disabled { background: #CBD5E1; cursor: not-allowed; transform: none; }

/* ── Footer disclaimer ──────────────────────────────────── */
#hkc-footer {
  padding: 6px 14px 8px;
  background: #fff;
  text-align: center;
  font-size: .67rem;
  color: #94A3B8;
  border-top: 1px solid #F1F5F9;
  flex-shrink: 0;
}
#hkc-footer a { color: var(--hkc-acc); text-decoration: none; }

/* ── Intro card ─────────────────────────────────────────── */
.hkc-intro {
  background: linear-gradient(135deg, var(--hkc-navy) 0%, #112A45 100%);
  border-radius: 12px;
  padding: 16px;
  color: #fff;
  margin-bottom: 4px;
}
.hkc-intro-title {
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}
.hkc-intro-text {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  line-height: 1.6;
  margin: 0;
}
.hkc-intro-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.hkc-intro-tag {
  background: rgba(37,99,235,.3);
  color: #93C5FD;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(37,99,235,.4);
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  #hkc-wrap {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 88px;
    height: calc(100vh - 120px);
    max-height: 560px;
  }
  #hkc-trigger { right: 16px; bottom: 20px; }
}
