/* Khung chat Hoa Chat (kiểu Messenger) */
.hch, .hch * { box-sizing: border-box; }
.hch { --c: var(--hoa-primary, #DB4F7E); --ink: #3A3335; --mut: #73696d; --bg: #f4f0f2; position: fixed; bottom: 18px; z-index: 99990; font: 15px/1.45 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); }
.hch.r { right: 18px; } .hch.l { left: 18px; }
.hch-fab { width: var(--fab, 60px); height: var(--fab, 60px); border-radius: 50%; border: 0; background: var(--c); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(58, 51, 53, .28); position: relative; transition: transform .2s; }
.hch-fab:hover { transform: scale(1.06); }
.hch-fab svg { width: calc(var(--fab, 60px) * .5); height: calc(var(--fab, 60px) * .5); }
.hch-fab:focus-visible, .hch button:focus-visible, .hch input:focus-visible { outline: 3px solid #2459c9; outline-offset: 2px; }
.hch-dot { position: absolute; top: 2px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e0245e; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; border: 2px solid #fff; }
.hch-hello { position: absolute; bottom: calc(var(--fab, 60px) + 10px); width: 230px; background: #fff; padding: 10px 14px; border-radius: 16px; box-shadow: 0 6px 22px rgba(58, 51, 53, .18); font-size: 14px; animation: hchUp .3s ease; }
.hch.r .hch-hello { right: 0; border-bottom-right-radius: 4px; } .hch.l .hch-hello { left: 0; border-bottom-left-radius: 4px; }
.hch-hello button { position: absolute; top: 2px; right: 6px; border: 0; background: none; font-size: 16px; color: var(--mut); cursor: pointer; }
.hch-win { position: absolute; bottom: calc(var(--fab, 60px) + 14px); width: 370px; height: min(600px, calc(100vh - 92px - var(--lift, 18px))); background: #fff; border-radius: 20px; box-shadow: 0 18px 48px rgba(58, 51, 53, .28); display: flex; flex-direction: column; overflow: hidden; animation: hchUp .22s ease; }
.hch.r .hch-win { right: 0; } .hch.l .hch-win { left: 0; }
.hch-win[hidden], .hch-hello[hidden] { display: none; }
@keyframes hchUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hch-top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid #efe8eb; }
.hch-av { width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; position: relative; overflow: hidden; }
.hch-av img { width: 100%; height: 100%; object-fit: cover; }
.hch-av::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 10px; height: 10px; border-radius: 50%; background: #31c46b; border: 2px solid #fff; }
.hch-top b { display: block; font-size: 15px; } .hch-top small { color: var(--mut); font-size: 12px; }
.hch-x { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--c); font-size: 22px; cursor: pointer; }
.hch-x:hover { background: var(--bg); }
.hch-body { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.hch-row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.hch-row.me { justify-content: flex-end; }
.hch-row .hch-av { width: 28px; height: 28px; font-size: 14px; } .hch-row .hch-av::after { display: none; }
.hch-row .hch-av.ghost { visibility: hidden; }
.hch-b { max-width: 78%; padding: 8px 12px; border-radius: 18px; background: var(--bg); white-space: pre-wrap; word-wrap: break-word; }
.hch-row.me .hch-b { background: var(--c); color: #fff; }
.hch-who { font-size: 11px; color: var(--mut); margin: 6px 0 0 36px; }
.hch-t { font-size: 11px; color: var(--mut); text-align: center; margin: 8px 0 2px; }
.hch-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px 34px; }
.hch-btns button { border: 1.5px solid var(--c); background: #fff; color: var(--c); border-radius: 18px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.hch-btns button:hover { background: var(--c); color: #fff; }
.hch-btns.used button { opacity: .45; pointer-events: none; }
.hch-cards { display: flex; gap: 8px; overflow-x: auto; margin: 4px 0 6px 34px; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hch-card { flex: 0 0 150px; border: 1px solid #ece4e8; border-radius: 14px; overflow: hidden; background: #fff; scroll-snap-align: start; display: flex; flex-direction: column; }
.hch-card img, .hch-card .ph { width: 100%; height: 120px; object-fit: cover; background: #f6eef1; display: grid; place-items: center; color: var(--c); font-size: 30px; }
.hch-card div { padding: 7px 9px 4px; font-size: 13px; line-height: 1.35; flex: 1; }
.hch-card div b { display: block; font-size: 13px; } .hch-card div span { color: var(--c); font-weight: 700; }
.hch-card button { margin: 4px 8px 8px; border: 0; border-radius: 10px; background: var(--c); color: #fff; padding: 7px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.hch-card button.on { background: #1f8a4c; }
.hch-link { display: inline-block; margin: 2px 0 6px 34px; padding: 8px 12px; border-radius: 12px; background: #e8f6ee; color: #17683b; font-weight: 700; text-decoration: none; font-size: 14px; }
.hch-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.hch-typing i { width: 7px; height: 7px; border-radius: 50%; background: #a99ea9; animation: hchDot 1.2s infinite; }
.hch-typing i:nth-child(2) { animation-delay: .15s; } .hch-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hchDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.hch-in { display: flex; align-items: center; gap: 6px; padding: 10px 10px 12px; border-top: 1px solid #efe8eb; }
.hch-cancel { flex: none; border: 1px solid #e3d8dd; background: #fff; color: var(--mut); border-radius: 14px; padding: 5px 9px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.hch-cancel:hover { color: #c4253b; border-color: #c4253b; }
.hch-cancel[hidden] { display: none; }
.hch-in input { flex: 1; min-width: 0; border: 0; background: var(--bg); border-radius: 20px; padding: 10px 14px; font: inherit; color: var(--ink); }
.hch-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--c); cursor: pointer; display: grid; place-items: center; }
.hch-send svg { width: 24px; height: 24px; }
.hch-send:hover { background: var(--bg); }
@media (max-width: 480px) {
  .hch { bottom: 14px; } .hch.r { right: 14px; } .hch.l { left: 14px; }
  .hch-win { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; bottom: 0; }
  .hch.open .hch-fab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hch *, .hch { animation: none !important; transition: none !important; } }
