/* =========================================================
   WHATSAPP QUICK HELP
   Floating WhatsApp button + quick-help popup. The markup is
   built by assets/js/whatsapp-help.js, so a page only needs
   this stylesheet and that script.
   Prefixed "wa-help-" so nothing here collides with the shared
   theme classes in assets/css/style.css.
   ========================================================= */

.wa-help {
  position: fixed;
  right: 20px;
  bottom: 20px;
  /* Above page content, below the theme's mobile-menu overlay (99) */
  z-index: 98;
  font-family: Montserrat, sans-serif;
  /* Don't inherit page-level alignment (e.g. success.html centres its body) */
  text-align: left;
  line-height: 1.5;
}

/* Self-contained box model and fonts, so the widget looks the same
   on pages that don't load the theme's base styles (success.html) */
.wa-help,
.wa-help *,
.wa-help *::before,
.wa-help *::after {
  box-sizing: border-box;
}

.wa-help button {
  font-family: inherit;
}

/* The theme's back-to-top button also sits in the bottom-right
   corner. On pages with this widget, stack it above the WhatsApp
   button, centred on the same line. */
.back-to-top {
  right: 29px;
  bottom: 92px;
}

.wa-help svg.wa-help-glyph {
  fill: currentColor;
}

.wa-help svg.wa-help-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Floating button --- */
.wa-help-toggle {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.4);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.wa-help-toggle:hover {
  background: #1ebe5b;
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.5);
}

/* Soft pulse ring to draw the eye */
.wa-help-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: #25D366;
  animation: wa-help-pulse 2.4s ease-out infinite;
}

.wa-help-open .wa-help-toggle::before {
  animation: none;
  opacity: 0;
}

@keyframes wa-help-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  80%, 100% { transform: scale(1.65); opacity: 0; }
}

/* WhatsApp logo swaps to a close "X" while the popup is open */
.wa-help-icon-open,
.wa-help-icon-close {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.wa-help-icon-open svg {
  width: 30px;
  height: 30px;
}

.wa-help-icon-close svg {
  width: 24px;
  height: 24px;
}

.wa-help-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.wa-help-open .wa-help-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.wa-help-open .wa-help-icon-close {
  opacity: 1;
  transform: none;
}

/* --- Popup panel --- */
.wa-help-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 340px;
  max-width: calc(100vw - 40px);
  /* On short screens the body scrolls instead of the header
     disappearing off the top */
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 39, 83, 0.22);
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.wa-help-open .wa-help-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.wa-help-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 16px 18px;
  background: #002753;
  color: #fff;
}

.wa-help-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
}

.wa-help-avatar img {
  width: 26px;
  height: 26px;
}

.wa-help-who {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.wa-help-who strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.wa-help-who span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.wa-help-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.wa-help-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.wa-help-close svg {
  width: 16px;
  height: 16px;
}

.wa-help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 16px;
  background: #f2faf6;
}

.wa-help-bubble {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 1px 2px rgba(0, 39, 83, 0.08);
  font-size: 13.5px;
  line-height: 1.6;
  color: #52565b;
}

.wa-help-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-help-topic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid #d5f2e5;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #002753;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.wa-help-topic:hover,
.wa-help-topic:focus-visible {
  border-color: #25D366;
  color: #00A481;
}

.wa-help-topic svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.wa-help-topic:hover svg {
  transform: translateX(3px);
}

.wa-help-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  background: #25D366;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.wa-help-start:hover,
.wa-help-start:focus-visible {
  background: #1ebe5b;
  color: #fff;
}

.wa-help-start svg {
  width: 20px;
  height: 20px;
}

/* --- "Need quick help?" nudge beside the button --- */
.wa-help-nudge {
  position: absolute;
  right: 72px;
  bottom: 8px;
  /* Size to the text, not to the 58px widget it's positioned in */
  width: max-content;
  display: flex;
  align-items: center;
  padding: 4px 6px 4px 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(0, 39, 83, 0.16);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

.wa-help-nudge-show .wa-help-nudge {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* Little tail pointing at the button */
.wa-help-nudge::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  background: #fff;
  transform: rotate(45deg);
}

.wa-help-nudge-text {
  padding: 9px 8px 9px 14px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  color: #52565b;
  cursor: pointer;
}

.wa-help-nudge-text strong {
  font-weight: 700;
  color: #00A481;
}

.wa-help-nudge-close {
  position: relative;
  z-index: 1;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f2faf6;
  color: #52565b;
  cursor: pointer;
}

.wa-help-nudge-close svg {
  width: 11px;
  height: 11px;
}

/* Visible keyboard focus (the theme removes outlines site-wide) */
.wa-help a:focus-visible,
.wa-help button:focus-visible {
  outline: 2px solid #00A481;
  outline-offset: 2px;
}

.wa-help .wa-help-toggle:focus-visible {
  outline-color: #002753;
  outline-offset: 3px;
}

/* --- Phones --- */
@media (max-width: 575px) {
  .wa-help {
    right: 16px;
    bottom: 16px;
  }

  .back-to-top {
    right: 23px;
    bottom: 84px;
  }

  .wa-help-toggle {
    width: 54px;
    height: 54px;
  }

  .wa-help-panel {
    bottom: 68px;
    width: calc(100vw - 32px);
    max-width: 360px;
  }

  .wa-help-nudge {
    right: 66px;
    bottom: 6px;
    max-width: calc(100vw - 100px);
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-help-toggle::before { animation: none; }
  .wa-help-toggle,
  .wa-help-panel,
  .wa-help-nudge,
  .wa-help-icon-open,
  .wa-help-icon-close,
  .wa-help-topic,
  .wa-help-topic svg { transition: none; }
}

@media print {
  .wa-help { display: none; }
}
