/* All declarations stay within the WhatsApp widget. */
#mh-wa-float-stack {
  --mh-wa-gap: 24px;
  --mh-wa-bottom: 24px;
  position: fixed;
  right: max(var(--mh-wa-gap), env(safe-area-inset-right, 0px));
  bottom: max(var(--mh-wa-bottom), env(safe-area-inset-bottom, 0px));
  z-index: 4500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
#mh-wa-float-stack .mh-wa-float-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 184px;
  max-width: calc(100vw - 28px);
  height: 52px;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  box-shadow: 0 5px 18px rgba(7, 74, 34, .2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
#mh-wa-float-stack .mh-wa-float-button:visited { color: #fff; }
#mh-wa-float-stack .mh-wa-float-button > img {
  display: block;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}
#mh-wa-float-stack .mh-wa-float-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; font: inherit; }
#mh-wa-float-stack .mh-wa-float-button:focus-visible {
  outline: 3px solid #0b2d49;
  outline-offset: 4px;
}
@media (hover: hover) and (pointer: fine) {
  #mh-wa-float-stack .mh-wa-float-button:hover {
    background: #20c760;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(7, 74, 34, .27);
  }
}
@media (max-width: 820px) {
  #mh-floating-whatsapp {
    /* The first contact already exists in the mobile WhatsApp / Email bar. */
    display: none !important;
  }
  #mh-wa-float-stack { --mh-wa-gap: 14px; --mh-wa-bottom: 14px; }
  #mh-wa-float-stack .mh-wa-float-button { width: 170px; height: 46px; font-size: 13px; }
}
#mh-wa-float-stack[data-obscured="true"],
body.mobile-nav-open #mh-wa-float-stack {
  visibility: hidden;
  pointer-events: none;
}
body:has(.rfq-modal.open, .cert-lightbox.open, .mhc-product-lightbox.open, .mhc-brochure-modal.open, dialog[open]) #mh-wa-float-stack {
  visibility: hidden;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  #mh-wa-float-stack .mh-wa-float-button { transition: none; }
  #mh-wa-float-stack .mh-wa-float-button:hover { transform: none; }
}
@media print { #mh-wa-float-stack { display: none; } }

/* QR card: selectors are scoped to this widget. Native dialog provides focus containment. */
#mh-wa-dialog {
  box-sizing: border-box;
  width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: #0b2d49;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
  overflow: auto;
  font-family: inherit;
  text-align: center;
}
#mh-wa-dialog:not([open]) { display: none; }
#mh-wa-dialog::backdrop { background: rgba(4, 21, 34, .6); }
#mh-wa-dialog .mh-wa-card { position: relative; box-sizing: border-box; padding: 34px 26px 28px; }
#mh-wa-dialog .mh-wa-close {
  position: absolute; right: 12px; top: 10px; width: 36px; height: 36px;
  display: grid; place-items: center; margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: #f0f4f6; color: #16384d; font: 26px/1 Arial, sans-serif; cursor: pointer;
}
#mh-wa-dialog #mh-wa-title { margin: 0 0 6px; padding: 0; font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: .02em; color: #0b2d49; }
#mh-wa-dialog .mh-wa-subtitle { margin: 0 0 18px; font-size: 17px; line-height: 1.5; color: #61727d; }
#mh-wa-dialog .mh-wa-qr-wrap { position: relative; width: 256px; max-width: 100%; margin: 0 auto 8px; background: #fff; }
#mh-wa-dialog .mh-wa-qr svg { display: block; width: 100%; height: auto; }
#mh-wa-dialog .mh-wa-qr-mark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  box-sizing: border-box; width: 18%; aspect-ratio: 1; padding: 5px;
  display: grid; place-items: center; border: 4px solid #fff; border-radius: 50%; background: #25d366;
}
#mh-wa-dialog .mh-wa-qr-mark img { display: block; width: 100%; height: auto; margin: 0; border: 0; object-fit: contain; }
#mh-wa-dialog .mh-wa-number { margin: 0 0 12px; color: #15384f; font-size: 18px; line-height: 1.5; font-weight: 600; }
#mh-wa-dialog #mh-wa-description { margin: 0 auto 20px; max-width: 270px; color: #61727d; font-size: 14px; line-height: 1.55; }
#mh-wa-dialog .mh-wa-status { margin: 28px 0; color: #526d7d; font-size: 14px; line-height: 1.6; }
#mh-wa-dialog .mh-wa-chat {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-sizing: border-box; width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 999px;
  background: #25d366; color: #07341b; font-size: 15px; font-weight: 700; line-height: 1.4; text-decoration: none;
}
#mh-wa-dialog .mh-wa-chat:hover { background: #20c760; }
#mh-wa-dialog .mh-wa-close:focus-visible, #mh-wa-dialog .mh-wa-chat:focus-visible { outline: 3px solid #0b2d49; outline-offset: 3px; }
#mh-wa-dialog [hidden] { display: none !important; }
@media (max-height: 600px) {
  #mh-wa-dialog .mh-wa-card { padding-top: 24px; padding-bottom: 18px; }
  #mh-wa-dialog .mh-wa-qr-wrap { width: 200px; }
}
@media print { #mh-wa-dialog { display: none !important; } }
