/* ============================================================
   Clon de interfaz WhatsApp iOS — solo para la demo del sitio.
   Recreación propia de la estética (no usa assets de WhatsApp).
   Vive aislado: nada de acá se usa fuera del teléfono de la demo.
   ============================================================ */

.wa {
  /* Colores exactos */
  --wa-chat-bg: #efeae2;
  --wa-doodle: #d9d2c6;
  --wa-out: #e7ffdb;
  --wa-in: #ffffff;
  --wa-text: #111b21;
  --wa-meta: #667781;
  --wa-check-read: #53bdeb;
  --wa-check-sent: #8696a0;
  --wa-bar: #f6f5f3;
  --wa-send: #25d366;
  --wa-link: #027eb5;
  --wa-hairline: #d1d7db;

  /* Patrón de doodles tileable, dibujado a mano (no es el asset de WhatsApp) */
  --wa-doodle-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='380' height='380'%3E%3Cg fill='none' stroke='%23d9d2c6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M40 62c-9-11-24-4-24 7 0 13 24 24 24 24s24-11 24-24c0-11-15-18-24-7z'/%3E%3Cpath d='M150 36h30v20a15 15 0 0 1-30 0z'/%3E%3Cpath d='M180 41h8a6 6 0 0 1 0 12h-8'/%3E%3Cpath d='M146 84h38'/%3E%3Cpath d='M276 46l52-18-18 52-11-22z'/%3E%3Cpath d='M92 148v36'/%3E%3Ccircle cx='85' cy='186' r='8'/%3E%3Cpath d='M92 148l20-7v36'/%3E%3Ccircle cx='105' cy='181' r='8'/%3E%3Crect x='196' y='140' width='46' height='34' rx='6'/%3E%3Ccircle cx='219' cy='157' r='9'/%3E%3Cpath d='M206 140l5-8h16l5 8'/%3E%3Cpath d='M300 150a16 16 0 1 0 0 1'/%3E%3Cpath d='M316 133v-9M316 176v-9M338 155h9M285 155h-9'/%3E%3Cpath d='M40 250h44a8 8 0 0 1 8 8v20a8 8 0 0 1-8 8H58l-12 12v-12h-6a8 8 0 0 1-8-8v-20a8 8 0 0 1 8-8z'/%3E%3Cpath d='M150 262l7 16 17 2-13 12 4 17-15-9-15 9 4-17-13-12 17-2z'/%3E%3Cpath d='M244 254c10-8 24 0 24 10 0 14-24 30-24 30s-24-16-24-30c0-10 14-18 24-10z'/%3E%3Cpath d='M310 250v40M296 262l14-12 14 12'/%3E%3Cpath d='M46 330c8-10 20-10 28 0s20 10 28 0'/%3E%3Ccircle cx='190' cy='340' r='16'/%3E%3Cpath d='M190 330v10l7 5'/%3E%3Cpath d='M286 322h44v30h-30l-14 12z'/%3E%3Cpath d='M120 92c8-8 18-8 26 0'/%3E%3C/g%3E%3C/svg%3E");

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--wa-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Marco del iPhone ---------------- */
.wa-phone {
  position: relative;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  background: #000;
  border: 10px solid #000;
  border-radius: 54px;
  box-shadow: 0 30px 60px rgba(36, 24, 17, 0.32);
  overflow: hidden;
  isolation: isolate;
}
.wa-screen {
  position: relative;
  border-radius: 44px;
  overflow: hidden;
  background: var(--wa-chat-bg);
  display: flex;
  flex-direction: column;
  height: 640px;
}

/* Dynamic Island */
.wa-island {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 26px;
  background: #000;
  border-radius: 20px;
  z-index: 30;
}

/* ---------------- Barra de estado ---------------- */
.wa-status {
  background: var(--wa-bar);
  padding: 13px 26px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.wa-status__right {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wa-status svg {
  display: block;
}

/* ---------------- Header ---------------- */
.wa-header {
  background: var(--wa-bar);
  border-bottom: 0.5px solid var(--wa-hairline);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 9px;
  flex-shrink: 0;
}
.wa-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--wa-link);
  background: none;
  border: none;
  padding: 0;
  cursor: default;
}
.wa-unread {
  background: var(--wa-link);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #b5502f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  overflow: hidden;
}
.wa-title {
  flex: 1;
  min-width: 0;
}
.wa-title strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-title span {
  display: block;
  font-size: 13px;
  color: var(--wa-meta);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-header__action {
  color: var(--wa-link);
  flex-shrink: 0;
}

/* ---------------- Área de chat ---------------- */
.wa-chat {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  background: var(--wa-chat-bg);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
/* patrón de doodles tileado — absolute al chat, no fixed al viewport */
.wa-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  background-image: var(--wa-doodle-url);
  background-size: 380px 380px;
  background-attachment: local;
}
.wa-chat > * {
  position: relative;
  z-index: 1;
}

/* Separador de fecha + sistema */
.wa-date,
.wa-system {
  align-self: center;
  background: rgba(255, 255, 255, 0.86);
  color: #54656f;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  margin: 6px 0 10px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  text-align: center;
  max-width: 88%;
}
.wa-date {
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.wa-system {
  background: #fdf4c5;
  color: #5b5545;
  line-height: 1.35;
}

/* ---------------- Burbujas ---------------- */
.wa-row {
  display: flex;
  margin-top: 2px; /* mismo bloque */
  padding: 0 4px;
}
.wa-row--start {
  margin-top: 10px; /* primer mensaje de un bloque */
}
.wa-row--in {
  justify-content: flex-start;
}
.wa-row--out {
  justify-content: flex-end;
}

.wa-bubble {
  position: relative;
  max-width: 75%;
  padding: 7px 10px 8px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 21px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  word-wrap: break-word;
}
.wa-row--in .wa-bubble {
  background: var(--wa-in);
}
.wa-row--out .wa-bubble {
  background: var(--wa-out);
}

/* Colita: SOLO en el primer mensaje del bloque */
.wa-row--start.wa-row--in .wa-bubble::after,
.wa-row--start.wa-row--out .wa-bubble::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 9px;
  height: 13px;
  background-repeat: no-repeat;
  background-size: contain;
}
.wa-row--start.wa-row--in .wa-bubble {
  border-bottom-left-radius: 6px;
}
.wa-row--start.wa-row--out .wa-bubble {
  border-bottom-right-radius: 6px;
}
.wa-row--start.wa-row--in .wa-bubble::after {
  left: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='13'%3E%3Cpath d='M9 0v13H0C5 11 9 6 9 0z' fill='%23ffffff'/%3E%3C/svg%3E");
}
.wa-row--start.wa-row--out .wa-bubble::after {
  right: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='13'%3E%3Cpath d='M0 0v13h9C4 11 0 6 0 0z' fill='%23e7ffdb'/%3E%3C/svg%3E");
}

/* Texto + formato */
.wa-txt {
  white-space: pre-wrap;
}
.wa-txt b {
  font-weight: 600;
}
.wa-txt i {
  font-style: italic;
}
.wa-txt s {
  text-decoration: line-through;
}
.wa-txt code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  background: rgba(11, 20, 26, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}
.wa-txt a {
  color: var(--wa-link);
  text-decoration: none;
}

/* Meta (hora + checks) — flota para que el texto la envuelva */
.wa-meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--wa-meta);
  line-height: 15px;
  margin: 6px 0 -3px 8px;
  white-space: nowrap;
}
.wa-meta svg {
  display: block;
}
.wa-check--read {
  color: var(--wa-check-read);
}
.wa-check--sent {
  color: var(--wa-check-sent);
}

/* Nombre del remitente (grupos) */
.wa-sender {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 17px;
}
.wa-sender--1 { color: #c4532d; }
.wa-sender--2 { color: #1f7aec; }
.wa-sender--3 { color: #7f66ff; }

/* Solo emojis: grandes, sin burbuja */
.wa-row--emoji .wa-bubble {
  background: none !important;
  box-shadow: none;
  padding: 2px 6px;
  font-size: 32px;
  line-height: 40px;
}
.wa-row--emoji .wa-bubble::after {
  display: none;
}
.wa-row--emoji .wa-meta {
  font-size: 11px;
}

/* ---------------- Cita / respuesta ---------------- */
.wa-quote {
  display: flex;
  gap: 8px;
  background: rgba(11, 20, 26, 0.06);
  border-radius: 8px;
  padding: 5px 8px 5px 0;
  margin-bottom: 4px;
  overflow: hidden;
}
.wa-quote::before {
  content: "";
  width: 4px;
  background: var(--wa-send);
  flex-shrink: 0;
  border-radius: 8px 0 0 8px;
}
.wa-quote__body {
  min-width: 0;
}
.wa-quote__name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1fa855;
  line-height: 17px;
}
.wa-quote__text {
  display: block;
  font-size: 13.5px;
  color: var(--wa-meta);
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Audio ---------------- */
.wa-audio {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
}
.wa-audio__avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #b5502f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wa-audio__mic {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wa-chat-bg);
  color: #8696a0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wa-audio__play {
  background: none;
  border: none;
  padding: 0;
  color: #54656f;
  cursor: pointer;
  flex-shrink: 0;
}
.wa-audio__body {
  flex: 1;
  min-width: 0;
}
.wa-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  position: relative;
}
.wa-wave i {
  display: block;
  width: 2px;
  border-radius: 2px;
  background: #c4ccd1;
}
.wa-wave i.on {
  background: #55806a;
}
.wa-wave__dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #55806a;
  transform: translate(-50%, -50%);
}
.wa-audio__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--wa-meta);
  margin-top: 2px;
}
.wa-audio__transcribe {
  color: #1fa855;
  font-weight: 500;
}

/* ---------------- Imagen ---------------- */
.wa-row--media .wa-bubble {
  padding: 3px;
  max-width: 68%;
}
.wa-img {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  line-height: 0;
}
.wa-img img,
.wa-img > .wa-img__ph {
  display: block;
  width: 100%;
  border-radius: 12px;
}
.wa-img__ph {
  height: 180px;
  background: linear-gradient(140deg, #e8a33d, #c2521f 55%, #8d3714);
  position: relative;
}
.wa-img__ph::after {
  content: "🍕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62px;
  opacity: 0.92;
}
.wa-img .wa-meta {
  position: absolute;
  right: 8px;
  bottom: 5px;
  float: none;
  margin: 0;
  color: #fff;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.wa-img__scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
  border-radius: 0 0 12px 12px;
}

/* ---------------- Documento ---------------- */
.wa-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11, 20, 26, 0.045);
  border-radius: 8px;
  padding: 10px;
  min-width: 218px;
}
.wa-doc__icon {
  flex-shrink: 0;
  color: #d13438;
}
.wa-doc__body {
  min-width: 0;
}
.wa-doc__name {
  display: block;
  font-size: 14.5px;
  line-height: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-doc__meta {
  display: block;
  font-size: 12px;
  color: var(--wa-meta);
  margin-top: 1px;
}

/* ---------------- Botones de acción ---------------- */
.wa-btns {
  margin: 6px -10px -8px;
  border-top: 0.5px solid rgba(11, 20, 26, 0.13);
}
.wa-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 0.5px solid rgba(11, 20, 26, 0.13);
  color: var(--wa-link);
  font-size: 15px;
  font-family: inherit;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
}
.wa-btn:last-child {
  border-bottom: none;
  border-radius: 0 0 18px 18px;
}
.wa-btn:active {
  background: rgba(11, 20, 26, 0.05);
}

/* ---------------- Reacciones ---------------- */
.wa-react {
  position: absolute;
  bottom: -11px;
  left: 8px;
  background: #fff;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.2);
  z-index: 2;
}
.wa-react span {
  color: var(--wa-meta);
  font-size: 11px;
}

/* ---------------- Typing ---------------- */
.wa-typing {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
}
.wa-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa5ab;
  animation: waType 1.2s infinite ease-in-out;
}
.wa-typing i:nth-child(2) { animation-delay: 0.18s; }
.wa-typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes waType {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------------- FAB scroll-to-bottom ---------------- */
.wa-fab {
  position: absolute;
  right: 12px;
  bottom: 74px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: none;
  color: #8696a0;
  box-shadow: 0 1px 3px rgba(11, 20, 26, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 12;
}
.wa-fab.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---------------- Barra de input ---------------- */
.wa-input {
  background: var(--wa-bar);
  border-top: 0.5px solid var(--wa-hairline);
  padding: 7px 8px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.wa-plus {
  background: none;
  border: none;
  color: #8696a0;
  padding: 0 0 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.wa-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 0.5px solid var(--wa-hairline);
  border-radius: 19px;
  padding: 7px 10px 7px 14px;
  min-height: 36px;
}
.wa-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 21px;
  color: var(--wa-text);
}
.wa-field input::placeholder {
  color: #8696a0;
}
.wa-sticker {
  background: none;
  border: none;
  color: #8696a0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.wa-send {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--wa-send);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 1px;
}
.wa-send:active {
  filter: brightness(0.94);
}

@media (max-width: 460px) {
  .wa-screen { height: 560px; }
}
