/**
 * Diennuoc360 Floating Contact Widget
 * Chuẩn đồng tâm 100% & Sóng bung tỏa êm dịu (Smooth Organic Spread)
 */

:root {
  --cpb-brand: #eb6516;
}

.cpb-fixed {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: column;
}

.cpb-right {
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
  gap: 24px;
}

.cpb-pulse-container {
  position: relative;
  width: 48px;
  height: 48px;
}

/* Các vòng sóng tỏa ra mượt mà từ đúng tâm nút */
.cpb-pulse-ring {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(235, 101, 22, 0.22);
  z-index: 1;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, opacity;
  animation: cpb-smooth-spread 2.4s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}

.cpb-pulse-ring:nth-child(2) {
  animation-delay: 1.2s;
}

@keyframes cpb-smooth-spread {
  0% {
    transform: scale(0.72);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.95);
    opacity: 0;
  }
}

.cpb-social-btn {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  background-color: var(--cpb-brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white !important;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
  text-decoration: none;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.cpb-social-btn svg {
  display: block;
  pointer-events: none;
  animation: cpb-contact-shake 5.2s ease-in-out infinite;
  transform-origin: center;
}

/* Rung nhỏ theo nhịp giúp người dùng nhận biết nút mà không gây khó chịu. */
@keyframes cpb-contact-shake {
  0%, 88%, 100% { transform: rotate(0deg) translateX(0); }
  90% { transform: rotate(-7deg) translateX(-1px); }
  92% { transform: rotate(7deg) translateX(1px); }
  94% { transform: rotate(-4deg) translateX(-1px); }
  96% { transform: rotate(2deg) translateX(0); }
}

.cpb-social-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.cpb-social-btn:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .cpb-right {
    right: 15px;
    gap: 16px;
    transform: translateY(-50%) scale(0.88);
    transform-origin: right center;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Keep the requested contact cue perceptible while using a slower wave. */
  .cpb-fixed.cpb-right .cpb-pulse-container .cpb-pulse-ring {
    animation: cpb-smooth-spread 3.6s cubic-bezier(0.2, 0.6, 0.4, 1) infinite !important;
  }

  .cpb-fixed.cpb-right .cpb-pulse-container .cpb-pulse-ring:nth-child(2) {
    animation-delay: 1.8s !important;
  }

  .cpb-social-btn svg {
    animation: none;
  }
}
