/* ==========================================================================
   EVA, la asistente de presupuestos (solo inicio: /, /en/ y /de/)
   El chat de la sección de contacto, su ventana flotante y el botón
   "Habla con EVA". Las páginas legales y las de EVA no cargan este archivo.
   ========================================================================== */

/* ---------- Columna de texto de la sección de contacto ---------- */

.contacto__texto > .contacto__alternativa { margin-top: 30px; color: #8d96aa; font-size: 14px; font-weight: 700; }
.contacto__alternativa + .canales { margin-top: 14px; }

/* ---------- Hueco del chat en la sección de contacto ---------- */

.contacto__chat { position: relative; min-width: 0; height: 640px; }
.contacto__chat > .eva-chat { height: 100%; }
.eva-hueco { display: none; }
.contacto__chat.eva-hueco--activo .eva-hueco {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  height: 100%; padding: 32px;
  border: 1.5px dashed rgb(255 255 255 / .18);
  border-radius: 24px;
  color: #b8bfce; text-align: center;
}
.eva-hueco p { max-width: 280px; font-weight: 600; }
.eva-sin-js { color: #b8bfce; }
.eva-sin-js a { color: #fff; text-decoration: underline; }

/* ---------- Avatar: «e.» blanca sobre el azul de la marca (igual en todas partes) ---------- */

.eva-avatar {
  position: relative; flex: none;
  display: block; width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--acento);
}
.eva-avatar span {
  position: absolute; left: 0; right: 4px; top: 3px;
  color: #fff; text-align: center;
  font: italic 400 30px/1 var(--fuente-display);
}
.eva-avatar i { position: absolute; left: 62%; top: 59%; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.eva-avatar::after {
  content: "";
  position: absolute; right: -2px; bottom: -2px;
  width: 13px; height: 13px;
  border: 2.5px solid var(--superficie);
  border-radius: 50%;
  background: #22c55e;
}

/* ---------- Chat ---------- */

.eva-chat {
  display: flex; flex-direction: column;
  min-height: 0;
  border-radius: 24px;
  background: var(--superficie);
  color: var(--tinta);
  box-shadow: var(--sombra-l);
  overflow: hidden;
}
.eva-chat__cab {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px 14px 18px;
  border-bottom: 1px solid var(--borde);
}
.eva-chat__nombre { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.25; }
.eva-chat__nombre b { font-size: 16.5px; font-weight: 800; letter-spacing: .03em; }
.eva-chat__nombre small {
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: var(--texto-2); font-size: 12.5px; font-weight: 600;
}
.eva-chat__nombre small i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--verde); }
.eva-chat__boton {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--texto-2);
  transition: background .2s, color .2s;
}
.eva-chat__boton:hover { background: var(--suave); color: var(--tinta); }
.eva-chat__boton .icono { width: 19px; height: 19px; }
.eva-chat__cerrar { display: none; }
.eva-chat--panel .eva-chat__cerrar { display: grid; }

.eva-chat__log {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 16px 16px;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--fondo);
  scrollbar-width: thin;
}
.eva-chat__log:focus-visible { outline-offset: -3px; }

.eva-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px; font-weight: 500; line-height: 1.45;
  overflow-wrap: anywhere;
  animation: eva-entra .32s cubic-bezier(.2, .7, .2, 1) both;
}
.eva-msg em, .eva-msg b { font-style: normal; font-weight: 800; }
.eva-msg a { color: var(--acento-texto); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.eva-msg--ia { white-space: pre-line; }
.eva-msg--eva { align-self: flex-start; border-bottom-left-radius: 6px; background: var(--superficie); box-shadow: var(--sombra-s); }
.eva-msg--cliente { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--acento); color: #fff; white-space: pre-line; }
.eva-msg--cliente + .eva-msg--eva, .eva-msg--eva + .eva-msg--cliente { margin-top: 6px; }
@keyframes eva-entra { from { opacity: 0; transform: translateY(8px); } }

/* Puntos de "EVA está escribiendo" */
.eva-puntos { display: flex; gap: 4px; padding: 5px 2px; }
.eva-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--texto-3); animation: eva-punto 1s ease-in-out infinite; }
.eva-puntos i:nth-child(2) { animation-delay: .15s; }
.eva-puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes eva-punto { 0%, 60%, 100% { opacity: .4; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }

/* Resumen de la solicitud */
.eva-msg--tarjeta { width: 86%; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--borde); }
.eva-resumen { display: grid; gap: 11px; margin: 0; }
.eva-resumen div { display: grid; gap: 1px; }
.eva-resumen dt { color: var(--texto-3); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.eva-resumen dd { margin: 0; font-size: 14.5px; font-weight: 600; }

/* Respuestas sugeridas */
.eva-opciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; animation: eva-entra .32s cubic-bezier(.2, .7, .2, 1) both; }
.eva-opcion {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 7px 15px;
  border-radius: 999px;
  background: var(--superficie);
  box-shadow: inset 0 0 0 1.5px #c9d5ff;
  color: var(--acento-texto);
  font-size: 14px; font-weight: 700; line-height: 1.25; text-align: left;
  transition: background .2s, box-shadow .2s, color .2s;
}
.eva-opcion:hover { background: var(--acento-suave); box-shadow: inset 0 0 0 1.5px var(--acento); }
.eva-opcion .icono { width: 16px; height: 16px; stroke-width: 2.4; }
.eva-opcion[aria-pressed] .icono { display: none; }
.eva-opcion[aria-pressed="true"] { background: var(--acento); color: #fff; box-shadow: none; }
.eva-opcion[aria-pressed="true"] .icono { display: block; }
.eva-opcion--primaria { background: var(--tinta); color: #fff; box-shadow: none; }
.eva-opcion--primaria:hover { background: #262e44; box-shadow: none; }
.eva-opcion--primaria:disabled { opacity: .3; cursor: not-allowed; }
.eva-opcion--suave { color: var(--texto-2); box-shadow: inset 0 0 0 1.5px var(--borde); }
.eva-opcion--suave:hover { background: var(--suave); box-shadow: inset 0 0 0 1.5px var(--texto-3); }

/* Campo de texto */
.eva-chat__entrada {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 12px 8px 14px;
  border-top: 1px solid var(--borde);
  background: var(--superficie);
}
.eva-chat__entrada textarea {
  flex: 1; min-width: 0;
  height: 46px; max-height: 132px;
  padding: 12px 16px;
  border: 0; border-radius: 23px;
  background: var(--fondo);
  box-shadow: inset 0 0 0 1px var(--borde);
  font-size: 16px; line-height: 1.4;
  resize: none; outline: none;
  transition: box-shadow .2s;
}
.eva-chat__entrada textarea::placeholder { color: var(--texto-3); }
.eva-chat__entrada textarea:focus { box-shadow: inset 0 0 0 1.5px var(--acento), 0 0 0 4px rgb(47 92 255 / .12); }
.eva-chat__enviar {
  display: grid; place-items: center; flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--acento); color: #fff;
  transition: background .2s, opacity .2s;
}
.eva-chat__enviar:hover { background: var(--acento-hover); }
.eva-chat__enviar:disabled, .eva-chat__entrada--espera .eva-chat__enviar { opacity: .4; cursor: default; }
.eva-chat__nota {
  padding: 0 16px 12px 18px;
  background: var(--superficie);
  color: var(--texto-3);
  font-size: 11.5px; font-weight: 600; line-height: 1.45;
}
.eva-chat__nota a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Botón flotante "Habla con EVA" y ventana flotante ---------- */

.eva-flotante {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  pointer-events: none;
}
.eva-flotante > * { pointer-events: auto; }

/* El botón es el avatar de EVA: azul de la marca, con la «e.» blanca y un latido
   para que se vea (igual en escritorio y en móvil) */
.eva-lanzador {
  position: relative;
  display: grid; place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--acento);
  box-shadow: 0 14px 30px -10px rgb(47 92 255 / .75), 0 0 0 3px #fff;
  opacity: 0; transform: translateY(16px);
  transition: opacity .35s, transform .35s cubic-bezier(.2, .7, .2, 1), background .2s, visibility 0s .35s;
  visibility: hidden;
}
.eva-lanzador::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  animation: eva-latido 2.2s ease-out infinite;
}
.eva-lanzador:hover { background: var(--acento-hover); }
.eva-lanzador .eva-avatar { width: 64px; height: 64px; background: transparent; }
.eva-lanzador .eva-avatar span { top: 7px; font-size: 46px; }
.eva-lanzador .eva-avatar i { left: 64%; top: 61%; width: 7px; height: 7px; background: #fff; }
.eva-lanzador .eva-avatar::after { right: 0; bottom: 0; border-color: #fff; }
.eva-flotante--listo .eva-lanzador { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.eva-flotante--listo .eva-lanzador:hover { transform: translateY(-2px); }
.eva-flotante--oculto .eva-lanzador,
.eva-flotante--oculto .eva-teaser { opacity: 0; transform: translateY(16px); visibility: hidden; pointer-events: none; transition: opacity .3s, transform .3s, visibility 0s .3s; }
.eva-lanzador__texto { display: none; }
.eva-lanzador__cerrar { display: none; place-items: center; width: 64px; height: 64px; color: #fff; }
.eva-lanzador__cerrar .icono { width: 24px; height: 24px; }
.eva-flotante--abierto .eva-lanzador::before { animation: none; }
.eva-flotante--abierto .eva-lanzador .eva-avatar { display: none; }
.eva-flotante--abierto .eva-lanzador__cerrar { display: grid; }

/* El saludo sale a la izquierda del avatar, como un globo de diálogo */
.eva-teaser {
  position: absolute; right: 80px; bottom: 4px;
  width: max-content;
  max-width: 280px;
  border-radius: 20px 20px 6px 20px;
  background: var(--oscuro); color: #fff;
  box-shadow: var(--sombra-l);
  animation: eva-entra .4s cubic-bezier(.2, .7, .2, 1) both;
}
.eva-teaser__texto { display: block; padding: 14px 44px 14px 18px; font-size: 14px; font-weight: 600; line-height: 1.45; text-align: left; }
.eva-teaser__cerrar {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: #aab3c5;
}
.eva-teaser__cerrar:hover { background: rgb(255 255 255 / .1); color: #fff; }
.eva-teaser__cerrar .icono { width: 16px; height: 16px; }

.eva-panel {
  width: min(400px, calc(100vw - 48px));
  height: min(640px, calc(100dvh - 130px));
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right;
  transition: opacity .22s, transform .22s cubic-bezier(.2, .7, .2, 1);
}
.eva-panel.visible { opacity: 1; transform: none; }
.eva-panel > .eva-chat { height: 100%; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .contacto__chat { width: min(100%, 640px); }
}

@media (max-width: 760px) {
  .contacto__chat { height: min(600px, 82vh); min-height: 500px; }
  .eva-chat__log { padding: 16px 12px 12px; }
  .eva-msg { max-width: 90%; font-size: 14.5px; }
  .eva-msg--tarjeta { width: 92%; }
}

@media (max-width: 560px) {
  .eva-flotante { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .eva-lanzador .eva-avatar, .eva-lanzador__cerrar { width: 60px; height: 60px; }
  .eva-lanzador .eva-avatar span { top: 6px; font-size: 43px; }
  .eva-teaser { right: 74px; max-width: min(270px, calc(100vw - 106px)); }

  /* En el móvil la ventana ocupa toda la pantalla y se ajusta al teclado */
  .eva-panel {
    position: fixed; left: 0; right: 0;
    top: var(--vv-arriba, 0);
    width: 100%; height: var(--vv-alto, 100dvh);
    transform: translateY(24px);
  }
  .eva-panel > .eva-chat { border-radius: 0; box-shadow: none; }
  .eva-flotante--abierto .eva-lanzador { display: none; }
}

@keyframes eva-latido {
  0% { box-shadow: 0 0 0 0 rgb(47 92 255 / .55); }
  75%, 100% { box-shadow: 0 0 0 16px rgb(47 92 255 / 0); }
}

@media (prefers-reduced-motion: reduce) {
  .eva-msg, .eva-opciones, .eva-teaser, .eva-puntos i, .eva-lanzador::before { animation: none; }
  .eva-panel, .eva-lanzador { transition: none; }
}
