/* ANDREA (24-oct-2026): el chat de ventas de la web (assets/js/andrea.js). Piel Dre UI: el azul del botón de la web, widgets
   blancos (#1C1C1E en oscuro), letra Inter, radios de iOS. Las medidas son las de la dreomar.com vieja: botón de 48 px (56 desde
   640 px) a 20 px de la esquina, chat de 380 × 560 en la computadora y hoja de 80 % del alto en el celular.
   Capas: la barra de arriba es 40, la barra de compra 45, ANDREA 60/70, las hojas 80, el aviso de cookies 85 (el chat abierto en el
   celular, 86), los avisos 90 y la etiqueta del dueño 120. */
.an[hidden] { display: none !important; }
.an { font-family: var(--letra); -webkit-font-smoothing: antialiased; }
.an button { font-family: inherit; cursor: pointer; }
.an :focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ── El botón flotante (con la burbuja o la etiqueta al lado) ── */
.an-flotante {
  position: fixed; z-index: 60; right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + var(--barra-abajo, 0px) + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 10px;
  transition: bottom .3s ease, opacity .2s ease, scale .2s ease;
}
/* Con el aviso de cookies abierto (sitio.js · --cookies-alto, que ya va encima de la barra fija o la de pago): ANDREA sube encima
   del aviso. En la vieja el aviso la tapaba en el celular y el botón no se podía tocar. */
body.con-cookies .an-flotante { bottom: calc(8px + var(--barra-abajo, 0px) + var(--cookies-alto, 0px)); }
/* Un flotante nunca tapa un botón: mientras uno pasa por detrás, se aparta y el toque llega al botón */
.an-flotante[data-apartado] { opacity: 0; scale: .8; pointer-events: none; }
.an-boton-caja { position: relative; flex-shrink: 0; }
/* 26-oct: WhatsApp encima de ANDREA, en la misma esquina (los dos suben juntos con la barra de compra y el aviso de cookies) */
.an-pila { display: flex; flex-direction: column; align-items: center; gap: 12px; flex-shrink: 0; }
.an-wa {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; color: #fff; background: #25D366;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 24px -8px rgba(37, 211, 102, .55), 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .2s var(--curva);
}
.an-wa svg { width: 24px; height: 24px; }
.an-wa:hover { transform: scale(1.08); }
@media (min-width: 640px) { .an-wa { width: 50px; height: 50px; } .an-wa svg { width: 26px; height: 26px; } }
.an-boton {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 999px;
  color: #fff; background: var(--degradado-boton); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 24px -8px rgba(11, 87, 208, .55), 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .2s var(--curva);
}
.an-boton svg { width: 24px; height: 24px; }
.an-boton:hover { transform: scale(1.08); }
.an-boton:active { transform: scale(.95); }
/* El anillo se expande una vez y descansa el resto del ciclo: llama la atención sin quedar parpadeando */
.an-anillo { position: absolute; inset: 0; border-radius: 999px; background: #1473FF; pointer-events: none; animation: an-anillo 4s ease-out infinite; }
@keyframes an-anillo { 0% { transform: scale(1); opacity: .5; } 22% { transform: scale(1.75); opacity: 0; } 100% { transform: scale(1.75); opacity: 0; } }
.an-uno {
  position: absolute; top: -2px; right: -2px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 999px;
  background: #FF3B30; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px var(--suelo); pointer-events: none;
}
.an-burbuja { max-width: 15rem; animation: an-entra .5s var(--curva) both; }
.an-burbuja-t {
  display: block; width: 100%; padding: 12px 16px; border: 0; border-radius: 18px 18px 6px 18px; text-align: left;
  background: var(--widget); color: var(--texto); font-size: 14px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 0 0 1px var(--linea), 0 18px 40px -16px var(--sombra);
}
.an-burbuja-t:hover { box-shadow: 0 0 0 1.5px var(--acento), 0 18px 40px -16px var(--sombra); }
.an-ahora-no { display: block; margin: 4px 0 0 auto; padding: 4px 2px; border: 0; background: none; color: var(--texto-3); font-size: 12px; }
.an-ahora-no:hover { color: var(--texto); }
.an-etiqueta {
  display: none; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; border-radius: 999px; margin-bottom: 6px;
  background: var(--widget); box-shadow: 0 0 0 1px var(--linea), 0 12px 30px -14px var(--sombra); animation: an-entra .5s var(--curva) both;
}
.an-etiqueta-t { padding: 2px 0; border: 0; background: none; color: var(--texto); font-size: 14px; font-weight: 500; }
.an-etiqueta-x { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 999px; background: none; color: var(--texto-3); }
.an-etiqueta-x:hover { color: var(--texto); background: var(--widget-2); }
.an-etiqueta-x svg { width: 14px; height: 14px; }
@keyframes an-entra { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 640px) {
  .an-boton { width: 56px; height: 56px; }
  .an-etiqueta { display: flex; }
}

/* ── El chat: hoja desde abajo en el celular, ventana de 380 × 560 en la computadora ── */
.an-panel {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; height: 80vh; height: 80dvh;
  display: flex; flex-direction: column; overflow: hidden; outline: none;
  border-radius: 22px 22px 0 0; background: var(--suelo); color: var(--texto);
  box-shadow: 0 0 0 1px var(--linea), 0 -20px 60px -20px var(--sombra);
  animation: an-sube .3s var(--curva) both;
}
@keyframes an-sube { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
/* El chat abierto en el celular (hoja a todo el ancho) va encima del aviso de cookies: lo abrió la persona, y el aviso sigue ahí al cerrarlo.
   En la computadora la ventana sube encima del aviso (así «Rechazar» y «Aceptar» se pueden tocar siempre). */
@media (max-width: 639px) { .an-panel { z-index: 86; } }
@media (min-width: 640px) {
  body.con-cookies .an-panel { bottom: calc(12px + var(--cookies-alto, 0px)); max-height: calc(100dvh - var(--cookies-alto, 0px) - 32px); }
}
@media (min-width: 640px) {
  .an-panel { left: auto; right: calc(20px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 380px; height: 560px; max-height: calc(100dvh - 40px); border-radius: 22px; box-shadow: 0 0 0 1px var(--linea), 0 30px 70px -24px var(--sombra); }
}
html[data-theme="dark"] .an-panel { --suelo: #111113; --widget: #1C1C1E; --widget-2: #2C2C2E; background: #111113; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 30px 70px -24px rgba(0, 0, 0, .9); }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .an-panel { --suelo: #111113; --widget: #1C1C1E; --widget-2: #2C2C2E; background: #111113; } }

.an-cabeza { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; background: var(--widget); box-shadow: inset 0 -1px 0 var(--linea); }
.an-avatar { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 999px; background: var(--degradado-boton); color: #fff; font-size: 14px; font-weight: 700; }
.an-quien { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.an-quien b { font-size: 14px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.an-quien span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texto-3); }
.an-punto { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: #30D158; }
.an-cerrar { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: none; color: var(--texto-3); }
.an-cerrar:hover { background: var(--widget-2); color: var(--texto); }
.an-cerrar svg { width: 18px; height: 18px; }

.an-conversa { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.an-m { display: flex; flex-direction: column; align-items: flex-start; }
.an-m.yo { align-items: flex-end; }
.an-m > p { max-width: 85%; margin: 0; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.an-m.yo > p { border-bottom-right-radius: 6px; background: var(--acento-boton); color: #fff; }
.an-m.andrea > p { border-bottom-left-radius: 6px; background: var(--widget); color: var(--texto); box-shadow: 0 0 0 1px var(--linea); }
.an-m.error > p { background: color-mix(in srgb, var(--urgente) 7%, var(--widget)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--urgente) 28%, transparent); }
.an-reintentar { margin-top: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--widget); color: var(--acento); font-size: 13px; font-weight: 600; box-shadow: 0 0 0 1px var(--linea); }
.an-reintentar:hover { box-shadow: 0 0 0 1.5px var(--acento); }
.an-escribe { display: flex; gap: 4px; padding: 14px 16px; border-radius: 18px 18px 18px 6px; background: var(--widget); box-shadow: 0 0 0 1px var(--linea); }
.an-escribe i { width: 6px; height: 6px; border-radius: 999px; background: var(--texto-3); animation: an-salta 1s ease-in-out infinite; }
.an-escribe i:nth-child(2) { animation-delay: .15s; }
.an-escribe i:nth-child(3) { animation-delay: .3s; }
@keyframes an-salta { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-4px); } }

/* Atajos a los cursos, preguntas rápidas y la llamada (se van al primer mensaje, la llamada se queda) */
.an-extras { flex-shrink: 0; }
.an-cursos { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 8px; }
.an-curso { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: 12px; text-align: left; background: var(--widget); color: var(--texto); font-size: 13px; box-shadow: 0 0 0 1px var(--linea); }
.an-curso:hover { box-shadow: 0 0 0 1.5px var(--acento); }
.an-curso-raya { flex-shrink: 0; width: 3px; height: 14px; border-radius: 999px; background: var(--acento); }
.an-curso-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.an-curso-p { flex-shrink: 0; font-weight: 600; color: var(--acento); font-variant-numeric: tabular-nums; }
/* 4-nov: el combo Black Friday, primero y en negro */
.an-combo { text-decoration: none; color: #FFFFFF; background: radial-gradient(120% 140% at 0% 0%, #0B2A5C 0%, #000000 70%); box-shadow: 0 0 0 1px rgba(61, 155, 255, .45); }
.an-combo .an-curso-t { font-weight: 700; }
.an-combo .an-curso-p { color: #22C55E; font-weight: 800; }
.an-combo:hover { box-shadow: 0 0 0 1.5px #3D9BFF; }
.an-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; }
.an-chips::-webkit-scrollbar { display: none; }
.an-chip { flex-shrink: 0; padding: 7px 12px; border: 0; border-radius: 999px; background: var(--widget); color: var(--texto); font-size: 13px; box-shadow: 0 0 0 1px var(--linea); }
.an-chip:hover { box-shadow: 0 0 0 1.5px var(--acento); }
.an-llamada-zona { padding: 0 12px 6px; }
.an-llamada { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 9px 16px; border: 0; border-radius: 999px; color: #fff; background: var(--degradado-boton); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 20px -10px rgba(11, 87, 208, .6); transition: filter .15s ease, transform .15s ease; }
.an-llamada:hover { filter: brightness(1.08); }
.an-llamada:active { transform: scale(.98); }
.an-llamada b { font-size: 14px; font-weight: 700; }
.an-llamada span { font-size: 12px; opacity: .92; }
.an-llamada-caja { padding: 12px; border-radius: 18px; background: var(--widget); box-shadow: 0 0 0 1px var(--linea); animation: an-sube .25s var(--curva) both; }
.an-llamada-form, .an-form { display: flex; align-items: center; gap: 8px; }
.an-entrada { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--suelo); color: var(--texto); font: 16px/1 var(--letra); box-shadow: 0 0 0 1px var(--linea); outline: none; }
.an-entrada::placeholder { color: var(--texto-3); }
.an-entrada:focus { box-shadow: 0 0 0 1.5px var(--acento); }
@media (min-width: 640px) { .an-entrada { font-size: 14px; } } /* en el celular 16 px: así el iPhone no hace zoom al escribir */
.an-llamame { flex-shrink: 0; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--acento-boton); color: #fff; font-size: 14px; font-weight: 600; }
.an-llamame:disabled, .an-enviar:disabled { opacity: .4; cursor: default; }
.an-llamada-nota { margin: 8px 2px 0; font-size: 12px; line-height: 1.4; color: var(--texto-3); }
.an-enlace { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; text-decoration: underline; }
.an-enlace:hover { color: var(--texto); }

/* La barra de escribir */
.an-escribir { flex-shrink: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--widget); box-shadow: inset 0 1px 0 var(--linea); }
@media (min-width: 640px) { .an-escribir { padding-bottom: 10px; } }
.an-mic, .an-enviar { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border: 0; border-radius: 999px; }
.an-mic { background: none; color: var(--texto-3); }
.an-mic:hover { background: var(--widget-2); color: var(--texto); }
.an-mic.escuchando { background: var(--acento-boton); color: #fff; animation: an-late 1.2s ease-in-out infinite; }
@keyframes an-late { 50% { opacity: .65; } }
.an-enviar { background: var(--acento-boton); color: #fff; }
.an-mic svg, .an-enviar svg { width: 18px; height: 18px; }
.an-pie { margin: 8px 0 0; font-size: 11px; line-height: 1.3; text-align: center; color: var(--texto-3); }
.an-pie a { color: inherit; text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .an-anillo { animation: none; opacity: 0; }
  .an-flotante, .an-boton, .an-llamada { transition: none; }
  .an-burbuja, .an-etiqueta, .an-panel, .an-llamada-caja { animation: none; }
  .an-escribe i, .an-mic.escuchando { animation: none; }
}
@media print { .an { display: none !important; } }
