/* Alexia, la asistente (copia de Nora, con los colores de Lex Total) */
.alexia{--marino:#14263f;--marino-2:#2b4366;--marino-3:#0d1a2c;--ambar:#b8893b;--naranja:#a1762f;--degradado:linear-gradient(135deg,#d9b36a 0%,#14263f 100%);--gris:#5b6474;--gris-2:#8a93a0;--rojo:#a3352b;--tinta:#14263f;--fondo:#f5f2ec;--linea:#e2ddd2;--blanco:#fff}


.alexia { position: fixed; right: 22px; bottom: 22px; z-index: 900; font-size: .95rem; }
.alexia-foto { position: relative; display: block; border-radius: 50%; overflow: hidden; background: #b8893b; flex: none; }
.alexia-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.alexia-foto .f-ojos, .alexia-foto .f-habla { opacity: 0; }
.alexia.parpadea .alexia-foto .f-ojos { opacity: 1; }
.alexia.hablando.boca .alexia-foto .f-habla { opacity: 1; }
.alexia.hablando.boca.parpadea .alexia-foto .f-ojos { opacity: 0; }

.alexia-boton { position: relative; width: 88px; height: 88px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; animation: alexia-flota 5s ease-in-out infinite; }
.alexia-foto-boton { width: 100%; height: 100%; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ambar), 0 16px 34px rgba(11, 46, 79, .38); transition: transform .25s; }
.alexia-boton:hover .alexia-foto-boton { transform: scale(1.05); }
.alexia-boton::before, .alexia-boton::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--ambar); opacity: 0; animation: alexia-onda 3.2s ease-out infinite; pointer-events: none; }
.alexia-boton::after { animation-delay: 1.6s; }
.alexia-en-linea { position: absolute; right: 4px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: #22c55e; border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: alexia-pulso 2s infinite; }
.alexia-nombre { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); background: var(--marino); color: #fff; font-size: .74rem; font-weight: 800; padding: 3px 12px; border-radius: 99px; letter-spacing: .04em; box-shadow: 0 4px 10px rgba(11, 46, 79, .3); }
.alexia.abierta .alexia-boton { animation: none; }
.alexia.abierta .alexia-boton::before, .alexia.abierta .alexia-boton::after { display: none; }
.alexia.saluda .alexia-boton { animation: alexia-saluda 1s ease-in-out 3; }
.alexia-bocadillo { position: absolute; right: 104px; bottom: 22px; width: 250px; background: #fff; color: var(--tinta); padding: 14px 16px; border-radius: 18px 18px 4px 18px; box-shadow: 0 18px 40px rgba(11, 46, 79, .22); cursor: pointer; line-height: 1.4; animation: alexia-entra .45s cubic-bezier(.2, .9, .3, 1.3); border: 1px solid #e2ddd2; }
.alexia-bocadillo b { color: var(--marino); }

.alexia-panel { position: absolute; right: 0; bottom: 108px; width: 390px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 140px)); display: flex; flex-direction: column; background: #fff; border-radius: 26px; box-shadow: 0 30px 80px rgba(11, 46, 79, .35); overflow: hidden; animation: alexia-entra .3s ease-out; }
.alexia-panel[hidden] { display: none !important; }
.alexia-panel header { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: linear-gradient(120deg, var(--marino-3), var(--marino) 55%, var(--marino-2)); color: #fff; position: relative; }
.alexia-panel header::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--degradado); }
.alexia-foto-mini { width: 48px; height: 48px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ambar); }
.alexia-titulo { flex: 1; min-width: 0; }
.alexia-titulo b { display: block; font-size: 1.1rem; letter-spacing: .01em; }
.alexia-titulo span { font-size: .78rem; opacity: .9; }
.alexia-titulo span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #4ade80; vertical-align: 1px; }
.alexia-icono { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.05rem; line-height: 1; cursor: pointer; flex: none; }
.alexia-icono:hover { background: rgba(255, 255, 255, .28); }
.alexia-cerrar { font-size: 1.5rem; }
.alexia-mensajes { flex: 1; overflow-y: auto; padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; background: radial-gradient(circle at 50% 0, #e6f4f1 0, var(--fondo) 55%); }
.alexia-portada { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 10px; }
.alexia-foto-grande { width: 112px; height: 112px; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--ambar), 0 14px 30px rgba(11, 46, 79, .25); margin-bottom: 10px; }
.alexia-portada b { font-size: 1.15rem; color: var(--marino); }
.alexia-portada span { font-size: .8rem; color: var(--gris); }
.alexia-msg { max-width: 84%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; overflow-wrap: anywhere; animation: alexia-msg .25s ease-out; }
.alexia-de-luz { position: relative; align-self: flex-start; margin-left: 34px; background: #fff; color: var(--tinta); border-bottom-left-radius: 5px; box-shadow: 0 3px 12px rgba(11, 46, 79, .08); }
.alexia-de-luz::before { content: ''; position: absolute; left: -34px; bottom: 0; width: 26px; height: 26px; border-radius: 50%; background: #b8893b url(/static/img/alexia.jpg) center / cover; box-shadow: 0 0 0 2px #fff; }
.alexia-de-luz a { color: var(--marino-2); font-weight: 700; }
.alexia-de-usuario { align-self: flex-end; background: linear-gradient(135deg, var(--marino-2), var(--marino)); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 3px 12px rgba(11, 46, 79, .18); }
.alexia-voz { font-style: italic; }
.alexia-error { background: #fff4f4; color: var(--rojo); }
.alexia-nota { background: #e6f4f1; color: #a1762f; font-size: .85rem; }
.alexia-escribiendo { display: flex; gap: 5px; padding: 14px 16px; }
.alexia-escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ambar); animation: alexia-puntos 1s infinite; }
.alexia-escribiendo i:nth-child(2) { animation-delay: .15s; }
.alexia-escribiendo i:nth-child(3) { animation-delay: .3s; }
.alexia-sugerencias { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; background: var(--fondo); }
.alexia-sugerencias[hidden] { display: none; }
.alexia-sugerencias button { border: 1px solid #e2ddd2; background: #f3faf8; color: #a1762f; border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.alexia-sugerencias button:hover { background: #cfe9e3; }
.alexia-escribir { display: flex; gap: 8px; padding: 12px 14px; background: var(--fondo); }
.alexia-escribir[hidden] { display: none; }
.alexia-escribir input { flex: 1; min-width: 0; border: 1px solid var(--linea); border-radius: 99px; padding: 12px 16px; font: inherit; background: #fff; box-shadow: inset 0 1px 3px rgba(11, 46, 79, .05); }
.alexia-escribir input:focus { outline: 2px solid var(--ambar); border-color: transparent; }
.alexia-mic, .alexia-enviar { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: transform .15s; }
.alexia-mic { background: #fff; color: var(--marino); box-shadow: 0 0 0 1px var(--linea); }
.alexia-mic:hover { color: #a1762f; box-shadow: 0 0 0 2px var(--ambar); }
.alexia-enviar { background: var(--degradado); color: #fff; font-size: 1.1rem; }
.alexia-mic:active, .alexia-enviar:active { transform: scale(.92); }
.alexia-grabando { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff1f1; color: #991b1b; font-weight: 600; }
.alexia-grabando[hidden] { display: none; }
.alexia-rec { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; animation: alexia-pulso-rojo 1s infinite; flex: none; }
.alexia-ondas { display: flex; gap: 3px; align-items: center; height: 22px; flex: 1; }
.alexia-ondas i { width: 4px; height: 6px; border-radius: 3px; background: #dc2626; animation: alexia-onda-voz .9s ease-in-out infinite; }
.alexia-ondas i:nth-child(2) { animation-delay: .1s; } .alexia-ondas i:nth-child(3) { animation-delay: .2s; } .alexia-ondas i:nth-child(4) { animation-delay: .3s; } .alexia-ondas i:nth-child(5) { animation-delay: .4s; }
.alexia-rec-cancelar, .alexia-rec-enviar { border: 0; border-radius: 99px; padding: 8px 12px; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.alexia-rec-cancelar { background: transparent; color: #991b1b; }
.alexia-rec-enviar { background: #dc2626; color: #fff; }
.alexia-aviso { margin: 0; padding: 0 14px 10px; background: var(--fondo); color: var(--gris-2); font-size: .7rem; line-height: 1.3; }
.alexia.escucha .alexia-foto-mini { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #dc2626; }
@keyframes alexia-flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes alexia-onda { 0% { transform: scale(.95); opacity: .8; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
@keyframes alexia-pulso { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes alexia-pulso-rojo { 50% { opacity: .3; } }
@keyframes alexia-onda-voz { 0%, 100% { height: 6px; } 50% { height: 20px; } }
@keyframes alexia-saluda { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08) rotate(-4deg); } 60% { transform: scale(1.08) rotate(4deg); } }
@keyframes alexia-entra { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes alexia-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes alexia-puntos { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@media (max-width: 560px) {
  .alexia { right: 12px; bottom: 14px; }
  .alexia-boton { width: 70px; height: 70px; }
  .alexia-panel { position: fixed; right: 8px; left: 8px; bottom: 96px; width: auto; max-width: none; height: calc(100vh - 116px); height: calc(100dvh - 116px); }
  .alexia-bocadillo { right: 84px; bottom: 14px; width: 210px; }
  .alexia-foto-grande { width: 88px; height: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  .alexia-boton, .alexia-boton::before, .alexia-boton::after, .alexia-en-linea { animation: none !important; }
}
@media print { .alexia { display: none; } }
/* dentro de la aplicación: más discreta, sin ondas, para no tapar los botones de las pantallas */
.alexia.alexia-app { right: 16px; bottom: 16px; }
.alexia-app .alexia-boton { width: 58px; height: 58px; animation: none; }
.alexia-app .alexia-boton::before, .alexia-app .alexia-boton::after { display: none; }
.alexia-app .alexia-en-linea { width: 12px; height: 12px; border-width: 2px; right: 1px; top: 2px; }
.alexia-app .alexia-nombre { font-size: .66rem; padding: 2px 9px; bottom: -8px; }
.alexia-app .alexia-panel { bottom: 74px; }
.alexia-app .alexia-bocadillo { right: 72px; bottom: 6px; }
#alexia-consumo { display: block; margin-top: 4px; font-weight: 600; }


/* Aceptación previa a la primera pregunta */
.alexia-acepto { margin:0 14px 10px; padding:14px; background:var(--fondo); border:1px solid var(--linea); border-left:4px solid var(--ambar); border-radius:12px; font-size:.86rem; line-height:1.4; color:var(--tinta); overflow-y:auto; }
.alexia-acepto[hidden] { display:none; }
.alexia-acepto p { margin:0 0 6px; }
.alexia-acepto ul { margin:0 0 10px; padding-left:18px; }
.alexia-acepto li { margin-bottom:4px; }
.alexia-acepto label { display:flex; gap:8px; align-items:flex-start; font-weight:600; margin-bottom:10px; cursor:pointer; }
.alexia-acepto input { margin-top:3px; flex:none; }
.alexia-acepto button { font:inherit; font-weight:700; padding:8px 16px; border:0; border-radius:99px; background:var(--marino); color:#fff; cursor:pointer; }
.alexia-acepto button:disabled { opacity:.45; cursor:not-allowed; }
.alexia-acepto-enlace { margin:8px 0 0 !important; font-size:.8rem; }
.alexia-escribir[hidden] { display:none; }

/* Imprimir / guardar en PDF */
.alexia-imp { display: block; margin: 6px 0 -2px auto; border: 0; background: transparent; color: var(--gris-2); font-size: .85rem; line-height: 1; padding: 3px 5px; border-radius: 6px; cursor: pointer; }
.alexia-imp:hover, .alexia-imp:focus-visible { color: var(--marino); background: var(--fondo); }
