/* ============================================================
   Live Chat Helpdesk widget — Ensiklopedia Budaya Banua
   ============================================================ */
:root {
  --hd-primary: #293681;
  --hd-primary-dark: #1B2559;
  --hd-agent-bg: #f1f3f9;
  --hd-visitor-bg: #293681;
}

.hd-launcher {
  position: fixed; right: 22px; bottom: 22px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--hd-primary); color: #fff;
  border: none; cursor: pointer; z-index: 1200;
  box-shadow: 0 8px 24px rgba(41,54,129,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; transition: transform .2s ease, background .2s ease;
}
.hd-launcher:hover { transform: translateY(-3px); background: var(--hd-primary-dark); }
.hd-launcher .hd-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #e03131; color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center;
  border: 2px solid #fff; display: none;
}
.hd-launcher .hd-badge.show { display: block; }

.hd-panel {
  position: fixed; right: 22px; bottom: 92px; z-index: 1200;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.24);
  display: none; flex-direction: column;
  font-family: 'Inter', system-ui, sans-serif;
}
.hd-panel.open { display: flex; animation: hdPop .18s ease; }
@keyframes hdPop { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.hd-header {
  background: linear-gradient(135deg, var(--hd-primary), var(--hd-primary-dark));
  color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.hd-header .hd-title { font-weight: 700; font-size: .98rem; line-height: 1.2; }
.hd-header .hd-sub { font-size: .72rem; opacity: .8; }
.hd-header .hd-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #37b24d; box-shadow: 0 0 0 3px rgba(55,178,77,.25); }
.hd-header .hd-close { margin-left: auto; background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; opacity: .85; }
.hd-header .hd-close:hover { opacity: 1; }

.hd-body {
  flex: 1; overflow-y: auto; padding: 16px;
  background: #f7f8fb; display: flex; flex-direction: column; gap: 10px;
}
.hd-intro { text-align: center; color: #7a8194; font-size: .82rem; padding: 12px; }

.hd-msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: .88rem; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }
.hd-msg.visitor { align-self: flex-end; background: var(--hd-visitor-bg); color: #fff; border-bottom-right-radius: 4px; }
.hd-msg.agent   { align-self: flex-start; background: var(--hd-agent-bg); color: #1b2559; border-bottom-left-radius: 4px; }
.hd-msg.system  { align-self: center; background: #fff3cd; color: #856404; font-size: .78rem; }
.hd-msg .hd-meta { display: block; font-size: .66rem; opacity: .7; margin-top: 3px; }

.hd-footer { border-top: 1px solid #eceef3; padding: 10px; background: #fff; }
/* Ringkasan identitas pengunjung (read-only) di dalam chatbox */
.hd-identity {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 8px 14px;
  background: #f4f6fb; border-bottom: 1px solid #e5e9f2;
  font-size: .74rem; color: #55607a;
}
.hd-identity span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hd-identity i { color: var(--hd-primary); font-size: .72rem; }

.hd-namebar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.hd-namebar input { width: 100%; border: 1px solid #dcdfe7; border-radius: 8px; padding: 7px 10px; font-size: .82rem; }
.hd-namebar input:focus { outline: none; border-color: var(--hd-primary); }
.hd-namebar-hint { font-size: .7rem; color: #8a94a6; line-height: 1.3; }
.hd-namebar-hint span { opacity: .8; }
.hd-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.hd-inputrow textarea {
  flex: 1; resize: none; border: 1px solid #dcdfe7; border-radius: 10px;
  padding: 9px 12px; font-size: .88rem; font-family: inherit; max-height: 96px; line-height: 1.4;
}
.hd-inputrow textarea:focus { outline: none; border-color: var(--hd-primary); }
.hd-send {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; border: none;
  background: var(--hd-primary); color: #fff; cursor: pointer; font-size: 1rem;
  transition: background .2s ease;
}
.hd-send:hover { background: var(--hd-primary-dark); }
.hd-send:disabled { opacity: .5; cursor: not-allowed; }

.hd-poweredby { text-align: center; font-size: .66rem; color: #aeb4c2; padding: 4px 0 2px; }

@media (max-width: 480px) {
  .hd-panel { right: 8px; left: 8px; width: auto; bottom: 84px; }
  .hd-launcher { right: 16px; bottom: 16px; }
}
