/* Asistente virtual del consultorio */
.asis-btn { position: fixed; left: 20px; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; text-align: left; border: 0; border-radius: 999px; background: var(--navy, #1E3A5F); color: #fff; font-family: inherit; font-weight: 600; font-size: .95rem; line-height: 1; width: auto; right: auto; max-width: calc(100vw - 100px); cursor: pointer; box-shadow: 0 10px 28px rgba(30,58,95,.35); transition: transform .2s ease, box-shadow .2s ease; }
.asis-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(30,58,95,.4); }
.asis-btn:focus-visible, .asis-close:focus-visible, .asis-chip:focus-visible, .asis-send:focus-visible, .asis-input:focus-visible { outline: 3px solid var(--gold, #D4A24C); outline-offset: 2px; }
@media (max-width: 640px) { body:has(.asis-panel.open) .whatsapp-float { display: none; } .asis-panel { left: 12px; bottom: 12px; width: calc(100vw - 24px); } .asis-btn { left: 14px; } }
.asis-panel { position: fixed; left: 20px; bottom: 20px; z-index: 70; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100dvh - 40px)); display: none; flex-direction: column; background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(20,35,60,.35); overflow: hidden; border: 1px solid rgba(30,58,95,.12); }
.asis-panel.open { display: flex; }
.asis-head { background: var(--navy, #1E3A5F); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.asis-head strong { display: block; font-size: 1rem; }
.asis-head small { opacity: .75; font-size: .75rem; }
.asis-close { margin-left: auto; background: transparent; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.asis-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #FAF9F6; }
.asis-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .93rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.asis-msg a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.asis-bot { align-self: flex-start; background: #fff; color: #22344d; border: 1px solid rgba(30,58,95,.1); border-bottom-left-radius: 4px; }
.asis-user { align-self: flex-end; background: var(--navy, #1E3A5F); color: #fff; border-bottom-right-radius: 4px; }
.asis-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fff; border-radius: 16px; border: 1px solid rgba(30,58,95,.1); }
.asis-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa9bd; animation: asisb 1s infinite ease-in-out; }
.asis-typing i:nth-child(2) { animation-delay: .15s; } .asis-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes asisb { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.asis-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.asis-chip { border: 1.5px solid var(--navy, #1E3A5F); background: #fff; color: var(--navy, #1E3A5F); padding: 7px 12px; border-radius: 999px; font: 600 .82rem/1 inherit; cursor: pointer; }
.asis-chip:hover { background: var(--navy, #1E3A5F); color: #fff; }
.asis-note { font-size: .72rem; color: #6c7b90; padding: 6px 16px 0; background: #fff; }
.asis-foot { display: flex; gap: 8px; padding: 10px 12px 12px; background: #fff; }
.asis-input { flex: 1; min-width: 0; border: 1.5px solid rgba(30,58,95,.2); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: .95rem; }
.asis-send { border: 0; background: var(--gold, #D4A24C); color: #1E3A5F; font-weight: 700; padding: 0 16px; border-radius: 12px; cursor: pointer; }
.asis-send:disabled { opacity: .5; cursor: default; }
.asis-wa { display: block; text-align: center; padding: 8px; font-size: .82rem; background: #fff; color: #1d6b3a; font-weight: 600; text-decoration: none; border-top: 1px solid rgba(30,58,95,.08); }
@media (max-width: 520px) { .asis-btn { right: 14px; bottom: 82px; padding: 11px 14px; } .asis-panel { right: 12px; bottom: 12px; height: min(78dvh, 600px); } }
@media (prefers-reduced-motion: reduce) { .asis-btn, .asis-typing i { transition: none; animation: none; } }

.asis-wabtn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 9px 16px; border-radius: 999px; background: #25D366; color: #fff !important; font-weight: 700; font-size: .88rem; text-decoration: none !important; }
.asis-wabtn:hover { background: #1fb558; }
.asis-wabtn:focus-visible { outline: 3px solid #1E3A5F; outline-offset: 2px; }

.asis-avatar { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; background: #E8EEF6; display: grid; place-items: center; overflow: visible; }
.asis-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.asis-avatar svg { width: 24px; height: 24px; color: var(--navy, #1E3A5F); }
.asis-on { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #2ecc71; border: 2px solid #fff; }
.asis-btn .asis-txt b { display: block; font-size: .95rem; }
.asis-btn .asis-txt small { display: block; font-size: .72rem; opacity: .85; font-weight: 500; margin-top: 2px; }
.asis-head .asis-avatar { width: 40px; height: 40px; }

@media (max-width: 640px) {
  .asis-btn { left: 14px; bottom: 16px; padding: 0; gap: 0; width: 58px; height: 58px; border-radius: 50%; justify-content: center; box-shadow: 0 8px 22px rgba(30,58,95,.38); background: #fff; border: 2px solid var(--navy, #1E3A5F); }
  .asis-btn .asis-txt { display: none; }
  .asis-btn .asis-avatar { width: 100%; height: 100%; background: #fff; }
  .asis-btn .asis-avatar svg { width: 28px; height: 28px; }
  .asis-btn .asis-on { right: 1px; bottom: 1px; width: 14px; height: 14px; }
}

/* ---- Móvil: el chat abierto ocupa toda la pantalla (sin recortes ni zoom del teclado) ---- */
@media (max-width: 640px) {
  .asis-panel { left: 0; right: 0; top: 0; bottom: 0; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; box-shadow: none; }
  .asis-head { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .asis-foot { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .asis-input { font-size: 16px; padding: 12px; } /* 16px evita el zoom automático de iOS */
  .asis-send { min-width: 76px; }
  .asis-msg { max-width: 92%; font-size: 1rem; }
  .asis-close { font-size: 2rem; padding: 6px 12px; }
}
.asis-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.asis-bloqueado { overflow: hidden; }

/* ---- Página propia /lucia (la del QR): el chat es la página ---- */
.asis-solo .asis-btn { display: none !important; }
.asis-solo .asis-panel { display: flex; position: static; margin: 0 auto; width: min(560px, 100%); height: 100dvh; max-height: 100dvh; border-radius: 0; box-shadow: none; }
.asis-solo .asis-close { display: none; }
@media (min-width: 641px) {
  .asis-solo .asis-panel { height: calc(100dvh - 48px); margin: 24px auto; border-radius: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
}
.asis-volver { margin-left: auto; color: #fff; opacity: .85; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.asis-solo { overflow: hidden; }

/* ---- Estilo WhatsApp (2026-10-23): fondo, burbujas con cola, hora, tildes y envío redondo ---- */
.asis-body { background-color: #EFE8DC; background-image: radial-gradient(rgba(30,58,95,.045) 1.2px, transparent 1.3px); background-size: 18px 18px; padding: 14px 12px; gap: 6px; }
.asis-msg { position: relative; border: 0 !important; border-radius: 12px; padding: 7px 10px 6px; box-shadow: 0 1px 1px rgba(0,0,0,.13); font-size: .97rem; line-height: 1.38; max-width: 82%; }
.asis-bot { background: #fff; color: #1f2d3d; border-top-left-radius: 3px; margin-left: 8px; }
.asis-user { background: #DCF8C6; color: #1f2d3d; border-top-right-radius: 3px; margin-right: 8px; }
.asis-bot::before, .asis-user::before { content: ''; position: absolute; top: 0; width: 9px; height: 12px; }
.asis-bot::before { left: -8px; background: #fff; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.asis-user::before { right: -8px; background: #DCF8C6; clip-path: polygon(0 0, 100% 0, 0 100%); }
.asis-t { float: right; margin: 8px 0 -3px 12px; font-size: .68rem; color: #7c8794; white-space: nowrap; user-select: none; }
.asis-user .asis-t { color: #5f7f5a; }
.asis-user .asis-t::after { content: ' ✓✓'; color: #34a0d8; letter-spacing: -2px; }
.asis-typing { background: #fff; border: 0; border-radius: 12px; border-top-left-radius: 3px; margin-left: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.13); }
.asis-chip { background: #fff; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.18); color: #1E3A5F; border-radius: 999px; padding: 9px 14px; font-size: .86rem; }
.asis-chip:hover { background: #1E3A5F; color: #fff; }
.asis-note { background: #EFE8DC; padding: 6px 14px 2px; text-align: center; font-size: .7rem; }
.asis-foot { background: #EFE8DC; padding: 6px 10px 10px; align-items: flex-end; }
.asis-input { border: 0; border-radius: 22px; padding: 11px 16px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.asis-input:focus-visible { outline: 2px solid var(--gold, #D4A24C); outline-offset: 0; }
.asis-send { flex: none; width: 46px; height: 46px; min-width: 0 !important; padding: 0; border-radius: 50%; background: #1E3A5F; color: #fff; font-size: 0; display: grid; place-items: center; }
.asis-send::before { content: ''; width: 20px; height: 20px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%, 14% 50%); margin-left: 3px; }
.asis-head { position: relative; z-index: 2; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
@media (max-width: 640px) {
  .asis-panel { position: fixed; top: 0; left: 0; right: 0; bottom: auto; width: 100%; height: 100dvh; overflow: hidden; }
  .asis-solo .asis-panel { position: fixed; top: 0; left: 0; right: 0; margin: 0; width: 100%; }
}
html:has(.asis-solo), .asis-solo { overscroll-behavior: none; }

/* ---- Estilo iMessage con la identidad del consultorio (2026-10-23): reemplaza al estilo anterior ---- */
.asis-body { background: #fff; background-image: none; padding: 14px 14px 8px; gap: 3px; }
.asis-msg { box-shadow: none; border-radius: 19px; padding: 8px 14px; max-width: 76%; font-size: 1.02rem; line-height: 1.3; margin: 0; }
.asis-bot { background: #E9E9EB; color: #111; margin-left: 0; border-top-left-radius: 19px; }
.asis-user { background: #1E3A5F; color: #fff; margin-right: 0; border-top-right-radius: 19px; }
.asis-user a, .asis-user a:visited { color: #fff; }
.asis-bot::before, .asis-user::before { content: none; }
.asis-t, .asis-user .asis-t::after { display: none; }
.asis-cola { margin-bottom: 7px; }
.asis-bot.asis-cola::before, .asis-user.asis-cola::before { content: ''; position: absolute; bottom: 0; width: 20px; height: 19px; clip-path: none; top: auto; }
.asis-bot.asis-cola::before { left: -7px; background: #E9E9EB; border-bottom-right-radius: 16px 14px; }
.asis-bot.asis-cola::after { content: ''; position: absolute; bottom: 0; left: -26px; width: 26px; height: 19px; background: #fff; border-bottom-right-radius: 10px; }
.asis-user.asis-cola::before { right: -7px; background: #1E3A5F; border-bottom-left-radius: 16px 14px; }
.asis-user.asis-cola::after { content: ''; position: absolute; bottom: 0; right: -26px; width: 26px; height: 19px; background: #fff; border-bottom-left-radius: 10px; }
.asis-bot .asis-wabtn { margin-top: 6px; }
.asis-dia { align-self: center; font-size: .7rem; color: #8a8a8e; margin: 2px 0 8px; font-weight: 500; }
.asis-typing { background: #E9E9EB; box-shadow: none; margin-left: 0; border-radius: 19px; padding: 13px 15px; }
.asis-typing i { background: #8a8a8e; }
.asis-chip { background: #fff; border: 1.5px solid #1E3A5F; box-shadow: none; color: #1E3A5F; font-weight: 600; }
.asis-chip:hover { background: #1E3A5F; color: #fff; }
.asis-note { background: #fff; color: #8a8a8e; }
.asis-foot { background: #fff; padding: 6px 12px 10px; align-items: center; }
.asis-input { background: #fff; border: 1px solid #c9c9ce; box-shadow: none; border-radius: 20px; padding: 10px 16px; }
.asis-input:focus-visible { outline: none; border-color: #1E3A5F; box-shadow: 0 0 0 3px rgba(212,162,76,.45); }
.asis-send { width: 34px; height: 34px; background: #1E3A5F; border-radius: 50%; align-self: center; }
.asis-send::before { width: 16px; height: 18px; margin: 0; clip-path: polygon(50% 0, 100% 52%, 77% 52%, 77% 100%, 23% 100%, 23% 52%, 0 52%); }
.asis-send:disabled { opacity: .35; }
/* Encabezado centrado, como el contacto en Mensajes */
.asis-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; justify-items: center; row-gap: 2px; padding: 10px 14px 10px; background: #1E3A5F; box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.asis-head .asis-avatar { grid-column: 2; grid-row: 1; width: 52px; height: 52px; }
.asis-head > div:not(.asis-avatar) { grid-column: 1 / -1; grid-row: 2; text-align: center; }
.asis-head strong { font-size: .92rem; display: inline; }
.asis-head small { display: block; font-size: .72rem; }
.asis-volver { grid-column: 1; grid-row: 1; justify-self: start; align-self: center; margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.16); text-decoration: none; font-weight: 600; opacity: 1; }
.asis-close { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; margin: 0; }
.asis-head .asis-avatar { width: 66px; height: 66px; } .asis-head .asis-avatar img { border: 2px solid rgba(255,255,255,.9); box-sizing: border-box; } .asis-head .asis-on { width: 14px; height: 14px; }

/* ---- Caja de texto tipo Mensajes: píldora con el botón de enviar adentro ---- */
.asis-panel { background: #fff; }
.asis-foot { margin: 6px 12px calc(10px + env(safe-area-inset-bottom)); padding: 4px 4px 4px 4px; background: #fff; border: 1px solid #c9c9ce; border-radius: 24px; align-items: center; gap: 4px; transition: border-color .15s, box-shadow .15s; }
.asis-foot:focus-within { border-color: #1E3A5F; box-shadow: 0 0 0 3px rgba(212,162,76,.40); }
.asis-input { border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0; padding: 8px 6px 8px 14px; outline: none !important; }
.asis-input::placeholder { color: #8a8a8e; }
.asis-send { flex: none; width: 54px; height: 34px; border-radius: 17px; background: #1E3A5F; color: #fff; display: grid; place-items: center; transition: opacity .15s, transform .15s; }
.asis-send::before { content: ''; width: 20px; height: 20px; margin: 0; clip-path: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V5'/%3E%3Cpath d='M5.5 11.5 12 5l6.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20V5'/%3E%3Cpath d='M5.5 11.5 12 5l6.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.asis-foot:has(.asis-input:placeholder-shown) .asis-send { opacity: 0; transform: scale(.7); pointer-events: none; }
.asis-send:disabled { opacity: .5; }

/* Flecha de enviar: SVG real, centrada en cualquier navegador (Safari iPhone incluido) */
.asis-send::before { content: none !important; display: none !important; }
.asis-send { display: flex !important; align-items: center; justify-content: center; padding: 0 !important; line-height: 0; font-size: 0; }
.asis-send svg { display: block; width: 20px; height: 20px; flex: none; }

/* ---- Diseño claro y limpio (2026-10-23): encabezado translúcido, sin bloques azules ---- */
.asis-panel { border: 0; }
.asis-head { background: rgba(250,250,251,.92); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); color: #111; box-shadow: 0 .5px 0 rgba(0,0,0,.22); padding: calc(8px + env(safe-area-inset-top)) 14px 8px; }
.asis-head strong { color: #111; font-size: .86rem; font-weight: 600; }
.asis-head small { color: #8a8a8e; opacity: 1; font-size: .7rem; }
.asis-head .asis-avatar { width: 58px; height: 58px; }
.asis-head .asis-avatar img { border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.asis-head .asis-on { width: 13px; height: 13px; border: 2px solid #fff; box-sizing: border-box; }
.asis-volver { background: none; color: #1E3A5F; padding: 6px 0; font-size: .95rem; font-weight: 500; text-decoration: none; opacity: 1; }
.asis-volver::before { content: '‹ '; font-size: 1.25em; line-height: 0; }
.asis-close { color: #1E3A5F; }
.asis-foot { background: #f2f2f7; border: 0; box-shadow: none; }
.asis-foot:focus-within { border: 0; box-shadow: none; background: #ececf1; }
.asis-note { font-size: .66rem; padding-top: 4px; }
@media (min-width: 641px) { html:has(.asis-solo), .asis-solo { background: #eef0f4 !important; } .asis-solo .asis-panel { box-shadow: 0 12px 40px rgba(20,35,60,.15); } }

/* ---- En el sitio: pop-up grande por encima de todo (el menú del sitio ya no lo tapa) ---- */
.asis-panel { z-index: 2000; }
.asis-btn { z-index: 1500; }
.asis-fondo { position: fixed; inset: 0; z-index: 1999; background: rgba(15,25,45,.45); display: none; }
.asis-fondo.open { display: block; }
@media (max-width: 640px) {
  body:not(.asis-solo) .asis-panel { left: 10px; right: 10px; width: auto; border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
  body:not(.asis-solo) .asis-head { padding-top: 10px; }
  
}
@media (min-width: 641px) { .asis-panel { width: min(420px, calc(100vw - 40px)); height: min(680px, calc(100dvh - 40px)); } .asis-solo .asis-panel { width: min(560px, 100%); height: calc(100dvh - 48px); } }

/* ---- Encabezado compacto (foto a la izquierda, datos a la derecha) y sin movimiento lateral ---- */
.asis-head { grid-template-columns: auto 1fr auto; align-items: center; justify-items: start; column-gap: 10px; row-gap: 0; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
body:not(.asis-solo) .asis-head { padding-top: 8px; }
.asis-head .asis-avatar { grid-column: 1; grid-row: 1; width: 44px; height: 44px; }
.asis-head .asis-on { width: 11px; height: 11px; border-width: 1.5px; }
.asis-head > div:not(.asis-avatar) { grid-column: 2; grid-row: 1; text-align: left; min-width: 0; }
.asis-head strong { display: block; font-size: .95rem; line-height: 1.15; }
.asis-head small { font-size: .72rem; line-height: 1.2; }
.asis-volver { grid-column: 3; grid-row: 1; justify-self: end; font-size: .88rem; }
.asis-volver::before { content: none; }
.asis-close { grid-column: 3; grid-row: 1; justify-self: end; }
.asis-panel, .asis-body { overflow-x: hidden; max-width: 100%; }
.asis-body { touch-action: pan-y; overscroll-behavior: contain; }
.asis-msg { overflow-wrap: anywhere; }
html:has(.asis-solo), .asis-solo { overflow: hidden; touch-action: pan-y; max-width: 100vw; }
.asis-body { overflow-x: clip; }
