/* Jendela "Asisten mesin" di tombol bantuan kanan bawah (layouts/storefront.blade.php).
 * Dimuat hanya bila BOT_CHAT_URL terisi. Isi percakapan diatur js/heavypack-asisten.js. */
.hp-asisten { display: flex; flex-direction: column; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); height: min(560px, calc(100dvh - 120px)); overflow: hidden; border-radius: 22px; color: #242424; background: #fff; box-shadow: 0 26px 64px rgba(0,0,0,.26), 0 0 0 1px rgba(36,36,36,.06); animation: hp-help-masuk .3s var(--hp-ease, ease) both; }
.hp-asisten[hidden] { display: none; }
/* Selama jendela asisten terbuka, tombol bantuan naik di atas header dan menu lengket halaman
   (mis. .hp-resource-nav z-index 80), supaya bagian atas jendela tidak tertutup. */
.hp-help.is-bot { z-index: 1000; }

.hp-asisten__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px; border-bottom: 1px solid rgba(36,36,36,.08); }
.hp-asisten__avatar { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; background: var(--hp-orange, #ff6600); font-size: 18px; }
.hp-asisten__title { flex: 1 1 auto; min-width: 0; }
.hp-asisten__title strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.hp-asisten__title small { display: flex; align-items: center; gap: 6px; color: #6e6e73; font-size: 12px; line-height: 1.4; }
.hp-asisten__title small::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22a55a; }

.hp-asisten__log { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 14px; overflow-y: auto; overscroll-behavior: contain; background: #f5f5f7; }
.hp-asisten__msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; white-space: normal; }
.hp-asisten__msg--bot { align-self: flex-start; border-bottom-left-radius: 6px; color: #242424; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.hp-asisten__msg--user { align-self: flex-end; border-bottom-right-radius: 6px; color: #fff; background: #242424; }
.hp-asisten__msg--info { align-self: center; max-width: 100%; padding: 8px 12px; border-radius: 12px; color: #8a4b00; background: #fff4e5; font-size: 13px; text-align: center; }
.hp-asisten__msg strong { font-weight: 700; }
.hp-asisten__msg a { color: #c74f00; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.hp-asisten__msg a:hover { color: #242424; }
.hp-asisten__msg a.hp-asisten__link { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; padding: 5px 11px; border-radius: 999px; color: #c74f00; background: rgba(255,102,0,.1); font-size: 13px; text-decoration: none; }
.hp-asisten__msg a.hp-asisten__link:hover { color: #fff; background: var(--hp-orange, #ff6600); }
.hp-asisten__msg a.hp-asisten__link--wa { color: #146c3c; background: #e3f6ea; }
.hp-asisten__msg a.hp-asisten__link--wa:hover { color: #fff; background: #1fa855; }

.hp-asisten__typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.hp-asisten__typing span { width: 7px; height: 7px; border-radius: 50%; background: #b0b0b5; animation: hp-asisten-titik 1.2s infinite ease-in-out; }
.hp-asisten__typing span:nth-child(2) { animation-delay: .15s; }
.hp-asisten__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hp-asisten-titik { 0%, 80%, 100% { opacity: .35; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.hp-asisten__saran { display: flex; flex-wrap: wrap; gap: 8px; align-self: stretch; }
.hp-asisten__saran button { padding: 8px 12px; border: 1px solid rgba(255,102,0,.35); border-radius: 999px; color: #c74f00; background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.hp-asisten__saran button:hover { color: #fff; border-color: var(--hp-orange, #ff6600); background: var(--hp-orange, #ff6600); }

.hp-asisten__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 8px; border-top: 1px solid rgba(36,36,36,.08); background: #fff; }
.hp-asisten__form textarea { flex: 1 1 auto; min-height: 44px; max-height: 120px; padding: 11px 14px; border: 1px solid rgba(36,36,36,.14); border-radius: 22px; color: #242424; background: #f5f5f7; font: inherit; font-size: 16px; line-height: 1.35; resize: none; overflow-y: hidden; }
.hp-asisten__form textarea:focus { border-color: var(--hp-orange, #ff6600); outline: none; background: #fff; box-shadow: 0 0 0 3px rgba(255,102,0,.15); }
.hp-asisten__form button { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: var(--hp-orange, #ff6600); font-size: 16px; cursor: pointer; transition: background .2s, opacity .2s; }
.hp-asisten__form button:hover { background: var(--hp-orange-dark, #e65c00); }
.hp-asisten__form button:disabled { opacity: .45; cursor: default; }
.hp-asisten__form button:focus-visible { outline: 3px solid #242424; outline-offset: 2px; }
.hp-asisten__note { margin: 0; padding: 0 16px 12px; color: #6e6e73; font-size: 11.5px; line-height: 1.45; }
.hp-asisten__note a { color: #146c3c; font-weight: 700; }
.hp-asisten__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* HP: jendela asisten memenuhi layar seperti aplikasi chat. Saat keyboard muncul, browser HP tidak
   memperkecil halaman (100dvh tetap), hanya area yang terlihat (visualViewport), dan iPhone menggeser
   layar ke atas sehingga kepala jendela terdorong keluar. Karena itu tinggi dan posisi atasnya diikutkan
   ke area terlihat lewat --hp-asisten-h dan --hp-asisten-top (diatur js/heavypack-asisten.js): kolom tulis
   tepat di atas keyboard, kepala jendela tetap terlihat, dan halaman di belakang tidak ikut bergulir. */
@media (max-width: 760px) {
    body .hp-help.is-bot { top: var(--hp-asisten-top, 0px); right: 0; bottom: auto; left: 0; height: 100vh; height: var(--hp-asisten-h, 100dvh); gap: 0; transition: none; }
    .hp-help.is-bot .hp-help__toggle { display: none; }
    .hp-asisten { flex: 1 1 auto; width: 100%; height: auto; min-height: 0; border-radius: 0; box-shadow: none; animation-name: hp-asisten-naik; }
    .hp-asisten__head { padding-top: max(12px, env(safe-area-inset-top)); }
    .hp-asisten__note { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    /* Selama keyboard terbuka ruangnya sempit: catatan di bawah form (sudah terbaca saat jendela dibuka)
       disembunyikan dan kepala jendela dirapatkan, supaya percakapan tetap kelihatan. */
    .hp-help.is-keyboard .hp-asisten__note { display: none; }
    .hp-help.is-keyboard .hp-asisten__head { padding-top: 8px; padding-bottom: 8px; }
    .hp-help.is-keyboard .hp-asisten__avatar { width: 34px; height: 34px; font-size: 16px; }
    .hp-help.is-keyboard .hp-asisten__title small { display: none; }
    .hp-help.is-keyboard .hp-asisten__form { padding-bottom: 10px; }
    html.hp-asisten-layar, html.hp-asisten-layar body { overflow: hidden; }
}
@keyframes hp-asisten-naik { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .hp-asisten { animation: none; }
    .hp-asisten__typing span { animation: none; }
}
