/* MUFAH Solutions · showroom de demos · piel del chatbot
   Esto imita WhatsApp a propósito: colores, tipografía del sistema y proporciones son
   las de la app, no las del kit de MUFAH. El kit manda fuera del teléfono; dentro, la
   ilusión manda. La identidad del negocio ficticio entra por --acento (la pone el shell). */

.wa {
  --wa-fondo: #EFEAE2;
  --wa-barra: #FFFFFF;
  --wa-texto: #111B21;
  --wa-secundario: #667781;
  --wa-icono: #54656F;
  --wa-entrante: #FFFFFF;
  --wa-saliente: #D9FDD3;
  --wa-verde: #00A884;
  --wa-azul-boton: #027EB5;
  --wa-paloma: #53BDEB;
  --wa-paloma-gris: #8696A0;
  --wa-aviso: #FFF5C4;
  --wa-entrada: #F0F2F5;
  --wa-radio: 7.5px;
  flex: 1; min-height: 0; min-width: 0; max-width: 100%; display: flex; flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.2px; line-height: 1.35; color: var(--wa-texto);
  background: var(--wa-fondo);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}

/* ── Barra de estado del sistema: no se usa; en un teléfono real ya existe ── */
.wa__sistema { display: none; }

/* ── Barra superior del chat ── */
.wa__barra {
  display: flex; align-items: center; gap: 6px; flex: none;
  height: 60px; padding: 0 6px 0 4px; background: var(--wa-barra); color: var(--wa-texto);
  box-shadow: 0 1px 0 rgba(11,20,26,.08); position: relative; z-index: 2;
}
.wa__atras { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 40px; border: 0; background: transparent; color: var(--wa-icono); padding: 0; }
.wa__avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--acento, #2E6FD8); color: var(--acento-texto, #fff);
}
.wa__avatar svg, .wa__avatar img { width: 100%; height: 100%; object-fit: cover; }
.wa__quien { flex: 1; min-width: 0; padding-left: 6px; line-height: 1.2; }
.wa__nombre { display: flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa__verificado { width: 16px; height: 16px; flex: none; }
.wa__estado { font-size: 13px; color: var(--wa-secundario); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.wa__acciones { display: flex; align-items: center; gap: 2px; flex: none; color: var(--wa-icono); }
.wa__acciones span { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; }

/* ── Área de mensajes ── */
.wa__chat {
  flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 3px;
  background-color: var(--wa-fondo);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><g fill='none' stroke='%23000' stroke-opacity='.055' stroke-width='1.4' stroke-linecap='round'><circle cx='28' cy='34' r='9'/><path d='M70 20l8 8-8 8-8-8z'/><path d='M150 30c6-10 18-10 24 0'/><path d='M190 70v14M183 77h14'/><circle cx='120' cy='96' r='5'/><path d='M40 120c0-8 6-14 14-14s14 6 14 14'/><path d='M90 150l12 12M102 150l-12 12'/><path d='M160 140h22M171 129v22'/><circle cx='200' cy='180' r='11'/><path d='M30 190l9-16 9 16z'/><path d='M120 200c8-6 16-6 24 0'/><path d='M72 72c4-4 8-4 12 0s8 4 12 0'/></g></svg>");
}
.wa__fecha, .wa__aviso {
  align-self: center; max-width: 90%; text-align: center;
  font-size: 12.5px; color: var(--wa-icono); padding: 5px 12px; margin: 4px 0;
  border-radius: var(--wa-radio); box-shadow: 0 1px .5px rgba(11,20,26,.13);
}
.wa__fecha { background: #FFFFFF; text-transform: none; }
.wa__aviso { background: var(--wa-aviso); line-height: 1.4; }

.wa__msg { display: flex; max-width: 86%; min-width: 0; flex-direction: column; animation: wa-entrar .18s ease-out; }
.wa__msg--bot { align-self: flex-start; align-items: flex-start; }
.wa__msg--yo { align-self: flex-end; align-items: flex-end; }
.wa__msg + .wa__msg--bot, .wa__msg + .wa__msg--yo { margin-top: 2px; }
.wa__msg--bot + .wa__msg--yo, .wa__msg--yo + .wa__msg--bot { margin-top: 10px; }
@keyframes wa-entrar { from { transform: translateY(6px); } to { transform: none; } }

.wa__burbuja {
  position: relative; padding: 6px 8px 7px 9px; border-radius: var(--wa-radio);
  box-shadow: 0 1px .5px rgba(11,20,26,.13); max-width: 100%; min-width: 96px;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.wa__msg--bot .wa__burbuja { background: var(--wa-entrante); border-top-left-radius: 0; }
.wa__msg--yo .wa__burbuja { background: var(--wa-saliente); border-top-right-radius: 0; }
.wa__msg--bot .wa__burbuja::before, .wa__msg--yo .wa__burbuja::before {
  content: ""; position: absolute; top: 0; width: 0; height: 0; border-style: solid;
}
.wa__msg--bot .wa__burbuja::before { left: -8px; border-width: 0 8px 10px 0; border-color: transparent var(--wa-entrante) transparent transparent; }
.wa__msg--yo .wa__burbuja::before { right: -8px; border-width: 0 0 10px 8px; border-color: transparent transparent transparent var(--wa-saliente); }
.wa__msg--seguido .wa__burbuja { border-radius: var(--wa-radio); }
.wa__msg--seguido .wa__burbuja::before { display: none; }

.wa__texto { white-space: pre-wrap; }
.wa__texto strong { font-weight: 600; }
.wa__meta {
  float: right; margin: 6px -2px -4px 10px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; line-height: 1; color: var(--wa-secundario); white-space: nowrap;
}
.wa__palomas { width: 16px; height: 11px; flex: none; }
.wa__palomas--gris { color: var(--wa-paloma-gris); }
.wa__palomas--azul { color: var(--wa-paloma); }

/* ── Indicador «escribiendo…» ── */
.wa__escribiendo { align-self: flex-start; margin-top: 10px; }
.wa__escribiendo .wa__burbuja { display: flex; gap: 4px; align-items: center; padding: 12px 14px; min-width: 0; }
.wa__escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--wa-paloma-gris); animation: wa-punto 1.2s infinite ease-in-out; }
.wa__escribiendo i:nth-child(2) { animation-delay: .15s; }
.wa__escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes wa-punto { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ── Botones de respuesta (los «reply buttons» de WhatsApp) ── */
.wa__opciones { display: flex; flex-direction: column; gap: 3px; align-self: flex-start; width: 86%; max-width: 86%; margin-top: 3px; }
.wa__boton {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 12px; border: 0; border-radius: var(--wa-radio);
  background: var(--wa-entrante); color: var(--wa-azul-boton);
  font-family: inherit; font-size: 14.2px; font-weight: 500; line-height: 1.25; text-align: center;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background .12s;
}
.wa__boton:active { background: #F5F6F6; }
.wa__boton svg { width: 18px; height: 18px; flex: none; }
.wa__boton--lista { font-weight: 500; }
.wa__opciones--usadas .wa__boton { opacity: .55; pointer-events: none; }
.wa__boton--inicio { color: var(--wa-secundario); }

/* ── Tarjetas de producto / propiedad: carrusel dentro de una burbuja ── */
.wa__msg--tarjetas { max-width: 100%; width: 100%; min-width: 0; }
.wa__msg--tarjetas .wa__burbuja { width: 100%; min-width: 0; }
.wa__carrusel {
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; max-width: 100%;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px; margin: 0 -2px;
}
.wa__carrusel::-webkit-scrollbar { display: none; }
.wa__tarjeta {
  flex: 0 0 228px; scroll-snap-align: start; display: flex; flex-direction: column;
  background: var(--wa-entrante); border-radius: var(--wa-radio); overflow: hidden;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
}
.wa__tarjeta-imagen { aspect-ratio: 4 / 3; background: var(--acento-claro, #F0F2F5); overflow: hidden; }
.wa__tarjeta-imagen svg, .wa__tarjeta-imagen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa__tarjeta-cuerpo { padding: 8px 10px 6px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.wa__tarjeta-titulo { font-weight: 600; font-size: 14.2px; line-height: 1.25; }
.wa__tarjeta-texto { font-size: 12.8px; color: var(--wa-secundario); line-height: 1.35; }
.wa__tarjeta-precio { font-size: 14px; font-weight: 600; margin-top: 4px; color: var(--wa-texto); }
.wa__tarjeta-precio small { font-weight: 400; color: var(--wa-secundario); font-size: 12px; }
.wa__tarjeta-etiqueta {
  align-self: flex-start; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 4px; background: var(--acento-claro, #F0F2F5); color: var(--acento-oscuro, #204E97);
}
.wa__tarjeta-botones { display: flex; flex-direction: column; border-top: 1px solid rgba(11,20,26,.08); }
.wa__tarjeta-boton {
  border: 0; background: transparent; color: var(--wa-azul-boton); font-family: inherit;
  font-size: 14px; font-weight: 500; padding: 10px 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.wa__tarjeta-boton + .wa__tarjeta-boton { border-top: 1px solid rgba(11,20,26,.08); }
.wa__tarjeta-boton:active { background: #F5F6F6; }
.wa__tarjeta-boton svg { width: 18px; height: 18px; }
.wa__tarjetas-pista { font-size: 11.5px; color: var(--wa-secundario); text-align: center; padding: 2px 0 0; }

/* ── Ficha (detalle con galería) ── */
.wa__msg--ficha { max-width: 92%; }
.wa__ficha { width: 100%; overflow: hidden; border-radius: var(--wa-radio); padding: 0 !important; }
.wa__galeria { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; background: var(--acento-claro, #F0F2F5); }
.wa__galeria::-webkit-scrollbar { display: none; }
.wa__galeria > * { flex: 0 0 100%; scroll-snap-align: start; width: 100%; height: 100%; object-fit: cover; }
.wa__galeria-puntos { display: flex; justify-content: center; gap: 5px; padding: 6px 0 0; }
.wa__galeria-puntos i { width: 6px; height: 6px; border-radius: 50%; background: rgba(11,20,26,.18); }
.wa__galeria-puntos i:first-child { background: var(--wa-icono); }
.wa__ficha-cuerpo { padding: 8px 10px 8px; }
.wa__ficha-cuerpo::after, .wa__ubicacion-cuerpo::after { content: ""; display: block; clear: both; }
.wa__ficha .wa__meta, .wa__ubicacion .wa__meta { margin-bottom: 0; }
.wa__ficha-titulo { font-weight: 600; font-size: 15px; line-height: 1.25; }
.wa__ficha-precio { font-size: 17px; font-weight: 700; margin: 3px 0 6px; }
.wa__ficha-precio small { font-size: 12px; font-weight: 400; color: var(--wa-secundario); }
.wa__ficha-detalles { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--wa-secundario); margin-bottom: 6px; }
.wa__ficha-detalles b { color: var(--wa-texto); font-weight: 600; }
.wa__ficha-texto { font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; }

/* ── Ubicación ── */
.wa__ubicacion { padding: 0 !important; overflow: hidden; width: 240px; max-width: 100%; }
.wa__mapa { aspect-ratio: 16 / 10; background: #E8ECE5; position: relative; }
.wa__mapa svg { width: 100%; height: 100%; display: block; }
.wa__ubicacion-cuerpo { padding: 7px 9px 8px; }
.wa__ubicacion-titulo { font-weight: 600; font-size: 14px; }
.wa__ubicacion-texto { font-size: 12.8px; color: var(--wa-secundario); line-height: 1.35; }

/* ── Entrada bloqueada: se ve, no se usa ── */
.wa__entrada {
  flex: none; display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0)); background: var(--wa-entrada);
}
.wa__campo {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 10px 0 12px; background: #FFFFFF; border-radius: 24px; color: var(--wa-icono);
}
.wa__campo svg { width: 24px; height: 24px; flex: none; }
.wa__campo input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--wa-texto); padding: 0;
}
.wa__campo input::placeholder { color: var(--wa-paloma-gris); opacity: 1; }
.wa__campo input:disabled { color: var(--wa-texto); -webkit-text-fill-color: var(--wa-paloma-gris); }
.wa__mic {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--wa-verde); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.wa__mic svg { width: 22px; height: 22px; }

/* ── Hoja de lista (los «list messages» de WhatsApp) ── */
.wa__hoja { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: flex-end; }
.wa__hoja-fondo { position: absolute; inset: 0; background: rgba(11,20,26,.45); animation: wa-fundido .15s ease-out; }
.wa__hoja-panel {
  position: relative; background: #FFFFFF; border-radius: 12px 12px 0 0; max-height: 78%;
  display: flex; flex-direction: column; animation: wa-subir .22s ease-out;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes wa-subir { from { transform: translateY(24px); } to { transform: none; } }
@keyframes wa-fundido { from { opacity: 0; } to { opacity: 1; } }
.wa__hoja-cabeza { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 16px; border-bottom: 1px solid rgba(11,20,26,.08); }
.wa__hoja-titulo { flex: 1; font-size: 16px; font-weight: 500; }
.wa__hoja-cerrar { width: 36px; height: 36px; border: 0; background: transparent; color: var(--wa-icono); display: inline-flex; align-items: center; justify-content: center; }
.wa__hoja-seccion { padding: 10px 16px 4px; font-size: 12.5px; font-weight: 600; color: var(--wa-verde); text-transform: none; }
.wa__hoja-lista { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.wa__hoja-fila {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 16px; border: 0; background: transparent; font-family: inherit; font-size: 15px; color: var(--wa-texto);
  -webkit-tap-highlight-color: transparent;
}
.wa__hoja-fila:active { background: #F5F6F6; }
.wa__hoja-fila i { flex: none; width: 20px; height: 20px; border: 2px solid var(--wa-paloma-gris); border-radius: 50%; margin-left: auto; }
.wa__hoja-fila span { flex: 1; }
.wa__hoja-fila small { display: block; font-size: 12.5px; color: var(--wa-secundario); }

/* ── Avatar por iniciales (cuando un ítem no trae imagen) ── */
.wa__inicial { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 38px; color: var(--acento-texto, #fff); background: var(--acento, #2E6FD8); }

@media (prefers-reduced-motion: reduce) {
  .wa__msg, .wa__hoja-panel, .wa__hoja-fondo { animation: none; }
}

/* ══════════════════════════════════════════════════════════
   DEMO ANCHO (≥ 700 px de pantalla) · WhatsApp Web: columna de chats +
   conversación. Depende del ancho del demo, no del aparato.
   ══════════════════════════════════════════════════════════ */
.wa__lateral { display: none; }
.wa__principal { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
@container pantalla (min-width: 700px) {
  .wa { display: grid; grid-template-columns: minmax(250px, 30%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .wa__principal { border-left: 1px solid rgba(11,20,26,.1); }
  .wa__lateral { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #FFFFFF; }
  .wa__lateral-cab { flex: none; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 14px 0 16px; background: var(--wa-entrada); }
  .wa__avatar--yo { width: 40px; height: 40px; background: #DFE5E7; color: #fff; }
  .wa__inicial--chica { font-size: 15px; background: var(--wa-paloma-gris); }
  .wa__lateral-iconos { display: flex; gap: 4px; color: var(--wa-icono); }
  .wa__lateral-iconos svg { width: 24px; height: 24px; margin: 8px; }
  .wa__lateral-buscar { flex: none; display: flex; align-items: center; gap: 12px; margin: 8px 12px; height: 35px; padding: 0 14px; border-radius: 8px; background: var(--wa-entrada); color: var(--wa-paloma-gris); font-size: 14px; }
  .wa__lateral-buscar svg { width: 18px; height: 18px; color: var(--wa-icono); flex: none; }
  .wa__lateral-lista { flex: 1; min-height: 0; overflow: hidden; }
  .wa__chatfila { display: flex; align-items: center; gap: 14px; height: 72px; padding: 0 16px 0 14px; }
  .wa__chatfila--activa { background: var(--wa-entrada); }
  .wa__chatfila .wa__avatar { width: 49px; height: 49px; }
  .wa__chatfila-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .wa__chatfila-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .wa__chatfila-cab strong { font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wa__chatfila-cab time { font-size: 12px; color: var(--wa-secundario); flex: none; }
  .wa__chatfila-previa { font-size: 14px; color: var(--wa-secundario); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wa__chatfila--silueta { opacity: .55; }
  .wa__silueta-avatar { width: 49px; height: 49px; border-radius: 50%; background: #E9EDEF; flex: none; }
  .wa__silueta-linea { display: block; height: 10px; border-radius: 5px; background: #E9EDEF; }
  .wa__silueta-linea--suave { height: 8px; background: #F0F2F5; }

  /* La conversación, como en la web: cabecera gris, burbujas al 65 %, botones acotados */
  .wa__barra { background: var(--wa-entrada); height: 60px; padding: 0 16px; box-shadow: none; }
  .wa__atras { display: none; }
  .wa__chat { padding: 12px 6% 16px; }
  .wa__msg { max-width: 65%; }
  .wa__msg--tarjetas { max-width: 720px; width: auto; }
  .wa__msg--tarjetas .wa__burbuja { width: auto; }
  .wa__opciones { width: 420px; max-width: 65%; }
  .wa__boton { cursor: pointer; }
  .wa__boton:hover, .wa__tarjeta-boton:hover { background: #F5F6F6; }
  .wa__entrada { padding: 10px 16px; }
  .wa__campo { border-radius: 8px; }
  .wa__mic { background: transparent; color: var(--wa-icono); }
  /* La hoja de lista se vuelve una ventana centrada sobre la conversación */
  .wa__hoja { justify-content: center; align-items: center; }
  .wa__hoja-panel { width: 440px; max-width: 92%; max-height: 80%; border-radius: 12px; animation: wa-fundido .15s ease-out; }
  .wa__hoja-fila { cursor: pointer; }
  .wa__hoja-fila:hover { background: #F5F6F6; }
}
