/* ============================================================
   ASISTENTE VIRTUAL (robot) — botón flotante + ventana de chat
   ============================================================ */
.asis { position: fixed; right: 20px; bottom: 20px; z-index: 9990; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.asis-boton {
    position: relative;
    width: 72px; height: 72px;
    padding: 6px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: linear-gradient(145deg, #e9f2ff, #c8dcf5);
    box-shadow: 0 10px 28px rgba(10, 26, 58, .35);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.asis-boton:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 34px rgba(10, 26, 58, .42); }
.asis-boton img { width: 100%; height: 100%; display: block; }
.asis-boton::after {
    content: ""; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid rgba(52, 152, 219, .55);
    animation: asisOnda 2.4s ease-out infinite;
}
@keyframes asisOnda { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.asis-burbuja {
    position: absolute; right: 82px; bottom: 18px;
    white-space: nowrap;
    padding: 8px 14px; border-radius: 14px 14px 4px 14px;
    background: #0a1a3a; color: #ffffff;
    font-size: 14px; font-weight: 600;
    box-shadow: 0 8px 20px rgba(10, 26, 58, .3);
    animation: asisAparece .5s ease 1.2s both;
}
@keyframes asisAparece { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.asis.abierto .asis-burbuja, .asis-burbuja.oculta { display: none; }

.asis-ventana {
    position: absolute; right: 0; bottom: 88px;
    width: min(390px, calc(100vw - 32px));
    height: min(580px, calc(100vh - 130px));
    display: flex; flex-direction: column;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(10, 26, 58, .35);
    animation: asisAbrir .25s ease;
}
.asis-ventana[hidden] { display: none; }
@keyframes asisAbrir { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.asis-cab {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0a1a3a, #1f4e8c);
    color: #ffffff;
}
.asis-cab img { background: #eaf2ff; border-radius: 50%; padding: 3px; }
.asis-cab div { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.asis-cab small { color: #b9cae6; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.asis-punto { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; display: inline-block; }
.asis-cerrar { width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #ffffff; font-size: 24px; line-height: 1; cursor: pointer; }
.asis-cerrar:hover { background: rgba(255, 255, 255, .24); }

.asis-mensajes { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: #f3f6fb; display: flex; flex-direction: column; gap: 10px; }
.asis-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; word-wrap: break-word; }
.asis-msg p { margin: 0 0 6px; }
.asis-msg p:last-child { margin-bottom: 0; }
.asis-msg ul { margin: 4px 0; padding-left: 18px; }
.asis-bot { align-self: flex-start; background: #ffffff; color: #1d2433; border: 1px solid #e3e9f2; border-bottom-left-radius: 4px; }
.asis-yo { align-self: flex-end; background: #1f4e8c; color: #ffffff; border-bottom-right-radius: 4px; }
.asis-msg a { color: #1f6fd1; font-weight: 600; }
.asis-enlaces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asis-enlaces a {
    display: inline-block; padding: 5px 10px; border-radius: 99px;
    background: #eef4fd; border: 1px solid #d3e2f7;
    font-size: 12.5px; font-weight: 600; color: #1f4e8c; text-decoration: none;
}
.asis-enlaces a:hover { background: #dcEAfb; }
.asis-escribiendo { display: inline-flex; gap: 4px; padding: 4px 2px; }
.asis-escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: #8a9ab5; animation: asisPunto 1s infinite ease-in-out; }
.asis-escribiendo i:nth-child(2) { animation-delay: .15s; }
.asis-escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes asisPunto { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

.asis-sugerencias { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #f3f6fb; border-top: 1px solid #e6ebf3; scrollbar-width: thin; }
.asis-sugerencias button {
    flex: none; padding: 7px 12px; border-radius: 99px;
    border: 1px solid #cfdcef; background: #ffffff; color: #1f4e8c;
    font: 600 12.5px/1.2 inherit; cursor: pointer; white-space: nowrap;
}
.asis-sugerencias button:hover { background: #eef4fd; }
.asis-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #e6ebf3; background: #ffffff; }
.asis-form input {
    flex: 1; min-width: 0;
    padding: 11px 14px; border: 1.5px solid #dbe2ee; border-radius: 12px;
    font: inherit; font-size: 15px; color: #1d2433;
}
.asis-form input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52, 152, 219, .15); }
.asis-form button { flex: none; width: 46px; border: 0; border-radius: 12px; background: #1f4e8c; color: #ffffff; cursor: pointer; display: grid; place-items: center; }
.asis-form button:hover { background: #163a6a; }
.asis-form button[disabled] { opacity: .6; cursor: wait; }

@media (max-width: 520px) {
    .asis { right: 12px; bottom: 12px; }
    .asis-boton { width: 62px; height: 62px; }
    .asis-burbuja { display: none; }
    .asis-ventana { position: fixed; left: 8px; right: 8px; bottom: 84px; width: auto; height: calc(100vh - 110px); }
}
@media print { .asis { display: none; } }
@media (prefers-reduced-motion: reduce) { .asis-boton::after, .asis-burbuja, .asis-ventana { animation: none; } }

/* El robot ocupa la esquina inferior derecha: el botón «volver arriba» sube encima */
.back-to-top-btn { bottom: 104px !important; right: 33px !important; }
@media (max-width: 520px) { .back-to-top-btn { bottom: 88px !important; right: 20px !important; } }
