:root{ --app-height: 100vh; }

/* =========================================================
   RESET MINIMAL (evita "ensanches" por box model raro)
   ========================================================= */
*,*::before,*::after{ box-sizing: border-box; }
img{ max-width: 100%; height: auto; }

/* =========================================================
   WHATSAPP CARD (base)
   ========================================================= */

.whatsapp-wrapper{
  width: 100%;
  max-width: 420px;
  height: min(630px, var(--app-height));
  margin: 20px auto;
  border-radius: 14px;
  overflow: hidden;
  background: #efeae2;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  flex-direction: column;

}

/* Solo elevar por encima del menú cuando estás en el bloque WhatsApp */
body.whatsapp-active .whatsapp-wrapper{
  position: relative;
  z-index: 40;
}

/* =========================================================
   CABECERA
   ========================================================= */

.wa-header{
  background: #008069;
  color: #fff;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  min-height: 56px;
}

.wa-avatar{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-avatar img{
  width: 38px;
  height: 38px;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.wa-title{
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 700;
}

.wa-title span{
  display: block;
  font-size: 11px;
  color: #d2f8f0;
  font-weight: 500;
  margin-top: 2px;
}

.wa-actions{
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

/* Botones como WhatsApp: sin borde, fondo transparente, hit-area cómoda */
.wa-icon{
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.wa-icon svg{
  width: 22px;
  height: 22px;
  fill: currentColor;
  opacity: .95;
}

/* Efecto típico de WhatsApp al pasar/press */
.wa-icon:hover{ background: rgba(255,255,255,.12); }
.wa-icon:active{ transform: scale(.92); background: rgba(255,255,255,.18); }

/* Accesibilidad: foco visible pero discreto */
.wa-icon:focus-visible{
  outline: 2px solid rgba(255,255,255,.55);
  outline-offset: 2px;
}


/* =========================================================
   CHAT
   ========================================================= */

.wa-chat{
  min-height: 0;
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background-color: #efeae2;
  background-image: url(img/fondo_whatsapp.webp);
  background-repeat: repeat;
  background-size: 400px;
  color:#000000;
}

.wa-notice{
  background: #fff5c4;
  padding: 6px 10px;
  font-size: 11px;
  text-align: center;
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid #ffeeb0;
}

.wa-notice a{color:#075e54;font-weight:700;text-underline-offset:2px}
.wa-notice--legacy{display:none}

.msg{
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
  word-wrap: break-word;
}

.msg.bot{ background: #ffffff; border-top-left-radius: 0; }
.msg.user{ background: #d9fdd3; margin-left: auto; border-top-right-radius: 0; }

.msg a{color:#075e54;text-underline-offset:2px}
.msg.typing{display:flex;align-items:center;gap:4px;width:max-content;padding:11px 13px}
.msg.typing i{width:6px;height:6px;border-radius:50%;background:#7b8b88;animation:waTyping 1s infinite ease-in-out}
.msg.typing i:nth-child(2){animation-delay:.15s}.msg.typing i:nth-child(3){animation-delay:.3s}
@keyframes waTyping{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-4px);opacity:1}}

/* OPCIONES */
.options{ display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0; }

.options button{
  border: 1px solid #dcdcdc;
  background: #ffffff;
  min-height:40px;
  padding:8px 12px;
  border-radius:12px;
  cursor: pointer;
  font-size: 13px;
  line-height:1.2;
  text-align:left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion:reduce){.msg.typing i{animation:none;opacity:.7}}

.options button:hover{ background: #d9fdd3; }

.wa-range{margin:10px 0 14px;padding:14px 15px 13px;border-radius:14px;background:#fff;box-shadow:0 1px 1px rgba(0,0,0,.08)}
.wa-range__value{display:block;margin-bottom:12px;color:#075e54;font-size:15px;text-align:center}
.wa-range input[type="range"]{width:100%;accent-color:#00a884;cursor:pointer}
.wa-range__scale{display:flex;justify-content:space-between;margin-top:3px;color:#667781;font-size:10px}
.wa-range__button{display:block;width:100%;min-height:42px;margin-top:12px;border:0;border-radius:11px;background:#00a884;color:#fff;font-size:13px;font-weight:800;cursor:pointer}
.wa-range__button:hover{background:#008f72}

/* En móviles (iOS/Android) el :hover puede quedarse "pegado" tras un tap */
@media (hover: none){
  .options button:hover{ background: #ffffff; }
  .options button:active{ background: #d9fdd3; }
}

/* INPUT */
.wa-input{
  flex-shrink: 0;
  display: flex;
  padding: 8px;
  background: #f0f2f5;
  align-items: center;
  gap: 8px;
  min-width: 0; /* clave: evita desbordes en flex (iOS/Chrome) */
}

.wa-input input{
  flex: 1;
  min-width: 0;
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  outline: none;
  font-size: 14px;
}

/* ===== INPUT MULTILÍNEA (textarea) ===== */
.wa-input textarea{
  flex: 1;
  min-width: 0;
  width: auto;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.25;
  padding: 10px 10px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
}

.wa-input button{
  border: none;
  background: #00a884;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 16px;
  flex: 0 0 auto;
}

.chat-image{
  max-width: 220px;
  border-radius: 12px;
  margin-top: 4px;
  cursor: pointer;
}
/* =========================================================
   BLOQUE WHATSAPP HERO - VERSIÓN AMPLIA Y ELEGANTE
   ========================================================= */

.whatsapp-hero{
  background: #f4f6f5;
  padding: 70px 24px;
  overflow: hidden;
}

.whatsapp-hero-inner{
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr);
  gap: 58px;
  align-items: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.whatsapp-hero-left{
  text-align: left;
  min-width: 0;
}

.whatsapp-hero-right{
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 22px;
}

/* Caja izquierda */
/* Chat derecha */
.whatsapp-wrapper{
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  border-radius: 16px;
}

/* Ajustes de textos antiguos por si siguen cargando */
.whatsapp-hero-left p{
  font-size: 17px;
  line-height: 1.65;
  margin-bottom: 18px;
}

.whatsapp-hero-left h2{
  font-size: 42px;
  margin-bottom: 16px;
}

.whatsapp-sub{
  font-size: 17px;
  margin-bottom: 18px;
}

.whatsapp-benefits{
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
}

.whatsapp-benefits li{
  font-size: 16px;
  margin-bottom: 8px;
}

.whatsapp-hero-left img{
  width: 100%;
  max-width: 420px;
  margin: 0;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1199.98px){
  .whatsapp-hero{
    padding: 56px 22px;
  }

  .whatsapp-hero-inner{
    max-width: 1180px;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .75fr);
    gap: 36px;
  }

  .whatsapp-wrapper{
    max-width: 410px;
  }
}

/* =========================================================
   MÓVIL/TABLET HASTA 991px
   ========================================================= */

@media (max-width: 991.98px){
  html, body{
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  .whatsapp-hero{
    padding: 42px 18px;
  }

  .whatsapp-hero-inner{
    grid-template-columns: 1fr;
    gap: 30px;
    max-width: 720px;
  }

  .whatsapp-hero-left{
    text-align: left;
  }

  .whatsapp-wrapper{
    max-width: 420px;
    margin: 0 auto;
  }

  .wa-input input,
  .wa-input textarea,
  .options button{
    font-size: 16px;
  }


}

/* =========================================================
   MÓVIL PEQUEÑO
   ========================================================= */

@media (max-width: 575.98px){
  .whatsapp-hero{
    padding: 30px 14px;
  }

  .whatsapp-hero-inner{
    gap: 24px;
  }

  .whatsapp-wrapper{
    max-width: 100%;
  }


}

/* Alineación cuando el textarea crece */
.wa-input{
  align-items: flex-end;
}
