/* ==========================================================================
   ACEADVANCE — Asistente de la tienda (public/js/ace-asistente.js). Usa los tokens --ace-* de ace-redesign.css.
   ========================================================================== */
.ace-float__btn--asis { background: var(--ace-navy, #0A1A5C); position: relative; }
.ace-float__btn--asis svg { width: 27px; height: 27px; fill: #fff; }
.ace-float__btn--asis svg circle { fill: var(--ace-navy, #0A1A5C); }
.ace-float__btn--asis::after { content: ""; position: absolute; top: 3px; right: 3px; width: 12px; height: 12px; border-radius: 50%; background: #22C55E; border: 2px solid #fff; }

.ace-asis { position: fixed; right: 20px; bottom: 20px; z-index: 1050; width: 384px; height: min(620px, calc(100vh - 40px)); display: flex; flex-direction: column; background: var(--ace-bg, #F4F6FB); border: 1px solid var(--ace-border, #E4E8F2); border-radius: 22px; box-shadow: 0 24px 60px rgba(10, 20, 60, .28); overflow: hidden; font-family: var(--ace-font, system-ui, sans-serif); color: var(--ace-text, #0E1630); opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right; transition: opacity .18s ease, transform .18s ease; }
.ace-asis[hidden] { display: none; }
.ace-asis.is-open { opacity: 1; transform: none; }
body.ace-asis-open .ace-float, body.ace-asis-open .ace-float__panel { visibility: hidden; }

.ace-asis__head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; background: linear-gradient(120deg, var(--ace-navy, #0A1A5C), var(--ace-primary, #1F3FE6)); color: #fff; }
.ace-asis__av { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; }
.ace-asis__av svg { width: 22px; height: 22px; fill: #fff; }
.ace-asis__av svg circle { fill: #1A2E8C; }
.ace-asis__tit { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ace-asis__tit b { font-size: 15px; font-weight: 800; }
.ace-asis__tit small { font-size: 12px; opacity: .8; }
.ace-asis__hbtn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 15px; cursor: pointer; display: grid; place-items: center; }
.ace-asis__hbtn:hover { background: rgba(255, 255, 255, .24); }

.ace-asis__log { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.ace-asis__msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; }
.ace-asis__msg--yo { align-self: flex-end; align-items: flex-end; }
.ace-asis__msg--bot { align-self: flex-start; }
.ace-asis__bubble { margin: 0; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.ace-asis__msg--bot .ace-asis__bubble { background: var(--ace-surface, #fff); border: 1px solid var(--ace-border, #E4E8F2); border-top-left-radius: 6px; }
.ace-asis__msg--yo .ace-asis__bubble { background: var(--ace-primary, #1F3FE6); color: #fff; border-top-right-radius: 6px; }
.ace-asis__typing .ace-asis__bubble { display: flex; gap: 4px; padding: 13px 14px; }
.ace-asis__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ace-text-3b, #8A93AA); animation: ace-asis-dot 1s infinite ease-in-out; }
.ace-asis__typing i:nth-child(2) { animation-delay: .15s; }
.ace-asis__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ace-asis-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ace-asis__prods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ace-asis__prod { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; background: var(--ace-surface, #fff); border: 1px solid var(--ace-border, #E4E8F2); border-radius: 14px; }
.ace-asis__pimg { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px; background: #fff; border: 1px solid var(--ace-border, #E4E8F2); }
.ace-asis__pimg img { max-width: 44px; max-height: 44px; object-fit: contain; }
.ace-asis__pinfo { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ace-page a.ace-asis__pname, a.ace-asis__pname { font-size: 12.5px; font-weight: 700; line-height: 1.3; color: var(--ace-text, #0E1630); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ace-page a.ace-asis__pname:hover, a.ace-asis__pname:hover { color: var(--ace-primary, #1F3FE6); }
.ace-asis__pprice { display: flex; align-items: baseline; gap: 6px; }
.ace-asis__pprice strong { font-size: 14px; font-weight: 900; }
.ace-asis__pprice del { font-size: 11px; color: var(--ace-text-3, #6B7590); }
.ace-asis__pstock { font: 500 11px var(--ace-mono, monospace); color: var(--ace-ok, #16A34A); }
.ace-asis__pacts { display: flex; flex-direction: column; gap: 6px; }
.ace-asis__padd, .ace-asis__pfav { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--ace-border-btn, #D2D9E8); background: var(--ace-surface, #fff); color: var(--ace-primary, #1F3FE6); font-size: 18px; font-weight: 700; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ace-asis__padd:hover { background: var(--ace-primary, #1F3FE6); border-color: var(--ace-primary, #1F3FE6); color: #fff; }
.ace-asis__pfav { color: var(--ace-text-3, #6B7590); }
.ace-asis__pfav svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ace-asis__pfav:hover, .ace-asis__pfav.is-on { color: #E11D48; border-color: #FDA4AF; }
.ace-asis__pfav.is-on { background: #FFF1F2; }
.ace-asis__pfav.is-on svg { fill: currentColor; }

.ace-asis__btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ace-page a.ace-asis__btn, a.ace-asis__btn { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--ace-tint, #E8EDFF); color: var(--ace-primary, #1F3FE6); font-size: 13px; font-weight: 700; text-decoration: none; }
.ace-page a.ace-asis__btn:hover, a.ace-asis__btn:hover { background: var(--ace-primary, #1F3FE6); color: #fff; }
.ace-page a.ace-asis__btn--wa, a.ace-asis__btn--wa { background: #25D366; color: #fff; }
.ace-page a.ace-asis__btn--wa:hover, a.ace-asis__btn--wa:hover { background: #1DA851; color: #fff; }

.ace-asis__chips { display: flex; gap: 6px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.ace-asis__chips::-webkit-scrollbar { display: none; }
.ace-asis__chips[hidden] { display: none; }
.ace-asis__chip { flex: 0 0 auto; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ace-border-btn, #D2D9E8); background: var(--ace-surface, #fff); color: var(--ace-text-2, #4A5470); font: 600 12.5px var(--ace-font, sans-serif); cursor: pointer; white-space: nowrap; }
.ace-asis__chip:hover { border-color: var(--ace-primary, #1F3FE6); color: var(--ace-primary, #1F3FE6); }

.ace-asis__form { display: flex; gap: 8px; padding: 10px 12px; background: var(--ace-surface, #fff); border-top: 1px solid var(--ace-border, #E4E8F2); }
.ace-asis__form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--ace-border-input, #D9DFEC); border-radius: 12px; font: 400 15px var(--ace-font, sans-serif); color: var(--ace-text, #0E1630); background: var(--ace-bg, #F4F6FB); }
.ace-asis__form input:focus { outline: 2px solid var(--ace-primary, #1F3FE6); outline-offset: -1px; background: #fff; }
.ace-asis__send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--ace-primary, #1F3FE6); cursor: pointer; display: grid; place-items: center; }
.ace-asis__send svg { width: 20px; height: 20px; fill: #fff; }
.ace-asis__send:hover { background: var(--ace-primary-hover, #1631C4); }
.ace-asis__nota { margin: 0; padding: 0 12px 10px; background: var(--ace-surface, #fff); font-size: 11px; color: var(--ace-text-3b, #8A93AA); text-align: center; }

.ace-asis__globo { position: fixed; right: 86px; bottom: 212px; z-index: 101; display: flex; align-items: center; gap: 10px; max-width: 240px; padding: 11px 12px 11px 14px; border-radius: 14px 14px 4px 14px; border: 1px solid var(--ace-border, #E4E8F2); background: var(--ace-surface, #fff); color: var(--ace-text, #0E1630); box-shadow: 0 12px 30px rgba(10, 20, 60, .18); font: 700 13.5px var(--ace-font, sans-serif); text-align: left; cursor: pointer; animation: ace-asis-in .25s ease; }
.ace-asis__globox { font-style: normal; font-size: 11px; color: var(--ace-text-3, #6B7590); padding: 2px 4px; }
@keyframes ace-asis-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
    .ace-asis { inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
    .ace-asis__head { padding-top: max(14px, env(safe-area-inset-top)); }
    .ace-asis__nota { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    body.ace-asis-open { overflow: hidden; }
}
body.ace-drawer-open .ace-asis, body.ace-drawer-open .ace-asis__globo { visibility: hidden; } /* con el carrito abierto, el chat espera detrás */
