/* AMS Celular — Asistente de compras con IA (diseño premium, primero el celular) */
.ai-launch { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 41; display: inline-flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 18px 0 8px; border: 0; border-radius: 26px; cursor: pointer; color: #fff; font-weight: 800; font-size: .95rem; letter-spacing: -.01em;
  background: linear-gradient(135deg, var(--navy) 0%, #0A5597 55%, var(--teal) 130%); box-shadow: 0 10px 28px rgba(3, 62, 118, .35), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .18s ease, box-shadow .18s ease; }
.ai-launch:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(3, 62, 118, .42); }
.ai-launch-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); }
.ai-launch-ic svg { width: 22px; height: 22px; color: #fff; animation: aiTw 3.2s ease-in-out infinite; }
@keyframes aiTw { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(8deg); } }
html.ai-open .ai-launch, html.ai-open .wa-float { visibility: hidden; }
body.has-buybar .ai-launch { display: none; }
@media (min-width: 900px) { body.has-buybar .ai-launch { display: inline-flex; } }

.ai-panel { position: fixed; z-index: 60; inset: 0; display: flex; flex-direction: column; background: #F6F8FB; color: var(--ink);
  opacity: 0; transform: translateY(16px); transition: opacity .22s ease, transform .22s ease; }
.ai-panel.on { opacity: 1; transform: none; }
.ai-panel[hidden] { display: none; }
@media (min-width: 700px) {
  .ai-panel { inset: auto auto 20px 20px; width: 400px; height: min(680px, calc(100vh - 40px)); border-radius: 24px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(2, 31, 59, .28), 0 0 0 1px rgba(3, 62, 118, .08); }
}

.ai-head { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 12px 14px 16px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(0,151,162,.55) 0%, transparent 55%), linear-gradient(135deg, #021F3B 0%, var(--navy) 60%, #0A5597 100%); }
.ai-avatar { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal), #2FC4CD); box-shadow: 0 6px 16px rgba(0,151,162,.4); }
.ai-avatar svg { width: 24px; height: 24px; color: #fff; }
.ai-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ai-title strong { font-size: 1.02rem; letter-spacing: -.01em; }
.ai-title span { font-size: .76rem; opacity: .85; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.ai-dot { width: 7px; height: 7px; border-radius: 50%; background: #3BE08A; box-shadow: 0 0 0 3px rgba(59,224,138,.22); }
.ai-icon-btn { width: 38px; height: 38px; flex: none; border: 0; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(255,255,255,.1); }
.ai-icon-btn:hover { background: rgba(255,255,255,.2); }
.ai-icon-btn svg { width: 20px; height: 20px; }

.ai-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 8px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.ai-me { align-items: flex-end; }
.ai-bubble { max-width: 88%; padding: 11px 14px; border-radius: 18px; font-size: .93rem; line-height: 1.45; word-wrap: break-word; }
.ai-bot .ai-bubble { background: #fff; border: 1px solid #E6ECF2; border-top-left-radius: 6px; box-shadow: 0 2px 8px rgba(3,62,118,.05); }
.ai-me .ai-bubble { background: var(--navy); color: #fff; border-top-right-radius: 6px; }
.ai-err .ai-bubble { background: #FFF7ED; border-color: #FED7AA; color: #7C2D12; }
.ai-bubble strong { font-weight: 800; }

.ai-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); opacity: .35; animation: aiDot 1.1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai-sugs { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px; }
.ai-sugs button { border: 1px solid #CFE3E6; background: #fff; color: var(--teal-dark); font-weight: 700; font-size: .82rem; padding: 8px 12px; border-radius: 999px; cursor: pointer; text-align: left; }
.ai-sugs button:hover { background: var(--teal-soft); border-color: var(--teal); }

.ai-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: 10px; width: 100%; margin-top: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
.ai-cards::-webkit-scrollbar { display: none; }
.ai-cards:has(> :only-child) { grid-auto-columns: 88%; }
.ai-card { scroll-snap-align: start; display: flex; gap: 10px; align-items: center; padding: 10px; background: #fff; border: 1px solid #E6ECF2; border-radius: 16px; box-shadow: 0 4px 14px rgba(3,62,118,.06); }
.ai-card-img { flex: 0 0 72px; height: 84px; border-radius: 12px; background: #F4F7F9; display: grid; place-items: center; overflow: hidden; }
.ai-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.ai-card-img span svg { width: 24px; height: 24px; color: #B8C4D0; }
.ai-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-card-name { font-size: .84rem; font-weight: 700; line-height: 1.25; color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .78rem; }
.ai-card-meta b { font-size: 1rem; color: var(--navy); letter-spacing: -.01em; }
.ai-card-meta em { font-style: normal; font-weight: 700; color: var(--warn); }
.ai-net { font-style: normal; font-size: .66rem; font-weight: 900; padding: 1px 6px; border-radius: 5px; background: #E8EDF3; color: #33475B; }
.ai-net-5g { background: #0F7B45; color: #fff; }
.ai-card-cta { display: flex; gap: 6px; margin-top: 2px; }
.ai-card-cta a, .ai-card-cta button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 30px; border-radius: 999px; font-size: .76rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.ai-card-cta a { border: 1.5px solid var(--navy); color: var(--navy); background: #fff; }
.ai-card-cta button { border: 0; background: var(--wa); color: #fff; }
.ai-card-cta svg { width: 14px; height: 14px; }

.ai-wa-btn { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--wa); color: #fff; font-weight: 800; font-size: .88rem; cursor: pointer; box-shadow: 0 6px 16px rgba(18,140,126,.3); }
.ai-wa-btn svg { width: 18px; height: 18px; }

.ai-form { display: flex; gap: 8px; padding: 10px 12px 6px; background: #fff; border-top: 1px solid #E6ECF2; }
.ai-input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border: 1.5px solid #DCE4EC; border-radius: 999px; background: #F6F8FB; font-size: 16px; outline: none; }
.ai-input:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 4px rgba(0,151,162,.12); }
.ai-send { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--teal), var(--navy)); box-shadow: 0 6px 16px rgba(0,151,162,.35); }
.ai-send:disabled { opacity: .5; cursor: default; }
.ai-send svg { width: 20px; height: 20px; margin-left: 2px; }
.ai-note { margin: 0; padding: 2px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; font-size: .68rem; color: var(--muted); text-align: center; }

/* ===== Asistente grande (Pedro: "no me gusta tan en la esquina... queda chiquitico") ===== */
.ai-launch { display: none !important; }   /* ya no va en la esquina: botón en el encabezado + sección en la portada */
@media (min-width: 700px) {
  .ai-panel { inset: 0; margin: auto; width: min(980px, 94vw); height: min(860px, 92vh); border-radius: 26px;
    box-shadow: 0 0 0 100vmax rgba(2, 20, 40, .55), 0 40px 100px rgba(0, 0, 0, .35); }
  .ai-head { padding: 18px 18px 18px 24px; }
  .ai-avatar { width: 50px; height: 50px; border-radius: 16px; }
  .ai-title strong { font-size: 1.2rem; }
  .ai-title span { font-size: .85rem; }
  .ai-log { padding: 26px 28px 12px; gap: 16px; }
  .ai-bubble { max-width: 76%; font-size: 1.02rem; padding: 14px 18px; }
  .ai-cards { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); overflow: visible; }
  .ai-card-img { flex-basis: 92px; height: 104px; }
  .ai-card-name { font-size: .92rem; }
  .ai-sugs button { font-size: .9rem; padding: 10px 16px; }
  .ai-form { padding: 14px 24px 8px; }
  .ai-input { height: 54px; font-size: 1.02rem; padding: 0 20px; }
  .ai-send { width: 54px; height: 54px; }
}
html.ai-open { overflow: hidden; }

/* Voz: micrófono y respuestas en voz alta */
.ai-mic { width: 46px; height: 46px; flex: none; border: 1.5px solid #CFE3E6; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--teal-dark, #00737B); background: #fff; }
.ai-mic svg { width: 22px; height: 22px; }
.ai-mic.on { color: #fff; background: #E11D48; border-color: #E11D48; animation: aiPulse 1.2s infinite; }
@keyframes aiPulse { 0% { box-shadow: 0 0 0 0 rgba(225,29,72,.45); } 70% { box-shadow: 0 0 0 12px rgba(225,29,72,0); } 100% { box-shadow: 0 0 0 0 rgba(225,29,72,0); } }
.ai-send.is-mic { background: linear-gradient(135deg, #0097A2, #033E76); }
.ai-send svg { margin-left: 0; }
/* Dictar (micrófono dentro de la barra, junto al botón principal) */
.ai-dict { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--teal-dark, #00737B); background: #EAF6F7; }
.ai-dict svg { width: 22px; height: 22px; }
.ai-dict.on { color: #fff; background: #E11D48; animation: aiPulse 1.2s infinite; }
@media (min-width: 700px) { .ai-dict { width: 54px; height: 54px; } }
/* Barra de escribir como la app de Claude: UNA sola caja redondeada con el texto y los botones juntos adentro */
.ai-form { padding: 10px 12px 6px; }
.ai-form { display: block; }
.ai-form .ai-box { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; border: 1.5px solid #DCE4EC; border-radius: 26px; background: #fff; box-shadow: 0 2px 10px rgba(3,62,118,.06); }
.ai-form .ai-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,151,162,.12); }
.ai-form .ai-input { height: 40px; padding: 0 4px; border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0; }
.ai-form .ai-dict { width: 40px; height: 40px; background: transparent; color: #5B6B7D; }
.ai-form .ai-dict:hover { background: #F1F5F9; }
.ai-form .ai-dict.on { color: #fff; background: #E11D48; }
.ai-form .ai-send { width: 40px; height: 40px; box-shadow: none; }
.ai-form .ai-send svg, .ai-form .ai-dict svg { width: 20px; height: 20px; }
@media (min-width: 700px) {
  .ai-form { padding: 14px 24px 8px; }
  .ai-form .ai-box { padding: 7px 7px 7px 20px; border-radius: 30px; }
  .ai-form .ai-input { height: 44px; }
  .ai-form .ai-dict, .ai-form .ai-send { width: 44px; height: 44px; }
}

/* Modo conversación en vivo (pantalla de voz) */
.ai-panel { position: fixed; }
.ai-voice { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: #fff;
  background: radial-gradient(120% 90% at 50% 0%, rgba(0,151,162,.55) 0%, transparent 60%), linear-gradient(160deg, #021F3B 0%, #033E76 70%, #0A5597 100%); }
.ai-voice[hidden] { display: none; }
.ai-orb { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #7FE3E9, #0097A2 55%, #033E76); box-shadow: 0 0 60px rgba(0,151,162,.55); transition: transform .3s; }
.ai-orb span { width: 60%; height: 60%; border-radius: 50%; background: rgba(255,255,255,.18); }
.ai-voice.escucha .ai-orb { animation: aiOrb 1.6s ease-in-out infinite; }
.ai-voice.piensa .ai-orb { animation: aiOrbSpin 1.2s linear infinite; opacity: .85; }
.ai-voice.habla .ai-orb { animation: aiOrb .55s ease-in-out infinite; }
@keyframes aiOrb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes aiOrbSpin { from { transform: rotate(0) scale(.95); } to { transform: rotate(360deg) scale(.95); } }
.ai-voice-st { margin: 0; font-size: 1.3rem; font-weight: 800; }
.ai-voice-tx { margin: 0; min-height: 1.4em; max-width: 30em; font-size: 1.02rem; opacity: .9; }
.ai-voice-ayuda { margin: 0; max-width: 26em; font-size: .82rem; opacity: .7; }
.ai-voice-end { margin-top: 10px; border: 0; border-radius: 999px; padding: 14px 34px; font-weight: 800; font-size: 1rem; cursor: pointer; color: #fff; background: #E11D48; box-shadow: 0 10px 24px rgba(225,29,72,.4); }
@media (prefers-reduced-motion: reduce) { .ai-orb { animation: none !important; } }
/* Esfera siempre redonda (no se aplasta en pantallas bajas) y que todo quepa */
.ai-orb { flex: 0 0 auto; }
.ai-voice { overflow-y: auto; }
@media (max-height: 520px) {
  .ai-voice { gap: 8px; padding: 14px; justify-content: flex-start; }
  .ai-orb { width: 84px; height: 84px; }
  .ai-voice-st { font-size: 1.1rem; }
  .ai-voice-ayuda { display: none; }
  .ai-voice-tx:empty { display: none; }
  .ai-voice-end { margin-top: 4px; padding: 10px 28px; }
}
.ai-voice-permiso { margin: 0; max-width: 26em; font-size: .9rem; line-height: 1.45; background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px 14px; }
@media (min-width: 700px) { .ai-mic { width: 54px; height: 54px; } }

/* Botón del asistente en el encabezado (visible en todas las páginas) */
.head-ai { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; margin-right: 6px; border: 0; border-radius: 999px; cursor: pointer;
  color: #fff; font-weight: 800; font-size: .9rem; background: linear-gradient(135deg, var(--teal) 0%, var(--navy) 100%); box-shadow: 0 6px 16px rgba(0,151,162,.3); white-space: nowrap; }
.head-ai[hidden] { display: none; }
.head-ai span { font-size: 1.05rem; }
@media (max-width: 420px) { .head-ai { height: 36px; padding: 0 12px; font-size: .82rem; } }

/* Sección grande del asistente en la portada */
.ai-home { margin: 16px 0 4px; padding: 22px 18px; border-radius: 22px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, rgba(0,151,162,.6) 0%, transparent 55%), linear-gradient(135deg, #021F3B 0%, var(--navy) 60%, #0A5597 100%);
  box-shadow: 0 16px 40px rgba(3, 62, 118, .25); }
.ai-home[hidden] { display: none; }
.aih-kicker { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #7FE3E9; }
.ai-home h2 { margin: 8px 0 6px; font-size: clamp(1.4rem, 5vw, 2.1rem); line-height: 1.1; letter-spacing: -.02em; color: #fff; }
.ai-home p { margin: 0 0 14px; font-size: .92rem; opacity: .9; max-width: 40em; }
.aih-form { display: flex; gap: 8px; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.aih-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; padding: 0 12px; color: var(--ink); height: 46px; }
.aih-send { flex: none; height: 46px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; font-weight: 800; font-size: .95rem;
  background: linear-gradient(135deg, var(--teal), #0A5597); }
.aih-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.aih-chips button { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; font-weight: 700; font-size: .82rem; padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.aih-chips button:hover { background: rgba(255,255,255,.2); }
@media (min-width: 900px) { .ai-home { padding: 32px 36px; } .aih-input, .aih-send { height: 54px; } .aih-input { font-size: 1.05rem; } }
@media (max-width: 480px) { .aih-send { padding: 0 14px; } }

@media (prefers-reduced-motion: reduce) { .ai-launch-ic svg, .ai-typing i { animation: none; } .ai-panel { transition: none; } }
