/* QCH Assistant widget */
.qa { position: fixed; right: 20px; bottom: 20px; z-index: 9990; font-family: inherit; color: #2a2224; }
.qa *, .qa *::before, .qa *::after { box-sizing: border-box; }
.qa-fab { position: relative; display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%; background: var(--accent, #ff5500); color: #fff; box-shadow: 0 12px 28px -8px rgba(0,0,0,.5); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.qa-fab::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent, #ff5500); animation: qa-ring 2.6s ease-out infinite; pointer-events: none; }
.qa-fab:hover { transform: scale(1.07); box-shadow: 0 16px 32px -8px rgba(0,0,0,.55); }
.qa-fab-badge { position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #1e1b1a; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; display: grid; place-items: center; border: 2px solid #fff; }
@keyframes qa-ring { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
/* keep clear of the admin toolbar helpers (e.g. the hosting "Agent" button) while logged in */
body.admin-bar .qa { bottom: 86px; }
.qa.is-open .qa-fab { display: none; }
.qa-tip { position: absolute; right: 4px; bottom: 72px; max-width: 220px; padding: 10px 14px; background: #fff; border: 1px solid var(--line, #e8e0db); border-radius: 14px 14px 4px 14px; font-size: 13px; font-weight: 600; box-shadow: 0 12px 28px -12px rgba(0,0,0,.35); cursor: pointer; animation: qa-pop .35s ease; }
.qa-tip[hidden], .qa-panel[hidden] { display: none; }

.qa-panel { position: absolute; right: 0; bottom: 0; width: 380px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100dvh - 36px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line, #e8e0db); border-radius: 18px; overflow: hidden; box-shadow: 0 28px 60px -20px rgba(30,15,10,.55); opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right; transition: opacity .22s ease, transform .22s ease; }
.qa.is-open .qa-panel { opacity: 1; transform: none; }
.qa-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: #1e1b1a; color: #fff; }
.qa-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent, #ff5500); font-size: 11px; font-weight: 800; letter-spacing: .5px; flex: none; }
.qa-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.qa-head-text small { opacity: .7; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-icon { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; cursor: pointer; }
.qa-icon:hover { background: rgba(255,255,255,.22); }

.qa-list { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: #fbf7f3; overscroll-behavior: contain; }
.qa-row { display: flex; flex-direction: column; max-width: 100%; animation: qa-pop .25s ease; }
.qa-me { align-items: flex-end; }
.qa-bot { align-items: flex-start; }
.qa-bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.qa-bubble p { margin: 0; }
.qa-bubble p + p, .qa-bubble ul + p, .qa-bubble p + ul { margin-top: 6px; }
.qa-bubble ul { margin: 0; padding-left: 18px; }
.qa-bubble a { color: inherit; text-decoration: underline; word-break: break-all; }
.qa-me .qa-bubble { background: var(--accent, #ff5500); color: #fff; border-bottom-right-radius: 4px; }
.qa-bot .qa-bubble { background: #fff; border: 1px solid var(--line, #e8e0db); border-bottom-left-radius: 4px; }
.qa-action { display: inline-block; margin-top: 10px; padding: 8px 14px; border-radius: 30px; background: #1e1b1a; color: #fff !important; text-decoration: none !important; font-size: 13px; font-weight: 700; word-break: normal !important; }

.qa-cards { display: flex; gap: 10px; overflow-x: auto; margin-top: 8px; padding-bottom: 6px; max-width: 100%; scroll-snap-type: x proximity; }
.qa-card { flex: 0 0 150px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; padding: 8px; border: 1px solid var(--line, #e8e0db); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; font-size: 12.5px; }
.qa-card img, .qa-noimg { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; background: #eee; display: block; }
.qa-card b { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qa-card span { color: #6d6164; }
.qa-card em { font-style: normal; font-weight: 700; color: var(--accent, #ff5500); margin-top: 2px; }

.qa-typing .qa-bubble { display: flex; gap: 5px; padding: 14px 16px; }
.qa-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b5a9a0; animation: qa-dot 1s infinite ease-in-out; }
.qa-typing i:nth-child(2) { animation-delay: .15s; }
.qa-typing i:nth-child(3) { animation-delay: .3s; }

.qa-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; background: #fbf7f3; border-top: 1px solid var(--line, #e8e0db); scrollbar-width: none; }
.qa-chips::-webkit-scrollbar { display: none; }
.qa-chip { flex: none; padding: 8px 14px; border-radius: 30px; border: 1px solid var(--line, #e8e0db); background: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.qa-chip:hover { border-color: var(--accent, #ff5500); color: var(--accent, #ff5500); }

.qa-form { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line, #e8e0db); }
.qa-form input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 1px solid var(--line, #e8e0db); border-radius: 30px; font-size: 16px; background: #fff; }
.qa-form input:focus { outline: 2px solid var(--accent, #ff5500); outline-offset: 1px; }
.qa-send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent, #ff5500); color: #fff; font-size: 16px; cursor: pointer; flex: none; }
.qa-send:disabled { opacity: .45; cursor: wait; }
.qa-human { display: block; padding: 9px 12px 12px; text-align: center; font-size: 12.5px; font-weight: 700; color: #128c4a; text-decoration: none; background: #fff; }
.qa-human:hover { text-decoration: underline; }

@keyframes qa-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes qa-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

@media (max-width: 600px) {
	.qa { right: 14px; bottom: 14px; }
	body.admin-bar .qa { bottom: 80px; }
	.qa.is-open { inset: 0; right: 0; bottom: 0; }
	.qa-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom, 0); }
	.qa-head { padding-top: calc(14px + env(safe-area-inset-top, 0)); }
	.qa-bubble { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
	.qa-panel, .qa-row, .qa-tip, .qa-fab { transition: none; animation: none; }
	.qa-typing i, .qa-fab::after { animation: none; }
}

