/* ========================================
   ZERNIA — Floating Contact Button
   ======================================== */

/* --- Container --- */
.z-contact-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  /* pass clicks through container gaps */
}

/* All interactive children receive pointer-events */
.z-contact-fab__trigger,
.z-contact-fab__option {
  pointer-events: auto;
}

/* --- Main Trigger Button --- */
.z-contact-fab__trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background-color: #5F6B45;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.z-contact-fab__trigger:hover {
  transform: scale(1.06);
}

.z-contact-fab__trigger:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(95, 107, 69, 0.5);
}

/* Open state background */
.z-contact-fab.is-open .z-contact-fab__trigger {
  background-color: #38513A;
}

/* --- Phone & Close Icons inside trigger --- */
.z-contact-fab__icon-phone,
.z-contact-fab__icon-close {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Default state: phone visible, close hidden */
.z-contact-fab__icon-phone {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.z-contact-fab__icon-close {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
}

/* Open state: phone hidden, close visible */
.z-contact-fab.is-open .z-contact-fab__icon-phone {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.z-contact-fab.is-open .z-contact-fab__icon-close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* --- Option Buttons (Viber / WhatsApp / Telegram) --- */
.z-contact-fab__options {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  /* Disable events when closed/animating */
}

.z-contact-fab.is-open .z-contact-fab__options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  /* Enable events when fully opened */
}

.z-contact-fab__option {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #5F6B45;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.z-contact-fab__option:hover {
  background-color: #38513A;
  transform: scale(1.08);
}

.z-contact-fab__option:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(95, 107, 69, 0.5);
}

.z-contact-fab__option:active {
  background-color: #38513A;
  transform: scale(0.96);
}

.z-contact-fab.is-open .z-contact-fab__option:hover {
  transform: translateY(0) scale(1.08);
}

.z-contact-fab.is-open .z-contact-fab__option:active {
  transform: translateY(0) scale(0.96);
}

.z-contact-fab__option img {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

/* --- Staggered entrance animation for items --- */
.z-contact-fab__option {
  opacity: 0;
  transform: translateY(12px) scale(0.8);
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s ease;
}

.z-contact-fab.is-open .z-contact-fab__option {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger: bottom-to-top order (Viber first, then WhatsApp, then Telegram) */
.z-contact-fab.is-open .z-contact-fab__option:nth-child(1) {
  transition-delay: 0.05s;
}

.z-contact-fab.is-open .z-contact-fab__option:nth-child(2) {
  transition-delay: 0.1s;
}

.z-contact-fab.is-open .z-contact-fab__option:nth-child(3) {
  transition-delay: 0.15s;
}

/* Reset delays on close for snappy collapse */
.z-contact-fab:not(.is-open) .z-contact-fab__option {
  transition-delay: 0s;
}

@media screen and (max-width: 767px) {
  .z-contact-fab__options {
    position: absolute;
    right: 68px;
    bottom: 4px;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    transform: translateX(16px);
  }

  .z-contact-fab.is-open .z-contact-fab__options {
    transform: translateX(0);
  }

  .z-contact-fab__option {
    transform: translateX(12px) scale(0.8) !important;
  }

  .z-contact-fab.is-open .z-contact-fab__option {
    transform: translateX(0) scale(1) !important;
  }

  .z-contact-fab.is-open .z-contact-fab__option:hover {
    transform: translateX(0) scale(1.08) !important;
  }

  .z-contact-fab.is-open .z-contact-fab__option:active {
    transform: translateX(0) scale(0.96) !important;
  }
}

/* --- Screen-reader only label --- */
.z-contact-fab__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {

  .z-contact-fab__trigger,
  .z-contact-fab__options,
  .z-contact-fab__option,
  .z-contact-fab__icon-phone,
  .z-contact-fab__icon-close {
    transition: none !important;
  }
}