// whatsapp.jsx — WhatsApp button + URL builder
const WA_NUMBER = "5567991700143";
const waUrl = (msg) =>
  `https://wa.me/${WA_NUMBER}?text=${encodeURIComponent(msg)}`;

function WhatsAppButton({
  size = "xl",
  label = "Falar no WhatsApp",
  subtitle,
  message = "Olá Desiré! Tenho interesse nos lotes do Primavera 2.",
  ariaLabel,
}) {
  const cls = "wa-btn" + (size === "xl" ? " wa-btn--xl" : size === "lg" ? " wa-btn--lg" : "");
  return (
    <a
      className={cls}
      href={waUrl(message)}
      target="_blank"
      rel="noopener noreferrer"
      aria-label={ariaLabel || `${label} — abre conversa no WhatsApp`}
    >
      <img src={ICONS.whatsapp} width="26" height="26" alt="" aria-hidden="true" />
      <span className="label">
        <span>{label}</span>
        {subtitle && <span className="sub">{subtitle}</span>}
      </span>
    </a>
  );
}

window.WA_NUMBER = WA_NUMBER;
window.waUrl = waUrl;
window.WhatsAppButton = WhatsAppButton;
