/* ===== Asisten AI pengunjung halaman depan (/js/public-assistant.js) =====
   Halaman depan selalu bertema terang; warna mengikuti variabel --g / --b1 dari landing.ejs. */
.pa-root { --pa1: var(--b1, #0891b2); --pa2: var(--b3, #094dc1); --pa-text: var(--text, #0f172a); --pa-muted: var(--muted, #64748b); --pa-line: var(--line, #e2e8f0); --pa-soft: var(--soft, #f1f5f9); }
.pa-fab { position: fixed; right: 18px; bottom: 18px; z-index: 41; height: 52px; padding: 0 18px 0 16px; border: 0; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: #fff; font: inherit; font-weight: 700; font-size: 14px; background: var(--g, linear-gradient(135deg, var(--pa1), var(--pa2))); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--pa1) 70%, transparent); }
.pa-fab i { font-size: 20px; }
.pa-root.open .pa-fab { display: none; }

.pa-panel { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: min(380px, calc(100vw - 28px)); height: min(580px, calc(100vh - 36px)); display: none; flex-direction: column; overflow: hidden; border-radius: 20px; background: #fff; color: var(--pa-text); border: 1px solid var(--pa-line); box-shadow: 0 28px 60px -18px rgba(15, 23, 42, .4); }
.pa-root.open .pa-panel { display: flex; }

.pa-hd { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; color: #fff; background: var(--g, linear-gradient(135deg, var(--pa1), var(--pa2))); }
.pa-hd-ico { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; background: rgba(255, 255, 255, .18); }
.pa-hd-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pa-hd-tx b { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-hd-tx span { font-size: 11.5px; opacity: .85; }
.pa-x { width: 32px; height: 32px; border: 0; border-radius: 10px; cursor: pointer; color: #fff; background: transparent; font-size: 14px; }
.pa-x:hover { background: rgba(255, 255, 255, .18); }

.pa-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--pa-soft); }
.pa-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.pa-user { align-self: flex-end; color: #fff; background: var(--pa1); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.pa-bot { align-self: flex-start; background: #fff; border: 1px solid var(--pa-line); border-bottom-left-radius: 5px; }
.pa-err { align-self: flex-start; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.pa-bot p { margin: 0 0 6px; }
.pa-bot p:last-child { margin-bottom: 0; }
.pa-bot ul, .pa-bot ol { margin: 2px 0 6px; padding-left: 18px; }
.pa-bot a { color: var(--pa1); font-weight: 700; text-decoration: underline; }
.pa-group { align-self: flex-start; max-width: 88%; display: flex; flex-direction: column; gap: 6px; }
.pa-group > .pa-msg { max-width: 100%; align-self: flex-start; }
.pa-handoff { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; color: #fff; text-decoration: none; background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 10px 22px -12px rgba(22, 163, 74, .8); }
.pa-handoff:hover { filter: brightness(1.05); }
.pa-handoff > i:first-child { font-size: 22px; }
.pa-handoff > i:last-child { margin-left: auto; font-size: 22px; }
.pa-handoff span { display: flex; flex-direction: column; line-height: 1.3; }
.pa-handoff b { font-size: 13.5px; }
.pa-handoff small { font-size: 11.5px; opacity: .9; }
.pa-empty { display: flex; flex-direction: column; gap: 10px; }
.pa-sg { display: flex; flex-direction: column; gap: 6px; }
.pa-sg button { text-align: left; padding: 9px 12px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--pa-text); background: #fff; border: 1px solid var(--pa-line); }
.pa-sg button:hover { border-color: var(--pa1); color: var(--pa1); }
.pa-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.pa-typing span { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: paDot 1s infinite ease-in-out; }
.pa-typing span:nth-child(2) { animation-delay: .15s; }
.pa-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes paDot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.pa-wa { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; font-size: 12.5px; font-weight: 700; color: #15803d; background: #f0fdf4; border-top: 1px solid var(--pa-line); text-decoration: none; }
.pa-wa:hover { background: #dcfce7; }
.pa-ft { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--pa-line); background: #fff; }
.pa-ft textarea { flex: 1; resize: none; min-height: 40px; max-height: 110px; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 14px; line-height: 1.4; color: var(--pa-text); background: var(--pa-soft); border: 1px solid var(--pa-line); outline: none; }
.pa-ft textarea:focus { border-color: var(--pa1); }
.pa-send { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 12px; cursor: pointer; color: #fff; font-size: 15px; background: var(--pa1); }
.pa-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 520px) {
  .pa-fab span { display: none; }
  .pa-fab { width: 52px; padding: 0; justify-content: center; }
  .pa-panel { right: 0; left: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) { .pa-typing span { animation: none; } }
@media print { .pa-root { display: none !important; } }
