#wc-root { all: initial; }
#wc-root, #wc-root * { box-sizing: border-box; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

#wc-root{
  /* 🎨 Paleta acorde a la web (azul-lila pastel) */
  --wc-primary: #7C5CFF;          /* lila principal */
  --wc-primary-2: #5BB7FF;        /* azul */
  --wc-bg: #F6F7FF;               /* fondo mensajes */

  --wc-surface: rgba(255,255,255,.94);
  --wc-border: rgba(22, 34, 56, .10);
  --wc-shadow: 0 18px 50px rgba(22,34,56,.16);

  /* 👇 AJUSTES RÁPIDOS */
  --wc-right: 35px;        /* distancia al borde derecho (tu padding) */
  --wc-bottom: 16px;       /* distancia abajo */
  --wc-panel-w: 372px;     /* ancho chat */
  --wc-panel-h: 610px;     /* alto chat */

  /* Menú */
  --wc-menu-gap: 12px;
  --wc-menu-w: 260px;
}

/* =========================
   BOTÓN: SOLO PNG (sin círculo)
   ========================= */
#wc-root #wc-button{
  position: fixed;
  right: var(--wc-right);
  bottom: var(--wc-bottom);
  z-index: 2147483000;

  width: 130px;
  height: 130px;

  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;

  border-radius: 0;
  overflow: visible;

  display: grid;
  place-items: center;

  cursor: pointer;
  transform-origin: bottom right;
}

/* La imagen manda */
#wc-root #wc-button .wc-btn-icon{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Saltito tipo Dock */
@keyframes wcBounce {
  0%   { transform: translateY(0) scale(1); }
  20%  { transform: translateY(-14px) scale(1.04); }
  40%  { transform: translateY(0) scale(1); }
  60%  { transform: translateY(-7px) scale(1.02); }
  80%  { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) scale(1); }
}

/* animación cuando está cerrado */
#wc-root:not(.wc-open):not(.wc-menu-open) #wc-button{
  animation: wcBounce 1.4s ease-in-out infinite;
  animation-delay: 1s;
}

/* =========================
   MENÚ (WhatsApp / Chatbot)
   ========================= */
#wc-root #wc-menu{
  position: fixed;
  right: calc(var(--wc-right) + 6px);
  bottom: calc(var(--wc-bottom) + 120px);
  z-index: 2147483001;

  width: var(--wc-menu-w);
  max-width: calc(100vw - 32px);

  background: var(--wc-surface);
  border: 1px solid var(--wc-border);
  box-shadow: var(--wc-shadow);
  border-radius: 18px;
  overflow: hidden;

  opacity: 0;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  pointer-events: none;

  transition: opacity .18s ease, transform .18s ease;
}

#wc-root.wc-menu-open #wc-menu{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#wc-root #wc-menu-header{
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: linear-gradient(90deg, var(--wc-primary-2) 0%, var(--wc-primary) 100%);
  border-bottom: 1px solid rgba(255,255,255,.25);
}

#wc-root #wc-menu-title{
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .25px;
  color: #ffffff;
}

#wc-root #wc-menu-close{
  border: 0;
  background: rgba(255,255,255,.14);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 10px;
}
#wc-root #wc-menu-close:hover{ background: rgba(255,255,255,.22); }

#wc-root #wc-menu-body{
  padding: 12px;
  display: grid;
  gap: 10px;
}

#wc-root .wc-menu-btn{
  width: 100%;
  border: 1px solid var(--wc-border);
  background: rgba(255,255,255,.96);
  border-radius: 14px;
  padding: 12px 12px;

  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;

  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

#wc-root .wc-menu-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(22,34,56,.10);
  border-color: rgba(124,92,255,.28);
}

#wc-root .wc-menu-btn .wc-menu-ic{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;

  background: linear-gradient(135deg, rgba(91,183,255,.18), rgba(124,92,255,.16));
  color: rgba(90, 74, 210, .95);
  font-size: 18px;
  flex: 0 0 auto;
}

#wc-root .wc-menu-btn.whatsapp .wc-menu-ic{
  background: rgba(37, 211, 102, .12);
  color: rgba(18, 140, 126, 1);
}

#wc-root .wc-menu-btn .wc-menu-txt{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#wc-root .wc-menu-btn .wc-menu-txt b{
  font-size: 13.5px;
  color: #111827;
}

#wc-root .wc-menu-btn .wc-menu-txt span{
  font-size: 12px;
  color: rgba(17,24,39,.62);
}

#wc-root #whatsapp-link{
  display: none; /* existe para cumplir tu snippet, pero no se ve */
}

/* =========================
   PANEL
   ========================= */
#wc-root #wc-panel{
  position: fixed;
  right: var(--wc-right);
  bottom: var(--wc-bottom);
  width: var(--wc-panel-w);
  max-width: calc(100vw - 32px);
  height: var(--wc-panel-h);
  max-height: calc(100vh - 32px);

  z-index: 2147483000;
  border-radius: 18px;
  border: 1px solid var(--wc-border);

  background: var(--wc-surface);
  box-shadow: var(--wc-shadow);
  overflow: hidden;

  opacity: 0;
  transform: translateY(0) scale(.95);
  transform-origin: bottom right;
  pointer-events: none;

  transition: opacity .22s ease, transform .22s ease;
}

/* Estado abierto */
#wc-root.wc-open #wc-panel{
  opacity: 1;
  transform: translateY(-56px) scale(1);
  pointer-events: auto;
}

/* Ocultar botón al abrir chat */
#wc-root.wc-open #wc-button{
  opacity: 0;
  transform: scale(.8);
  pointer-events: none;
  transition: opacity .18s ease, transform .22s ease;
}

/* Si está abierto el menú, NO ocultes el botón */
#wc-root.wc-menu-open #wc-button{
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* =========================
   HEADER
   ========================= */
#wc-root #wc-header{
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: linear-gradient(90deg, var(--wc-primary-2) 0%, var(--wc-primary) 100%);
  border-bottom: 1px solid rgba(255,255,255,.25);
}

#wc-root #wc-title{
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .25px;
  color: #ffffff;
}

#wc-root #wc-close{
  border: 0;
  background: rgba(255,255,255,.14);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 10px;
}
#wc-root #wc-close:hover{ background: rgba(255,255,255,.22); }

/* =========================
   MENSAJES
   ========================= */
#wc-root #wc-messages{
  height: calc(100% - 56px - 82px);
  overflow: auto;
  padding: 14px;
  background: var(--wc-bg);
}

#wc-root .wc-msg{ margin: 0 0 10px 0; display: flex; }

#wc-root .wc-bubble{
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.25rem;
  border: 1px solid rgba(22,34,56,.08);
  background: rgba(255,255,255,.92);
  color: #111827;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Bot izquierda */
#wc-root .wc-msg.bot{ justify-content: flex-start; }
#wc-root .wc-msg.bot .wc-bubble{ border-top-left-radius: 10px; }

/* Usuario derecha */
#wc-root .wc-msg.user{ justify-content: flex-end; }
#wc-root .wc-msg.user .wc-bubble{
  background: linear-gradient(135deg, var(--wc-primary-2), var(--wc-primary));
  color: #fff;
  border-color: rgba(255,255,255,.18);
  border-top-right-radius: 10px;
}

/* entrada */
@keyframes wcIn {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#wc-root .wc-bubble.wc-in{ animation: wcIn .18s ease both; }

/* =========================
   FOOTER (grid)
   ========================= */
#wc-root #wc-footer{
  position: relative;
  padding: 10px 12px 10px;
  border-top: 1px solid rgba(22,34,56,.10);
  background: rgba(255,255,255,.96);

  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 6px;
  align-items: center;
}

#wc-root #wc-footer-row{ display: contents; }

#wc-root #wc-input{
  grid-column: 1;
  grid-row: 1;

  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22,34,56,.14);
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,.98);
}
#wc-root #wc-input:focus{
  border-color: rgba(124,92,255,.40);
  box-shadow: 0 0 0 3px rgba(124,92,255,.14);
}

#wc-root #wc-send{
  grid-column: 2;
  grid-row: 1;

  padding: 11px 14px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--wc-primary-2), var(--wc-primary));
  box-shadow: 0 12px 22px rgba(124,92,255,.18);
}
#wc-root #wc-send:disabled{
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Powered centrado */
#wc-root #wc-powered{
  grid-column: 1 / 3;
  grid-row: 2;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
  color: rgba(17,24,39,.55);
  user-select: none;
  margin-top: 3px;
}

/* =========================
   TYPING INDICATOR
   ========================= */
#wc-root #wc-typing-indicator{
  position: absolute;
  left: 16px;
  bottom: 96px;

  display: inline-flex;
  gap: 5px;
  align-items: center;

  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(22,34,56,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 20px rgba(22,34,56,.10);

  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

#wc-root #wc-typing-indicator.show{
  opacity: 1;
  transform: translateY(0);
}

#wc-root #wc-typing-indicator span{
  width: 5px;
  height: 5px;
  background: rgba(17,24,39,.50);
  border-radius: 50%;
  animation: wcDot 1.2s infinite both;
}
#wc-root #wc-typing-indicator span:nth-child(2){ animation-delay: .15s; }
#wc-root #wc-typing-indicator span:nth-child(3){ animation-delay: .30s; }

@keyframes wcDot{
  0%   { opacity: .18; transform: translateY(0); }
  20%  { opacity: .95; transform: translateY(-1px); }
  100% { opacity: .18; transform: translateY(0); }
}

/* ===== Bocadillo teaser ===== */
#wc-teaser{
  position: fixed;
  z-index: 2147482999;

  right: calc(var(--wc-right) + 90px);
  bottom: calc(var(--wc-bottom) + 17px);

  background: rgba(255,255,255,.92);
  color: #111827;
  font-size: 13px;
  font-weight: 600;

  padding: 10px 14px 10px 14px;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(22,34,56,.14);
  border: 1px solid var(--wc-border);

  white-space: nowrap;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px) scale(.96);

  transition: opacity .25s ease, transform .25s ease;
}

/* triangulito */
#wc-teaser::after{
  content: "";
  position: absolute;
  right: -6px;
  top: 18px;

  width: 0;
  height: 0;
  border-left: 6px solid rgba(255,255,255,.92);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* Botón X */
#wc-teaser-close{
  position: absolute;
  left: 6px;
  top: 6px;

  width: 18px;
  height: 18px;
  border-radius: 999px;

  border: 0;
  background: rgba(17,24,39,.08);
  color: rgba(17,24,39,.75);

  display: grid;
  place-items: center;

  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#wc-teaser-close:hover{ background: rgba(17,24,39,.14); }

/* espacio para la X */
#wc-teaser .wc-teaser-text{ padding-left: 18px; }

/* visible */
#wc-root.show-teaser #wc-teaser{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* rebote sincronizado */
#wc-root.show-teaser #wc-teaser{
  animation: wcBounce 1.4s ease-in-out infinite;
  animation-delay: 1s;
}

/* cuando el chat está abierto, fuera */
#wc-root.wc-open #wc-teaser{
  opacity: 0 !important;
  transform: translateY(6px) scale(.96) !important;
  pointer-events: none;
}

/* Mejor lectura en burbuja (bot) */
#wc-root .wc-msg.bot .wc-bubble{
  text-align: left;
  line-height: 1.45;
  white-space: pre-wrap;
}
