/* =========================================================
   Balloon Button — Frontend Styles
   All positioning driven by CSS variables set via PHP inline style
   ========================================================= */

/* --- Wrapper: fixed container --- */
.bbt-wrapper {
  position: fixed;
  right:  var(--bbt-right, 24px);
  left:   var(--bbt-left, auto);
  bottom: var(--bbt-bottom, 24px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* =========================================================
   Main Button
   ========================================================= */
.bbt-main-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: transparent;
  position: relative;
  outline: none;
  flex-shrink: 0;

  /* Idle ping animation */
  animation: bbt-ping 2.4s ease-in-out infinite;
}

.bbt-main-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6), 0 0 0 5px rgba(0, 0, 0, 0.3);
}

.bbt-main-btn__icon {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;

  /* Icon rotation state */
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Rotate icon 45° when open */
.bbt-wrapper.is-open .bbt-main-btn__icon {
  transform: rotate(45deg);
}

/* Stop ping when open */
.bbt-wrapper.is-open .bbt-main-btn {
  animation: none;
}

/* --- Ping animation --- */
@keyframes bbt-ping {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  }
  30% {
    transform: scale(1.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  }
  60% {
    transform: scale(0.96);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
  }
}

/* =========================================================
   Sub Buttons Container
   ========================================================= */
.bbt-sub-buttons {
  display: flex;
  flex-direction: column-reverse; /* button 1 closest to main, stacks up */
  align-items: center;
  gap: 10px;

  /* Hidden state */
  visibility: hidden;
  pointer-events: none;
}

/* Open state — reveal container */
.bbt-wrapper.is-open .bbt-sub-buttons {
  visibility: visible;
  pointer-events: auto;
}

/* =========================================================
   Sub Button — individual
   ========================================================= */
.bbt-sub-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.20);
  flex-shrink: 0;

  /* Entry animation base */
  opacity: 0;
  transform: translateY(16px) scale(0.7);
  transition:
    opacity     0.28s ease,
    transform   0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow  0.18s ease;
}

.bbt-sub-btn__icon {
  width: 62%;
  height: 62%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Hover lift */
.bbt-sub-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px) scale(1.06) !important;
}

/* Active press */
.bbt-sub-btn:active {
  transform: scale(0.95) !important;
}

/* =========================================================
   Sub Button Entry — staggered via nth-child
   JS adds .is-open to wrapper; CSS handles stagger with delay
   ========================================================= */
.bbt-wrapper.is-open .bbt-sub-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger each button — first child appears first */
.bbt-wrapper.is-open .bbt-sub-btn:nth-child(1) { transition-delay: 0.00s; }
.bbt-wrapper.is-open .bbt-sub-btn:nth-child(2) { transition-delay: 0.06s; }
.bbt-wrapper.is-open .bbt-sub-btn:nth-child(3) { transition-delay: 0.12s; }
.bbt-wrapper.is-open .bbt-sub-btn:nth-child(4) { transition-delay: 0.18s; }
.bbt-wrapper.is-open .bbt-sub-btn:nth-child(5) { transition-delay: 0.24s; }

/* =========================================================
   Responsive — slightly smaller on mobile
   ========================================================= */
@media ( max-width: 480px ) {
  .bbt-main-btn {
    width: 52px;
    height: 52px;
  }

  .bbt-sub-btn {
    width: 42px;
    height: 42px;
  }
}
