/* ─────────────────────────────────────────────────────────────
   wapp.css — Floating WhatsApp + Call action buttons
   Extracted from inline <style> in wapp.php.
   Load this file in header.php's global <link> chain, or
   add it to the $extra_css_arr on pages where wapp.php is included.
   Since wapp.php is included on every page, add to header-footer.css
   or load globally via header.php alongside header-footer.css.
───────────────────────────────────────────────────────────── */

/* Container — fixed position, stacked vertically */
.floating-actions {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 9999;
  /* pointer-events: none on container allows clicks to pass through gaps between buttons */
  pointer-events: none;
}

/* Re-enable pointer events only on the actual anchor elements */
.floating-actions a {
  pointer-events: auto;
}

/* Shared button base */
.fab-btn {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  position: relative;
  /* isolation: isolate creates a new stacking context — keeps ::before pulse behind the button */
  isolation: isolate;
  color: #fff;
  font-size: 22px;
  background-color: rgba(30, 30, 30, 0.85);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Backdrop blur applied only where supported — graceful degradation */
@supports (backdrop-filter: blur(12px)) {
  .fab-btn {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* Hover only on devices that support it — avoids sticky hover states on touch */
@media (hover: hover) and (pointer: fine) {
  .fab-btn:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow:
      0 16px 40px rgba(0, 0, 0, 0.45),
      inset 0 1px 1px rgba(255, 255, 255, 0.15);
  }
}

.fab-btn:active {
  transform: scale(0.96);
}

/* Keyboard focus ring for accessibility */
.fab-btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 4px;
}

/* WhatsApp button */
.fab-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
}

/* Call button */
.fab-call {
  background: linear-gradient(135deg, #d4af37, #b68b2d);
  color: #000;
}

/* Pulse ring — ::before pseudo-element expands behind each button */
.fab-whatsapp::before,
.fab-call::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  opacity: 0.5;
  /* z-index: -1 pushes pulse behind button face within the isolation context */
  z-index: -1;
  animation: fabPulse 2.2s infinite;
  pointer-events: none;
}

@keyframes fabPulse {
  0%   { transform: scale(1);    opacity: 0.5; }
  70%  { transform: scale(1.42); opacity: 0; }
  100% { transform: scale(1.42); opacity: 0; }
}

/* Tablet — tighten gap slightly */
@media (max-width: 1024px) {
  .floating-actions { gap: 12px; }
}

/* Mobile landscape — move up to clear typical bottom navigation bars */
@media (max-width: 768px) {
  .floating-actions {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(72px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .fab-btn {
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    font-size: 20px;
  }
}

/* Small portrait phones */
@media (max-width: 480px) {
  .floating-actions {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(68px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .fab-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    font-size: 18px;
  }
}

/* Very small / legacy phones */
@media (max-width: 400px) {
  .floating-actions {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(64px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .fab-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    font-size: 17px;
  }
}

/* Respect reduced-motion preference — disables all animations and transitions */
@media (prefers-reduced-motion: reduce) {
  .fab-btn,
  .fab-btn::before {
    animation: none;
    transition: none;
  }

  /* Preserve only the tactile active feedback — no motion involved */
  .fab-btn:active {
    transform: scale(0.96);
  }
}