/* Avi — Asistente virtual Avalos */
.avi-root { --avi-blue: #0000FF; --avi-blue-dark: #0000CC; --avi-ink: #0f172a; --avi-muted: #64748b; --avi-line: #e2e8f0; --avi-bg: #f8fafc; position: fixed; bottom: 24px; right: 24px; z-index: 99998; font-family: inherit; }
@media (max-width: 600px) { .avi-root { bottom: 14px; right: 14px; } }

/* Launcher (botón flotante) — la mascota sobresale del círculo */
.avi-root { padding-top: 60px; padding-right: 8px; }
.avi-launcher { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 86px; height: 86px; border: none; border-radius: 50%; padding: 0; cursor: pointer; background: radial-gradient(circle at 50% 60%, #2a2aff 0%, #0000FF 60%, #0000CC 100%); box-shadow: 0 16px 42px rgba(0,0,255,.38), 0 6px 16px rgba(0,0,0,.22); transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; animation: avi-bob 3.6s ease-in-out infinite; overflow: visible; }
.avi-launcher:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 22px 50px rgba(0,0,255,.5), 0 8px 22px rgba(0,0,0,.26); }
.avi-launcher__img { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); width: 140px; height: auto; max-height: 160px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.28)); z-index: 2; }
.avi-launcher__pulse { position: absolute; inset: 0; border-radius: 50%; background: #0000FF; opacity: .4; animation: avi-pulse 2.4s ease-out infinite; z-index: 1; pointer-events: none; }
.avi-launcher > * { pointer-events: none; }
.avi-launcher__bubble { position: absolute; right: calc(100% + 16px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: #fff; color: var(--avi-ink); padding: 11px 16px; border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.14); font-size: .85rem; font-weight: 600; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; z-index: 3; }
.avi-launcher__bubble::after { content: ""; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) rotate(45deg); width: 12px; height: 12px; background: #fff; }
.avi-launcher:hover .avi-launcher__bubble, .avi-launcher.avi-show-tip .avi-launcher__bubble { opacity: 1; transform: translateY(-50%) translateX(-2px); }
@media (max-width: 600px) { .avi-launcher { width: 72px; height: 72px; } .avi-launcher__img { width: 118px; max-height: 138px; } .avi-launcher__bubble { display: none; } .avi-root { padding-top: 50px; } }

@keyframes avi-bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes avi-pulse { 0%{transform:scale(1);opacity:.45} 100%{transform:scale(1.5);opacity:0} }

/* Panel del asistente — escala compacta */
.avi-panel { position: absolute; right: 0; bottom: calc(100% + 12px); width: 300px; max-width: calc(100vw - 24px); height: min(500px, calc(100vh - 130px)); background: #fff; border-radius: 14px; box-shadow: 0 22px 60px rgba(15,23,42,.28), 0 6px 18px rgba(15,23,42,.10); display: flex; flex-direction: column; overflow: hidden; transform: translateY(16px) scale(.96); opacity: 0; pointer-events: none; transition: transform .28s cubic-bezier(.16,1,.3,1), opacity .22s; font-size: 14px; }
.avi-panel.avi-open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
@media (max-width: 600px) { .avi-panel { right: -10px; bottom: calc(100% + 8px); width: calc(100vw - 24px); height: min(480px, calc(100vh - 100px)); } }

/* Header */
.avi-header { display: flex; align-items: center; gap: 9px; padding: 11px 12px; background: linear-gradient(135deg, #0000FF 0%, #2020FF 100%); color: #fff; }
.avi-header__avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.15); padding: 3px; object-fit: contain; flex-shrink: 0; }
.avi-header h3 { margin: 0; font-size: .85rem; font-weight: 700; line-height: 1.2; color: #fff; }
.avi-header p { margin: 1px 0 0; font-size: .68rem; opacity: .85; line-height: 1.2; color: #fff; }
.avi-close { margin-left: auto; background: rgba(255,255,255,.18); border: none; color: #fff; width: 28px; height: 28px; min-width: 28px; min-height: 28px; max-width: 28px; max-height: 28px; aspect-ratio: 1 / 1; border-radius: 50%; font-size: 1.05rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; padding: 0; flex-shrink: 0; flex-grow: 0; box-sizing: border-box; }
.avi-close:hover { background: rgba(255,255,255,.32); }

/* Progress bar */
.avi-progress { height: 3px; background: var(--avi-line); position: relative; overflow: hidden; }
.avi-progress__bar { display: block; height: 100%; background: var(--avi-blue); width: 0%; transition: width .35s cubic-bezier(.4,0,.2,1); }

/* Body */
.avi-body { flex: 1; overflow-y: auto; padding: 13px 12px; background: var(--avi-bg); display: flex; flex-direction: column; gap: 9px; scroll-behavior: smooth; }
.avi-body:focus { outline: none; }

/* Mensajes */
.avi-msg { display: flex; align-items: flex-end; gap: 6px; max-width: 92%; animation: avi-fade-in .28s ease-out; }
.avi-msg--bot { align-self: flex-start; }
.avi-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.avi-msg__avatar { width: 22px; height: 22px; border-radius: 50%; background: #fff; padding: 2px; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.avi-msg__avatar img { width: 100%; height: 100%; object-fit: contain; }
.avi-msg__bubble { background: #fff; padding: 8px 11px; border-radius: 12px 12px 12px 4px; box-shadow: 0 1px 6px rgba(15,23,42,.06); font-size: .8rem; line-height: 1.4; color: var(--avi-ink); }
.avi-msg--user .avi-msg__bubble { background: var(--avi-blue); color: #fff; border-radius: 12px 12px 4px 12px; }

/* Botones de respuesta tipo chip */
.avi-options { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 28px; margin-top: 2px; }
.avi-options--full { padding-left: 0; }
.avi-chip { background: #fff; border: 1.5px solid var(--avi-line); color: var(--avi-ink); padding: 7px 12px; border-radius: 999px; font-size: .74rem; font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit; line-height: 1.2; }
.avi-chip:hover { border-color: var(--avi-blue); color: var(--avi-blue); background: rgba(0,0,255,.04); transform: translateY(-1px); }

/* Select */
.avi-select-wrap { padding-left: 28px; margin-top: 2px; }
.avi-select { display: block; width: 100%; padding: 10px 32px 10px 12px; border: 1.5px solid var(--avi-line); border-radius: 8px; background: #fff; font-size: .8rem; line-height: 1.4; color: var(--avi-ink); appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; min-height: 38px; cursor: pointer; box-sizing: border-box; font-family: inherit; }
.avi-select:focus { outline: none; border-color: var(--avi-blue); box-shadow: 0 0 0 3px rgba(0,0,255,.12); }
.avi-select option { padding: 6px; line-height: 1.5; font-size: .8rem; }

/* Typing indicator */
.avi-typing { display: inline-flex; gap: 3px; padding: 9px 13px; background: #fff; border-radius: 12px 12px 12px 4px; box-shadow: 0 1px 6px rgba(15,23,42,.06); }
.avi-typing span { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: avi-typing 1.2s infinite ease-in-out; }
.avi-typing span:nth-child(2) { animation-delay: .15s; }
.avi-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes avi-typing { 0%,80%,100%{transform:scale(.7);opacity:.4} 40%{transform:scale(1);opacity:1} }

/* Resultados */
.avi-results { padding-left: 28px; margin-top: 2px; display: flex; flex-direction: column; gap: 8px; }
.avi-result { background: #fff; border: 1px solid var(--avi-line); border-radius: 10px; padding: 9px; display: flex; gap: 9px; align-items: center; transition: box-shadow .15s, transform .15s; }
.avi-result:hover { box-shadow: 0 4px 14px rgba(15,23,42,.08); transform: translateY(-1px); }
.avi-result__img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--avi-bg); flex-shrink: 0; }
.avi-result__info { flex: 1; min-width: 0; }
.avi-result__name { font-size: .74rem; font-weight: 600; line-height: 1.3; color: var(--avi-ink); margin: 0 0 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-decoration: none; }
.avi-result__sku { font-size: .65rem; color: var(--avi-muted); margin: 0 0 1px; }
.avi-result__price { font-size: .8rem; font-weight: 700; color: var(--avi-blue); margin: 0; }
.avi-result__cta { background: #16a34a; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: .68rem; font-weight: 700; text-decoration: none; flex-shrink: 0; transition: background .15s; white-space: nowrap; }
.avi-result__cta:hover { background: #15803d; color: #fff; }

.avi-empty { padding-left: 28px; }
.avi-empty__bubble { background: #fef3c7; border: 1px solid #fde68a; padding: 11px; border-radius: 10px; color: #78350f; font-size: .78rem; line-height: 1.4; }

/* Footer */
.avi-footer { padding: 8px 12px; border-top: 1px solid var(--avi-line); background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.avi-footer button { background: transparent; border: none; color: var(--avi-muted); font-size: .72rem; cursor: pointer; padding: 5px 8px; border-radius: 5px; font-family: inherit; transition: background .15s; }
.avi-footer button:hover { background: var(--avi-bg); color: var(--avi-ink); }
.avi-footer button[hidden] { display: none; }

@keyframes avi-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
