/* ==========================================================
  WABO RICHIWEB - Front UI
  Scoped: #rw-wabo-01
  Nota: todo se controla por variables CSS inyectadas via JS
========================================================== */

#rw-wabo-01{
  position: fixed;
  z-index: 999999;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.2;
}

/* Posicionamiento por esquina + offsets (se setea vía style inline JS) */
#rw-wabo-01 *{ box-sizing: border-box; }

#rw-wabo-01 .rw-wabo__sticker{
  background: transparent;
  width: var(--rw-wabo-stw, 320px);
  max-width: var(--rw-wabo-stw, 320px);
  height: var(--rw-wabo-sth, auto);

  all: unset;
  cursor: pointer;
  display: grid;
  place-items: center;
  max-width: 320px;
  border-radius: 16px;
  overflow: hidden;
  transform: translateZ(0);
}

#rw-wabo-01 .rw-wabo__sticker img{
  display:block;
  width: 100%;
  height: auto;
}

#rw-wabo-01 .rw-wabo__stickerFallback{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px 14px;
  background: #111827;
  color:#fff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}

#rw-wabo-01 .rw-wabo__waDot{
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,.15);
}

/* Animaciones del sticker (se activa por clase en JS) */
#rw-wabo-01.is-sticker-pulse .rw-wabo__sticker{
  animation: rwWaboPulse 1.2s ease-in-out;
}
@keyframes rwWaboPulse{
  0%{ transform: scale(1); }
  40%{ transform: scale(1.02); }
  100%{ transform: scale(1); }
}
#rw-wabo-01.is-sticker-float .rw-wabo__sticker{
  animation: rwWaboFloat 1.2s ease-in-out;
}
@keyframes rwWaboFloat{
  0%{ transform: translateY(0); }
  50%{ transform: translateY(-6px); }
  100%{ transform: translateY(0); }
}

/* Panel */
#rw-wabo-01 .rw-wabo__panel{
  position: absolute;
  width: min(360px, calc(100vw - 28px));
  background: var(--rw-wabo-panel, #f6fffb);
  border-radius: var(--rw-wabo-radius, 18px);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(.92) translateY(8px);
  pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
  border: 1px solid rgba(0,0,0,.06);
}

#rw-wabo-01.is-open .rw-wabo__panel{
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

#rw-wabo-01 .rw-wabo__head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  background: var(--rw-wabo-header, #22c55e);
  color: #fff;
}
#rw-wabo-01 .rw-wabo__ht{
  font-weight: 600;
  font-size: 15px;
}
#rw-wabo-01 .rw-wabo__x{
  all: unset;
  cursor:pointer;
  width: 28px; height: 28px;
  display:grid; place-items:center;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color:#fff;
  font-size: 20px;
  line-height: 1;
}

#rw-wabo-01 .rw-wabo__body{
  padding: 14px 14px 6px;
  min-height: 142px;
}

/* Typing ... */
#rw-wabo-01 .rw-wabo__typing{
  display:flex;
  gap: 6px;
  padding: 10px 12px;
  width: fit-content;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
}
#rw-wabo-01 .rw-wabo__typing span{
  width: 6px; height: 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  animation: rwWaboDot 1.1s infinite ease-in-out;
}
#rw-wabo-01 .rw-wabo__typing span:nth-child(2){ animation-delay: .12s; }
#rw-wabo-01 .rw-wabo__typing span:nth-child(3){ animation-delay: .24s; }

@keyframes rwWaboDot{
  0%, 80%, 100%{ transform: translateY(0); opacity: .5; }
  40%{ transform: translateY(-3px); opacity: 1; }
}

/* Mensajes */
#rw-wabo-01 .rw-wabo__msgs{
  margin-top: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}

#rw-wabo-01 .rw-wabo__msgRow{
  display:flex;
  align-items:flex-start;
  gap: 10px;
}

#rw-wabo-01 .rw-wabo__avatar{
  width: var(--rw-wabo-av, 30px);
  height: var(--rw-wabo-av, 30px);
  border-radius: 999px;
  flex: 0 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
}
#rw-wabo-01 .rw-wabo__avatar img{
  width:100%; height:100%;
  object-fit: cover;
  display:block;
}

#rw-wabo-01 .rw-wabo__bubble{
  max-width: 270px;
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  position: relative;
  transform: translateY(10px);
  opacity: 0;
  animation: rwWaboIn .26s ease forwards;
}
@keyframes rwWaboIn{
  to { transform: translateY(0); opacity: 1; }
}
#rw-wabo-01 .rw-wabo__bubble b{ font-weight: 700; }

/* Footer CTA */
#rw-wabo-01 .rw-wabo__foot{
  padding: 12px 14px 14px;
  display:flex;
  justify-content: flex-end;
}

#rw-wabo-01 .rw-wabo__cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--rw-wabo-cta, #22c55e);
  color:#fff;
  border-radius: 999px;
  text-decoration:none;
  font-weight: 600;
  min-width: 190px;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
  transform: translateZ(0);
  transition: transform .15s ease, filter .15s ease;
}
#rw-wabo-01 .rw-wabo__cta:hover{
  transform: translateY(-1px);
  filter: brightness(1.02);
}

/* Icono WA "dibujable" */
#rw-wabo-01 .rw-wabo__waSvg{
  width: 22px; height: 22px;
  display:block;
  fill: #fff;
  transform-origin: center;
}
#rw-wabo-01.is-open .rw-wabo__waSvg{
  animation: rwWaboIcoPulse 1.2s ease-in-out infinite;
}
@keyframes rwWaboIcoPulse{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.06); }
}

/* Sombra on/off */
#rw-wabo-01.is-shadowOff .rw-wabo__cta,
#rw-wabo-01.is-shadowOff .rw-wabo__bubble,
#rw-wabo-01.is-shadowOff .rw-wabo__stickerFallback{
  box-shadow: none !important;
}

/* Escondemos sticker cuando panel está abierto */
#rw-wabo-01.is-open .rw-wabo__sticker{
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
#rw-wabo-01:not(.is-open) .rw-wabo__sticker{
  opacity: 1;
  transition: opacity .18s ease;
}

/* Ajuste responsive */
@media (max-width: 420px){
  #rw-wabo-01 .rw-wabo__bubble{ max-width: 230px; }
  #rw-wabo-01 .rw-wabo__cta{ min-width: 170px; padding: 13px 16px; }
}


/* Ocultar en móviles (clase aplicada por JS) */
#rw-wabo-01.is-hideMobile{ display:none !important; }
