/* =========================================================
   AIonSolutions — asistente de IA (botón flotante + panel de chat)
   Misma estética que la web: negro, blanco y lima.
   ========================================================= */
.as-raiz { --as-bg: #0D0F13; --as-bg2: #161920; --as-line: rgba(255,255,255,.1); --as-fg: #F2F1EC; --as-mute: #8B8D94; font-family: var(--sans); }
.as-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botón flotante ---------- */
.as-lanz { position: fixed; right: 18px; right: max(18px, env(safe-area-inset-right)); bottom: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 62; display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 22px 0 16px; border-radius: 99px; border: 1px solid rgba(11,15,2,.25); background: var(--lima); color: var(--lima-ink); font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; cursor: pointer; box-shadow: 0 14px 38px -12px rgba(200,255,77,.6); opacity: 0; transform: translateY(16px); transition: transform .45s var(--ease), opacity .4s, box-shadow .3s; }
.as-lanz.is-vis { opacity: 1; transform: none; }
.as-lanz:hover { box-shadow: 0 18px 44px -10px rgba(200,255,77,.85); }
.as-lanz:active { transform: scale(.97); }
.as-lanz svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; flex: none; }
.as-lanz .as-chispa { fill: currentColor; stroke: none; }
.as-lanz:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.as-abierto .as-lanz { opacity: 0; pointer-events: none; }
/* El botón de WhatsApp que ya tenía la web sube para dejar lugar */
.as-on .wa-flot { bottom: 84px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); right: 18px; }
.as-abierto .wa-flot { display: none; }

/* ---------- Panel ---------- */
.as-panel { position: fixed; z-index: 90; right: 18px; bottom: 18px; width: 398px; max-width: calc(100vw - 24px); height: min(660px, calc(100vh - 110px)); height: min(660px, calc(100dvh - 110px)); display: flex; flex-direction: column; background: var(--as-bg); color: var(--as-fg); border: 1px solid var(--as-line); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(200,255,77,.06); opacity: 0; transform: translateY(18px) scale(.98); transform-origin: bottom right; transition: transform .35s var(--ease), opacity .25s; }
.as-panel[hidden] { display: none; }
.as-panel.is-open { opacity: 1; transform: none; }
.as-panel:focus { outline: none; }

.as-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--as-line); background: linear-gradient(180deg, rgba(200,255,77,.07), transparent); }
.as-marca { width: 36px; height: 36px; border-radius: 11px; background: #08090B; border: 1px solid var(--as-line); display: grid; place-items: center; flex: none; }
.as-marca svg { width: 22px; height: 22px; fill: none; stroke: var(--lima); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.as-marca circle { fill: var(--lima); stroke: none; }
.as-tit { flex: 1; min-width: 0; line-height: 1.25; }
.as-tit b { display: block; font-family: var(--display); font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.as-tit small { display: block; color: var(--as-mute); font-size: 12px; margin-top: 1px; }
.as-ib { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: transparent; color: var(--as-mute); display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.as-ib:hover { background: rgba(255,255,255,.08); color: #fff; }
.as-ib svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.as-ib.is-conf { background: rgba(253,186,116,.16); color: #FDBA74; }
.as-ib:focus-visible, .as-env:focus-visible, .as-sug button:focus-visible, .as-reint:focus-visible, .as-wa:focus-visible { outline: 2px solid var(--lima); outline-offset: 2px; }

/* ---------- Conversación ---------- */
.as-cuerpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.as-cuerpo:focus-visible { outline: 2px solid var(--lima); outline-offset: -2px; }
.as-msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; animation: as-in .3s var(--ease); }
.as-msg p { margin: 0; }
.as-msg p + p, .as-msg p + ul, .as-msg p + ol, .as-msg ul + p, .as-msg ol + p { margin-top: 8px; }
.as-msg ul, .as-msg ol { margin: 0; padding-left: 20px; }
.as-msg li + li { margin-top: 3px; }
.as-msg strong { font-weight: 650; color: #fff; }
.as-b { align-self: flex-start; background: var(--as-bg2); border: 1px solid var(--as-line); border-bottom-left-radius: 6px; }
.as-u { align-self: flex-end; background: var(--lima); color: var(--lima-ink); font-weight: 500; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.as-n { align-self: stretch; max-width: 100%; background: rgba(253,186,116,.09); border: 1px dashed rgba(253,186,116,.4); color: #F6D9B5; border-radius: 14px; font-size: 14px; }
.as-reint { display: inline-flex; margin-top: 8px; height: 34px; padding: 0 16px; border-radius: 99px; border: 1px solid rgba(253,186,116,.55); background: transparent; color: #FDBA74; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.as-reint:hover { background: rgba(253,186,116,.12); }
.as-esc { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.as-esc i { width: 7px; height: 7px; border-radius: 50%; background: var(--lima); opacity: .35; animation: as-punto 1.2s infinite ease-in-out; }
.as-esc i:nth-of-type(2) { animation-delay: .18s; }
.as-esc i:nth-of-type(3) { animation-delay: .36s; }
@keyframes as-punto { 0%, 70%, 100% { opacity: .3; transform: none; } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes as-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Sugerencias ---------- */
.as-sug { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; }
.as-sug[hidden] { display: none; }
.as-sug button { min-height: 40px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--as-line); background: rgba(255,255,255,.04); color: var(--as-fg); font-size: 14px; line-height: 1.25; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.as-sug button:hover { border-color: var(--lima); background: rgba(200,255,77,.08); }

/* ---------- WhatsApp y entrada ---------- */
.as-wa { margin: 0 14px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 99px; background: #25D366; color: #08240F; font-family: var(--display); font-weight: 700; font-size: 14.5px; transition: box-shadow .3s, transform .2s; }
.as-wa[hidden] { display: none; }
.as-wa:hover { box-shadow: 0 10px 28px -10px rgba(37,211,102,.85); }
.as-wa:active { transform: scale(.98); }
.as-wa svg { width: 20px; height: 20px; fill: currentColor; }
.as-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--as-line); background: var(--as-bg); }
.as-form textarea { flex: 1; min-width: 0; resize: none; overflow-y: hidden; max-height: 120px; padding: 11px 16px; border-radius: 22px; border: 1px solid var(--as-line); background: var(--as-bg2); color: var(--as-fg); font: inherit; font-size: 16px; line-height: 1.4; transition: border-color .2s; }
.as-form textarea::placeholder { color: var(--as-mute); }
.as-form textarea:focus { outline: none; border-color: var(--lima); box-shadow: 0 0 0 3px rgba(200,255,77,.14); }
.as-form textarea:disabled { opacity: .55; }
.as-env { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--lima); color: var(--lima-ink); display: grid; place-items: center; cursor: pointer; transition: transform .2s, opacity .2s; }
.as-env:hover:not(:disabled) { transform: scale(1.06); }
.as-env:disabled { opacity: .35; cursor: default; }
.as-env svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Celular: pantalla completa ---------- */
@media (max-width: 640px) {
  .as-lanz { width: 54px; padding: 0; justify-content: center; }
  .as-lanz span { display: none; }
  .as-on .wa-flot { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  .as-panel { inset: auto; left: 0; right: 0; top: var(--as-top, 0px); bottom: auto; width: 100%; max-width: none; height: var(--as-h, 100vh); height: var(--as-h, 100dvh); border: 0; border-radius: 0; transform: translateY(24px); padding-top: env(safe-area-inset-top); }
  .as-panel.is-open { transform: none; }
  .as-msg { max-width: 92%; font-size: 15.5px; }
  html.as-abierto, html.as-abierto body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .as-lanz, .as-panel, .as-msg, .as-wa, .as-env { transition: none; animation: none; }
  .as-esc i { animation: none; opacity: .7; }
}

/* ---------- Botones de la página que abren el asistente ---------- */
.cfg-asistente { justify-self: start; margin-top: 4px; }
.form-nota.form-asistente { margin-top: 2px; }
.link-as { padding: 0; border: 0; background: none; color: var(--lima); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-as:hover { color: #fff; }
