/* Asistente de chat Hobby Toys — inc-functions/inc-smart-chat.php + assets/js/ht-chat.js
   Paleta de marca: rosa #EE285B · violeta #534FB5 · amarillo #FFB900. Planos, sin degradados. */

.htc-launcher {
    position: fixed; right: 20px; bottom: 20px; z-index: 999;
    width: 64px; height: 64px; border-radius: 50%; border: 0;
    background: #EE285B; color: #fff; font-size: 1.75rem; line-height: 1;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 6px 20px rgba(238, 40, 91, .4); transition: transform .15s ease, background-color .2s ease;
}
.htc-launcher:hover { transform: scale(1.07); }
.htc-launcher:focus-visible { outline: 3px solid #534FB5; outline-offset: 3px; }
.htc-launcher.is-open { background: #534FB5; }
.htc-hint {
    position: absolute; right: 74px; top: 50%; transform: translateY(-50%) translateX(8px);
    background: #fff; color: #1E1433; font-size: .9rem; font-weight: 800; white-space: nowrap;
    padding: .55rem .9rem; border-radius: 50rem; box-shadow: 0 4px 14px rgba(0,0,0,.15);
    opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease;
}
.htc-launcher.show-hint .htc-hint, .htc-launcher:hover .htc-hint { opacity: 1; transform: translateY(-50%) translateX(0); }
.htc-launcher.is-open .htc-hint { display: none; }

.htc-panel {
    position: fixed; right: 20px; bottom: 96px; z-index: 3002;
    width: 380px; max-width: calc(100vw - 24px);
    height: min(620px, calc(100dvh - var(--ht-mq-h, 0px) - 120px));
    background: #FAF8FF; border-radius: 20px; overflow: hidden;
    box-shadow: 0 18px 50px rgba(30, 20, 51, .28);
    display: flex; flex-direction: column;
    font-size: .95rem; color: #1E1433;
}
.htc-panel[hidden] { display: none; }
.admin-bar .htc-panel { height: min(620px, calc(100dvh - var(--ht-mq-h, 0px) - 32px - 120px)); }

.htc-head { flex: 0 0 auto; display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; background: #534FB5; color: #fff; }
.htc-avatar { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.htc-title { flex: 1; line-height: 1.2; }
.htc-title b { display: block; font-size: 1rem; }
.htc-title small { font-size: .78rem; opacity: .9; display: inline-flex; align-items: center; gap: .35rem; }
.htc-dot { width: 8px; height: 8px; border-radius: 50%; background: #3DDC84; display: inline-block; }
.htc-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.htc-close:hover { background: rgba(255,255,255,.3); }

.htc-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 1rem .9rem .5rem; display: flex; flex-direction: column; gap: .55rem; }
/* En la columna con scroll ningún mensaje se encoge (si no, la tira de productos queda en 0px) */
.htc-body > * { flex-shrink: 0; }
.htc-msg { max-width: 88%; padding: .65rem .85rem; border-radius: 16px; line-height: 1.45; word-wrap: break-word; }
.htc-msg--bot { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(30,20,51,.08); }
.htc-msg--user { align-self: flex-end; background: #EE285B; color: #fff; border-bottom-right-radius: 4px; }
.htc-msg b { font-weight: 800; }
.htc-ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.htc-ul li { margin-bottom: .25rem; }
.htc-typing { display: inline-flex; gap: 4px; }
.htc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #534FB5; opacity: .35; animation: htc-dot 1s infinite; }
.htc-typing span:nth-child(2) { animation-delay: .15s; } .htc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes htc-dot { 50% { opacity: 1; transform: translateY(-3px); } }

.htc-actions { align-self: flex-start; }
.htc-btn { display: inline-block; padding: .5rem .95rem; border-radius: 50rem; background: #fff; color: #534FB5; border: 2px solid #534FB5; font-weight: 800; font-size: .88rem; text-decoration: none; }
.htc-btn:hover { background: #534FB5; color: #fff; }
.htc-btn--wa { border-color: #1FAF54; color: #128C3E; }
.htc-btn--wa:hover { background: #1FAF54; color: #fff; }

.htc-products { display: flex; gap: .6rem; overflow-x: auto; padding: .2rem .1rem .5rem; scroll-snap-type: x mandatory; align-self: stretch; }
.htc-card { flex: 0 0 148px; scroll-snap-align: start; background: #fff; border-radius: 14px; padding: .55rem; display: flex; flex-direction: column; gap: .35rem; box-shadow: 0 2px 8px rgba(30,20,51,.08); }
.htc-card__img { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f4f4f8; }
.htc-card__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.htc-card__name { font-size: .8rem; font-weight: 700; color: #1E1433; text-decoration: none; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.htc-card__price { font-weight: 900; color: #EE285B; font-size: .95rem; }
.htc-card__add { margin-top: auto; border: 0; border-radius: 50rem; background: #EE285B; color: #fff !important; font-weight: 800; font-size: .8rem; padding: .45rem .5rem; text-align: center; text-decoration: none; cursor: pointer; }
.htc-card__add:hover { background: #d61f4d; }
.htc-card__add.is-ok { background: #1FAF54; }

.htc-quick { display: flex; flex-wrap: wrap; gap: .4rem; align-self: stretch; }
.htc-quick .htc-chip { font-size: .84rem; padding: .45rem .8rem; }
.htc-chips { flex: 0 0 auto; display: flex; gap: .4rem; overflow-x: auto; padding: .5rem .8rem; border-top: 1px solid #ECE8F7; background: #fff; scrollbar-width: none; }
.htc-chips::-webkit-scrollbar { display: none; }
.htc-chip { flex: 0 0 auto; border: 1.5px solid #D9D4F0; background: #fff; color: #3B3592; border-radius: 50rem; padding: .35rem .75rem; font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.htc-chip:hover { border-color: #534FB5; background: #F1EFFC; }

.htc-form { flex: 0 0 auto; display: flex; gap: .5rem; padding: .6rem .8rem .8rem; background: #fff; }
.htc-input { flex: 1; min-width: 0; border: 2px solid #E4E0F2; border-radius: 50rem; padding: .6rem 1rem; font-size: 16px; color: #1E1433; outline: none; }
.htc-input:focus { border-color: #534FB5; }
.htc-send { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; border: 0; background: #EE285B; color: #fff; font-size: 1.05rem; cursor: pointer; }
.htc-send:hover { background: #d61f4d; }

/* Con el chat abierto, que no estorben otros flotantes */
body.htc-open #scrollToTopBtn { opacity: 0 !important; pointer-events: none !important; }

@media (max-width: 575.98px) {
    .htc-panel { right: 8px; left: 8px; width: auto; max-width: none; bottom: 92px; }
    .htc-launcher { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .htc-typing span { animation: none; opacity: .7; } .htc-launcher, .htc-hint { transition: none; } }
