// WhatsAppFloat — fixed WhatsApp button, bottom-right, with pre-filled message.
const WHATSAPP_NUMBER = '5567992864934';
function waLink(msg) {
  return `https://wa.me/${WHATSAPP_NUMBER}?text=${encodeURIComponent(msg)}`;
}
window.waLink = waLink;

function WhatsAppFloat() {
  const isMobile = window.useMQ('(max-width: 700px)');
  return (
    <a href={waLink('Olá! Vim pelo site e gostaria de falar sobre o meu caso.')}
      target="_blank" rel="noopener" aria-label="Falar no WhatsApp"
      style={{
        position: 'fixed', zIndex: 60,
        right: isMobile ? 'var(--space-4)' : 'var(--space-6)',
        bottom: `calc(${isMobile ? 'var(--space-4)' : 'var(--space-6)'} + env(safe-area-inset-bottom, 0px))`,
        display: 'flex', alignItems: 'center', gap: '10px',
        padding: isMobile ? '14px' : '13px 20px 13px 16px', borderRadius: '999px',
        background: '#1FA855', color: 'var(--white)', textDecoration: 'none',
        fontFamily: 'var(--font-sans)', fontSize: '14.5px', fontWeight: 600,
        boxShadow: 'var(--shadow-lg)', transition: 'transform 0.2s cubic-bezier(0.2,0,0.1,1)',
      }}
      onMouseEnter={(e) => { e.currentTarget.style.transform = 'translateY(-2px)'; }}
      onMouseLeave={(e) => { e.currentTarget.style.transform = 'none'; }}>
      <i data-lucide="message-circle" style={{ width: 22, height: 22 }}></i>
      {!isMobile && <span>Falar no WhatsApp</span>}
    </a>
  );
}
window.WhatsAppFloat = WhatsAppFloat;
