/* Minichat de WhatsApp: el botón flotante abre una conversación y el mensaje se envía por WhatsApp.
   Lo usan apex.html (campusmentora.com) y campus.html (campus.campusmentora.com); la landing de
   Colegios tiene el mismo en React (WhatsAppFlotante.tsx). */

.wa-flotante{position:fixed;right:max(20px,env(safe-area-inset-right,0px));bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:60;
  width:60px;height:60px;padding:0;border:0;border-radius:50%;display:grid;place-items:center;cursor:pointer;
  background:#25D366;color:#fff;box-shadow:0 18px 34px -16px rgba(37,211,102,.7),0 10px 24px -16px rgba(26,18,38,.45);
  transition:transform .3s cubic-bezier(.22,1,.36,1),box-shadow .3s ease}
.wa-flotante:hover{transform:translateY(-3px);box-shadow:0 22px 38px -16px rgba(37,211,102,.75),0 14px 28px -18px rgba(26,18,38,.5)}
.wa-flotante:focus-visible{outline:3px solid rgba(37,211,102,.35);outline-offset:4px}
.wa-flotante svg{grid-area:1/1;display:block;transition:opacity .25s ease,transform .35s cubic-bezier(.22,1,.36,1)}
.wa-flotante .wa-ico{width:31px;height:31px}
.wa-flotante .wa-x{width:26px;height:26px;opacity:0;transform:rotate(-90deg) scale(.6)}
.wa-flotante.activo .wa-ico{opacity:0;transform:rotate(90deg) scale(.6)}
.wa-flotante.activo .wa-x{opacity:1;transform:none}

.wa-chat{position:fixed;z-index:61;right:max(20px,env(safe-area-inset-right,0px));bottom:calc(94px + env(safe-area-inset-bottom,0px));
  width:min(360px,calc(100vw - 32px));border-radius:22px;overflow:hidden;background:#fff;color:#201A2B;
  box-shadow:0 30px 70px -22px rgba(48,33,84,.5),0 0 0 1px rgba(48,33,84,.07);
  transform-origin:bottom right;opacity:0;transform:translateY(12px) scale(.96);
  transition:opacity .28s ease,transform .35s cubic-bezier(.22,1,.36,1)}
.wa-chat[hidden]{display:none}
.wa-chat.abierto{opacity:1;transform:none}
.wa-chat p{margin:0}

.wa-chat-cabeza{display:flex;align-items:center;gap:12px;padding:16px 16px 16px 18px;color:#fff;
  background:linear-gradient(135deg,#5C54CF 0%,#3830A2 100%)}
.wa-chat-avatar{position:relative;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.14);flex:none}
.wa-chat-avatar img{width:26px;height:26px;display:block;object-fit:contain}
.wa-chat-avatar::after{content:"";position:absolute;right:0;bottom:0;width:11px;height:11px;border-radius:50%;background:#25D366;box-shadow:0 0 0 2px #4A43BF}
.wa-chat.fuera-horario .wa-chat-avatar::after{background:#A3ADBD}
.wa-chat-nombre{font-weight:700;font-size:.98rem;line-height:1.3}
.wa-chat-estado{font-size:.78rem;line-height:1.3;color:rgba(255,255,255,.78)}
.wa-chat-cerrar{margin-left:auto;display:grid;place-items:center;width:34px;height:34px;padding:0;border:0;border-radius:50%;
  background:rgba(255,255,255,.12);color:#fff;cursor:pointer;transition:background .2s}
.wa-chat-cerrar:hover{background:rgba(255,255,255,.22)}
.wa-chat-cerrar svg{width:18px;height:18px;display:block}

.wa-chat-cuerpo{display:grid;gap:12px;justify-items:start;align-content:start;min-height:150px;padding:20px 18px 16px;
  background:radial-gradient(circle at 12px 12px,rgba(85,71,200,.05) 1.5px,transparent 2px) 0 0/22px 22px,#F8F5F0}
.wa-burbuja{max-width:86%;padding:12px 14px;border-radius:4px 16px 16px 16px;background:#fff;font-size:.95rem;line-height:1.5;
  box-shadow:0 2px 6px -3px rgba(26,18,38,.2)}
.wa-escribiendo{display:none;gap:4px;padding:14px 16px;border-radius:4px 16px 16px 16px;background:#fff}
.wa-escribiendo span{width:7px;height:7px;border-radius:50%;background:#B9B0EC;animation:wa-punto 1s infinite ease-in-out}
.wa-escribiendo span:nth-child(2){animation-delay:.15s}
.wa-escribiendo span:nth-child(3){animation-delay:.3s}
@keyframes wa-punto{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}
.wa-chat.escribiendo .wa-escribiendo{display:flex}
.wa-chat.escribiendo .wa-burbuja,.wa-chat.escribiendo .wa-rapidas{display:none}
.wa-chat.mostrado .wa-burbuja{animation:wa-entra .4s cubic-bezier(.22,1,.36,1) both}
.wa-chat.mostrado .wa-rapidas{animation:wa-entra .4s cubic-bezier(.22,1,.36,1) .15s both}
@keyframes wa-entra{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.wa-rapidas{display:flex;flex-wrap:wrap;gap:6px}
.wa-rapidas button{padding:7px 12px;border-radius:999px;border:1px solid #E6DFF0;background:#fff;color:#4338B4;
  font-family:inherit;font-size:.8rem;font-weight:600;line-height:1.2;cursor:pointer;transition:border-color .2s,background .2s,color .2s}
.wa-rapidas button:hover{border-color:#5547C8;background:#F4F1FF}
.wa-rapidas button.elegida{border-color:#5547C8;background:#5547C8;color:#fff}

.wa-chat-pie{display:flex;align-items:flex-end;gap:8px;margin:0;padding:12px 12px 8px 16px;border-top:1px solid #EEE9F4;background:#fff}
.wa-chat-pie textarea{flex:1;min-height:42px;max-height:120px;resize:none;margin:0;padding:10px 14px;border:1px solid #E2DCEB;border-radius:21px;
  font-family:inherit;font-size:.93rem;line-height:1.4;color:#201A2B;background:#FCFBF8;outline:none;transition:border-color .2s,box-shadow .2s}
.wa-chat-pie textarea:focus{border-color:#8B82E0;box-shadow:0 0 0 3px rgba(85,71,200,.12)}
.wa-enviar{flex:none;display:grid;place-items:center;width:42px;height:42px;padding:0;border:0;border-radius:50%;background:#25D366;color:#fff;
  cursor:pointer;transition:transform .2s cubic-bezier(.22,1,.36,1),background .2s}
.wa-enviar:hover{background:#1EBE5A;transform:scale(1.05)}
.wa-enviar svg{width:20px;height:20px;display:block}
.wa-chat-nota{padding:0 16px 12px;background:#fff;font-size:.72rem;color:#6D6678;text-align:center}
.wa-oculto{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (max-width:560px){
  .wa-flotante{width:54px;height:54px;right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px))}
  .wa-flotante .wa-ico{width:28px;height:28px}
  .wa-chat{right:16px;bottom:calc(84px + env(safe-area-inset-bottom,0px))}
}
@media (prefers-reduced-motion:reduce){
  .wa-flotante,.wa-flotante svg,.wa-chat,.wa-escribiendo span,.wa-chat.mostrado .wa-burbuja,.wa-chat.mostrado .wa-rapidas{animation:none;transition:none}
}
