/* ============================================================
   HOLA — History Outlet Live Assistant (widget obrolan melayang)
   Dimuat SETELAH css/ho.css; memakai variabel --ho-*.
   Struktur: #ho-chat > .ho-chat-teaser + .ho-chat-fab-wrap + .ho-chat-panel
   ============================================================ */
#ho-chat {
  --ho-chat-tepi: 28px;
  position: fixed; right: var(--ho-chat-tepi); bottom: calc(var(--ho-chat-tepi) + var(--ho-chat-naik, 0px)); z-index: 9999;
  display: flex; align-items: flex-end; gap: 14px;
  font-family: var(--ho-sans, "Montserrat", sans-serif);
  font-size: 13px; line-height: 1.5; color: var(--ho-text, #f1ebdd);
  pointer-events: none; /* hanya anak-anaknya yang bisa diklik */
}
#ho-chat *, #ho-chat *::before, #ho-chat *::after { box-sizing: border-box; }
body.mm-open #ho-chat { opacity: 0; pointer-events: none; } /* menu HP (mmenu) sedang terbuka: widget minggir */
/* --ho-chat-naik diisi ho-chat.js saat tombol harus naik supaya tidak menutupi kontrol halaman */
#ho-chat { transition: opacity .25s, bottom .35s cubic-bezier(.2, .8, .2, 1); }
#ho-chat.ho-chat--tembus, #ho-chat.ho-chat--tembus * { pointer-events: none !important; } /* sesaat, saat memeriksa */
#ho-chat > * { pointer-events: auto; }
#ho-chat button {
  -webkit-appearance: none; appearance: none; margin: 0; padding: 0;
  border: 0; background: none; font: inherit; color: inherit; cursor: pointer; line-height: 1;
}
#ho-chat button:focus { outline: none; }
#ho-chat button:focus-visible { outline: 2px solid var(--ho-gold, #e1bf5f); outline-offset: 2px; }
#ho-chat img { display: block; max-width: none; }
#ho-chat p { margin: 0; }
.ho-chat-gold {
  background: var(--ho-gold-text, linear-gradient(180deg, #f6e3a4, #c6a458 55%, #9a7832));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- tombol bundar (FAB) ---------- */
.ho-chat-fab-wrap {
  position: relative; width: 64px; height: 64px; flex: 0 0 auto;
  animation: ho-chat-bob 3s ease-in-out infinite;
}
.ho-chat-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(225, 191, 95, .9);
  animation: ho-chat-sonar 2.4s cubic-bezier(.2, .6, .3, 1) infinite;
  pointer-events: none;
}
.ho-chat-ring:nth-child(2) { animation-delay: 1.2s; }
/* tombol-tombol diberi awalan #ho-chat agar menang dari reset #ho-chat button di atas */
#ho-chat .ho-chat-fab {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent;
  background: linear-gradient(var(--ho-bg-2, #0d0c0b), var(--ho-bg-2, #0d0c0b)) padding-box,
              var(--ho-gold-grad, linear-gradient(135deg, #f7e187, #a97b29)) border-box;
  box-shadow: 0 12px 32px rgba(231, 184, 58, .25), 0 6px 18px rgba(0, 0, 0, .6), inset 0 0 18px rgba(225, 191, 95, .08);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}
#ho-chat .ho-chat-fab:hover { transform: scale(1.06); box-shadow: 0 16px 40px rgba(231, 184, 58, .38), 0 8px 22px rgba(0, 0, 0, .6); }
#ho-chat .ho-chat-fab:active { transform: scale(.97); }
.ho-chat-fab img { width: 44px; height: 44px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); transition: transform .3s, opacity .3s; }
.ho-chat-fab svg { position: absolute; width: 24px; height: 24px; color: var(--ho-gold, #e1bf5f); opacity: 0; transform: rotate(-90deg) scale(.6); transition: transform .3s, opacity .3s; }
.ho-chat-online {
  position: absolute; right: 3px; bottom: 5px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ho-gold, #e1bf5f); border: 2px solid var(--ho-bg-2, #0d0c0b); z-index: 2; pointer-events: none;
}
.ho-chat-online::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 1.5px solid var(--ho-gold, #e1bf5f); animation: ho-chat-pulse 1.8s ease-out infinite;
}
/* saat panel terbuka: tenang (tanpa sonar/bob), segel berganti panah tutup */
.is-open .ho-chat-fab-wrap { animation: none; }
.is-open .ho-chat-ring { animation: none; opacity: 0; }
.is-open .ho-chat-fab img { opacity: 0; transform: scale(.5) rotate(40deg); }
.is-open .ho-chat-fab svg { opacity: 1; transform: none; }

/* ---------- kartu ajakan (teaser) ---------- */
.ho-chat-teaser {
  position: relative; max-width: 300px; margin-bottom: 18px; padding: 13px 34px 14px 14px;
  background: rgba(13, 12, 11, .94);
  border: 1px solid rgba(225, 191, 95, .35);
  border-radius: 16px 16px 6px 16px; /* sudut kanan-bawah menunjuk ke tombol */
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 0 30px rgba(231, 184, 58, .06);
  overflow: hidden; cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateX(26px);
  transition: opacity .55s, transform .55s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .55s;
}
.ho-chat-teaser.is-in { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ho-chat-teaser::before { /* garis kilau emas di tepi atas */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent 30%, rgba(247, 225, 135, .95) 50%, transparent 70%);
  background-size: 300% 100%; background-position: 100% 0;
  animation: ho-chat-shimmer 2.8s linear infinite;
}
.ho-chat-teaser-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.ho-chat-teaser-head img { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
.ho-chat-name { font-family: var(--ho-serif, "Playfair Display", serif); font-weight: 600; letter-spacing: .1em; line-height: 1.1; }
.ho-chat-teaser .ho-chat-name { font-size: 15px; }
.ho-chat-status {
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ho-muted, #a79f8f); line-height: 1.2;
}
.ho-chat-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #b4d36a; flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(180, 211, 106, .6); animation: ho-chat-dot 2s ease-out infinite;
}
.ho-chat-teaser-msg { min-height: 39px; font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--ho-text, #f1ebdd); transition: opacity .25s; }
.ho-chat-teaser-msg.is-out { opacity: 0; }
.ho-chat-word {
  display: inline-block; opacity: 0; transform: translateY(10px); filter: blur(4px);
  animation: ho-chat-fly .55s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}
#ho-chat .ho-chat-teaser-x {
  position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--ho-dim, #6f685b);
  transition: color .2s, background .2s;
}
#ho-chat .ho-chat-teaser-x:hover { color: var(--ho-gold, #e1bf5f); background: rgba(225, 191, 95, .12); }
.ho-chat-teaser-x svg { width: 11px; height: 11px; }

/* ---------- panel obrolan ---------- */
.ho-chat-panel {
  position: absolute; right: 0; bottom: 78px; /* 64 tombol + 14 jarak */
  width: 370px; height: 560px; max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--ho-bg-2, #0d0c0b);
  border: 1px solid rgba(225, 191, 95, .28); border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .5), 0 10px 50px rgba(231, 184, 58, .10);
  overflow: hidden;
  transform-origin: 100% 100%; transform: scale(.9); opacity: 0; visibility: hidden;
  transition: transform .26s cubic-bezier(.2, .8, .2, 1), opacity .26s, visibility 0s linear .26s;
}
.is-open .ho-chat-panel { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.is-open .ho-chat-teaser { opacity: 0; visibility: hidden; transform: translateX(26px); }

.ho-chat-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 11px 16px; flex: 0 0 auto;
  border-bottom: 1px solid rgba(225, 191, 95, .16);
  background: linear-gradient(180deg, #151310 0%, var(--ho-bg-2, #0d0c0b) 100%);
}
.ho-chat-ava {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(225, 191, 95, .45); background: var(--ho-bg, #070707);
  box-shadow: 0 0 14px rgba(231, 184, 58, .18);
}
.ho-chat-ava img { width: 30px; height: 30px; }
.ho-chat-head-txt { flex: 1 1 auto; min-width: 0; }
.ho-chat-head .ho-chat-name { font-size: 20px; }
.ho-chat-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; color: var(--ho-muted, #a79f8f); letter-spacing: .02em; }
#ho-chat .ho-chat-close {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ho-muted, #a79f8f); transition: color .2s, background .2s;
}
#ho-chat .ho-chat-close:hover { color: var(--ho-gold, #e1bf5f); background: rgba(225, 191, 95, .1); }
.ho-chat-close svg { width: 14px; height: 14px; }

.ho-chat-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 12px 8px;
  display: flex; flex-direction: column; gap: 8px;
  background: radial-gradient(70% 35% at 50% 0%, rgba(225, 191, 95, .06), transparent 70%);
  scrollbar-width: thin; scrollbar-color: rgba(225, 191, 95, .3) transparent;
}
.ho-chat-body::-webkit-scrollbar { width: 6px; }
.ho-chat-body::-webkit-scrollbar-thumb { background: rgba(225, 191, 95, .3); border-radius: 3px; }
.ho-chat-day {
  align-self: center; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ho-dim, #6f685b);
  display: flex; align-items: center; gap: 10px; margin-bottom: 2px;
}
.ho-chat-day::before, .ho-chat-day::after { content: ""; width: 28px; height: 1px; background: rgba(225, 191, 95, .2); }
.ho-chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; animation: ho-chat-msg .35s cubic-bezier(.2, .8, .2, 1) both; }
.ho-chat-msg.is-user { align-self: flex-end; flex-direction: row-reverse; }
.ho-chat-msg-ava { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(225, 191, 95, .35); background: var(--ho-bg, #070707); display: flex; align-items: center; justify-content: center; }
.ho-chat-msg-ava img { width: 16px; height: 16px; }
.ho-chat-msg.is-bot + .ho-chat-msg.is-bot .ho-chat-msg-ava { visibility: hidden; } /* avatar hanya di gelembung pertama beruntun */
.ho-chat-bubble {
  padding: 9px 12px; font-size: 13px; line-height: 1.5; min-width: 0;
  background: var(--ho-surface, #121110); color: var(--ho-text, #f1ebdd);
  border: 1px solid rgba(225, 191, 95, .18); border-radius: 14px 14px 14px 4px;
}
.is-user .ho-chat-bubble {
  background: var(--ho-gold-grad, linear-gradient(135deg, #f7e187, #e7b83a 45%, #a97b29)); color: #141108; font-weight: 500;
  border: 0; border-radius: 14px 14px 4px 14px; box-shadow: 0 8px 22px rgba(231, 184, 58, .18);
}
.ho-chat-bubble p + p, .ho-chat-bubble .ho-chat-card + p { margin-top: 8px; }
.ho-chat-card {
  display: flex; align-items: center; gap: 10px; padding: 8px; text-decoration: none; color: inherit;
  background: rgba(7, 7, 7, .75); border: 1px solid rgba(225, 191, 95, .22); border-radius: 10px;
  transition: border-color .2s, background .2s;
}
.ho-chat-card:hover { border-color: rgba(225, 191, 95, .55); background: rgba(7, 7, 7, .95); color: inherit; }
.ho-chat-card img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.ho-chat-card-t { font-family: var(--ho-serif, "Playfair Display", serif); font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ho-text, #f1ebdd); }
.ho-chat-card-m { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 10px; letter-spacing: .04em; color: var(--ho-gold, #e1bf5f); line-height: 1.3; }
.ho-chat-card-m svg { width: 11px; height: 11px; flex: 0 0 auto; }
.ho-chat-card-m.ho-chat-card-no { color: var(--ho-muted, #a9a295); margin-top: 3px; }
.ho-chat-typing { display: flex; align-items: center; gap: 4px; padding: 11px 13px; }
.ho-chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ho-gold, #e1bf5f); animation: ho-chat-dots 1.2s ease-in-out infinite; }
.ho-chat-typing i:nth-child(2) { animation-delay: .15s; }
.ho-chat-typing i:nth-child(3) { animation-delay: .3s; }

/* balasan cepat: satu baris, bisa digeser mendatar (bilah gulir disembunyikan) */
.ho-chat-chips {
  display: flex; flex-wrap: nowrap; gap: 6px; padding: 8px 30px 2px 14px; flex: 0 0 auto;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border-top: 1px solid rgba(225, 191, 95, .1);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); /* isyarat bisa digeser */
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.ho-chat-chips::-webkit-scrollbar { display: none; }
#ho-chat .ho-chat-chip {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 11px; font-weight: 500; letter-spacing: .02em; white-space: nowrap;
  color: var(--ho-gold, #e1bf5f); border: 1px solid rgba(225, 191, 95, .5); background: rgba(225, 191, 95, .04);
  transition: background .2s, color .2s, border-color .2s;
}
#ho-chat .ho-chat-chip:hover { background: var(--ho-gold-grad, linear-gradient(135deg, #f7e187, #a97b29)); color: #141108; border-color: transparent; }

.ho-chat-foot { display: flex; align-items: center; gap: 8px; padding: 8px 14px 5px; margin: 0; flex: 0 0 auto; }
.ho-chat-input {
  -webkit-appearance: none; appearance: none; flex: 1 1 auto; min-width: 0; height: 40px; margin: 0; padding: 0 16px;
  border-radius: 999px; font: 500 13px/1 var(--ho-sans, "Montserrat", sans-serif); color: var(--ho-text, #f1ebdd);
  background: var(--ho-bg, #070707); border: 1px solid rgba(225, 191, 95, .22); box-shadow: none; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ho-chat-input::placeholder { color: var(--ho-dim, #6f685b); opacity: 1; }
.ho-chat-input:focus { border-color: var(--ho-gold, #e1bf5f); box-shadow: 0 0 0 3px rgba(225, 191, 95, .18); outline: none; }
/* style.css menyembunyikan placeholder saat fokus; di sini tetap tampil redup */
#ho-chat .ho-chat-input:focus::placeholder { color: var(--ho-dim, #6f685b); opacity: 1; }
#ho-chat .ho-chat-input:focus::-webkit-input-placeholder { color: var(--ho-dim, #6f685b); opacity: 1; }
#ho-chat .ho-chat-send {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: var(--ho-gold-grad, linear-gradient(135deg, #f7e187, #a97b29)); color: #141108;
  box-shadow: 0 6px 16px rgba(231, 184, 58, .25); transition: transform .2s, filter .2s;
}
#ho-chat .ho-chat-send:hover { transform: scale(1.06); filter: brightness(1.06); }
#ho-chat .ho-chat-send:active { transform: scale(.95); }
.ho-chat-send svg { width: 17px; height: 17px; margin-left: 1px; }
.ho-chat-note { padding: 0 14px 9px; text-align: center; font-size: 10px; line-height: 1.3; letter-spacing: .02em; color: var(--ho-dim, #6f685b); flex: 0 0 auto; }

/* ---------- animasi ---------- */
@keyframes ho-chat-sonar { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes ho-chat-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ho-chat-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.3); opacity: 0; } }
@keyframes ho-chat-shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes ho-chat-fly { to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes ho-chat-dot { 0% { box-shadow: 0 0 0 0 rgba(180, 211, 106, .55); } 100% { box-shadow: 0 0 0 6px rgba(180, 211, 106, 0); } }
@keyframes ho-chat-dots { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes ho-chat-msg { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- HP ---------- */
@media (max-width: 576px) {
  #ho-chat { --ho-chat-tepi: 18px; gap: 10px; }
  .ho-chat-fab-wrap, #ho-chat .ho-chat-fab { width: 56px; height: 56px; }
  .ho-chat-fab img { width: 38px; height: 38px; }
  .ho-chat-online { right: 2px; bottom: 3px; width: 12px; height: 12px; }
  .ho-chat-teaser { max-width: calc(100vw - 100px); margin-bottom: 14px; }
  .ho-chat-panel {
    position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; height: 78vh; max-height: none;
  }
  /* saat terbuka, tombol disembunyikan agar tak menutupi kolom tulis */
  .is-open .ho-chat-fab-wrap { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s linear .2s; }
  .ho-chat-head .ho-chat-name { font-size: 18px; }
  .ho-chat-msg { max-width: 90%; }
}

/* ---------- kurangi gerak ---------- */
@media (prefers-reduced-motion: reduce) {
  .ho-chat-fab-wrap, .ho-chat-ring, .ho-chat-online::after, .ho-chat-teaser::before, .ho-chat-dot, .ho-chat-typing i, .ho-chat-msg { animation: none; }
  .ho-chat-ring { opacity: .35; }
  .ho-chat-typing i { opacity: .7; }
  .ho-chat-word { animation: none; opacity: 1; transform: none; filter: none; }
  .ho-chat-teaser, .ho-chat-panel, #ho-chat .ho-chat-fab { transition: none; }
  #ho-chat { transition: opacity .25s; }
}
