/* Oryzenx — AI assistant (compact popup) */
.chat-greet { position: relative; max-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 4px 16px; padding: .6rem 1.8rem .6rem .75rem; box-shadow: var(--shadow); font-size: .82rem; display: grid; gap: .1rem; animation: popIn .3s var(--ease); }
.chat-greet span { color: var(--text-muted); }
.chat-greet-x { position: absolute; top: 4px; right: 4px; border: 0; background: none; color: var(--text-muted); width: 22px; height: 22px; border-radius: 6px; font-size: .75rem; }

.fab-chat .fab-ic-close { display: none; }
.fab-chat[aria-expanded="true"] .fab-ic-open { display: none; }
.fab-chat[aria-expanded="true"] .fab-ic-close { display: inline; }
.fab-chat[aria-expanded="true"] .fab-badge { display: none; }
.fab-chat::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(var(--primary-rgb), .45); animation: egPulse 2.4s ease-out infinite; pointer-events: none; }
.fab-chat[aria-expanded="true"]::before { display: none; }

/* Back-to-top above the chat button: gentle bounce, colour change on click */
.fab-top i { animation: topBob 1.8s ease-in-out infinite; }
@keyframes topBob { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-3px); } }
.fab-top.flying { background: linear-gradient(135deg, var(--primary), var(--accent)) !important; color: #fff !important; border-color: transparent !important; box-shadow: 0 8px 20px -6px rgba(var(--primary-rgb), .8); }
.fab-top.flying i { animation: topFly .6s ease-in infinite; }
@keyframes topFly { 0% { transform: translateY(6px); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }
@keyframes egPulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@keyframes popIn { from { transform: scale(.9); opacity: 0; } }

.chat-panel {
  position: fixed; z-index: 760; right: 10px; bottom: calc(var(--bnav-h) + 82px + env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 20px)); height: min(580px, calc(100dvh - var(--bnav-h) - 130px)); background: var(--surface);
  border-radius: 22px; border: 1px solid var(--border); box-shadow: 0 24px 60px -16px rgba(15, 23, 42, .45);
  display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right; animation: chatIn .28s var(--ease);
}
@keyframes chatIn { from { opacity: 0; transform: translateY(14px) scale(.92); } }
.chat-head { display: flex; align-items: center; gap: .5rem; padding: .65rem .6rem .65rem .75rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.chat-avatar { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.18); flex: none; }
.chat-avatar .online-dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.chat-meta { display: grid; line-height: 1.25; flex: 1; min-width: 0; }
.chat-meta strong { font-size: .98rem; }
.chat-meta small { font-size: .7rem; opacity: .85; }
.chat-hbtn { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: .85rem; flex: none; }
.chat-hbtn:hover { background: rgba(255,255,255,.28); color: #fff; }
.chat-human { background: #25d366; }
.chat-human:hover { background: #1ebe5a; }
.chat-body { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .45rem; background: var(--surface-soft); overscroll-behavior: contain; }
.msg { display: flex; align-items: flex-end; gap: .35rem; }
.msg .bubble { max-width: 82%; padding: .5rem .7rem; border-radius: 16px; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; animation: msgIn .2s var(--ease); }
.msg-bot .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg-user { justify-content: flex-end; }
.msg-user .bubble { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-bottom-right-radius: 5px; }
.msg .bubble a { color: inherit; text-decoration: underline; }
.wa-chip { display: inline-flex !important; align-items: center; gap: .4rem; margin-top: .45rem; padding: .35rem .7rem; border-radius: 999px; background: #25d366; color: #fff !important; text-decoration: none !important; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.wa-chip i { font-size: 1rem; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } }
.typing { display: inline-flex; gap: 3px; padding: .2rem 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.chat-quick { display: flex; gap: .35rem; overflow-x: auto; padding: .45rem .6rem 0; scrollbar-width: none; background: var(--surface); }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick .chip { height: 27px; font-size: .74rem; }
.chat-form { display: flex; gap: .4rem; padding: .5rem .55rem .6rem; background: var(--surface); }
.chat-form input { flex: 1; height: 40px; border-radius: 14px; border: 1px solid var(--border); padding: 0 .85rem; background: var(--surface-soft); font-size: 16px; outline: none; min-width: 0; }
.chat-form input:focus { border-color: var(--primary); }
.chat-send { width: 40px; height: 40px; border-radius: 14px; border: 0; color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); display: grid; place-items: center; }
.chat-send:active { transform: scale(.92); }
@media (min-width: 992px) { .chat-panel { right: 20px; bottom: 84px; width: 420px; height: min(620px, calc(100vh - 120px)); } }
