.gec-floating-contact {
  --gec-fc-size: 52px;
  --gec-fc-gap: 16px;
  position: fixed;
  right: 20px;
  bottom: 40px;
  z-index: 990;
  display: flex;
  flex-direction: column;
  gap: var(--gec-fc-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gec-floating-contact__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--gec-fc-size);
  height: var(--gec-fc-size);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(29, 41, 45, 0.14);
  cursor: pointer;
  transition:
    transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.25s cubic-bezier(0.22, 0.61, 0.36, 1),
    background-color 0.25s ease;
}

.gec-floating-contact__btn:hover,
.gec-floating-contact__btn:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(29, 41, 45, 0.2);
}

.gec-floating-contact__btn:focus-visible {
  outline: 2px solid #1b5d6e;
  outline-offset: 2px;
}

.gec-floating-contact__item svg {
  display: block;
  width: 28px;
  height: 28px;
  transform-origin: 50% 50%;
  animation: gec-floating-shake 3.2s ease-in-out infinite;
}

/* Rung lệch nhịp giữa các nút cho tự nhiên */
.gec-floating-contact__item:nth-child(2) svg {
  animation-delay: 0.4s;
}
.gec-floating-contact__item:nth-child(3) svg {
  animation-delay: 0.8s;
}
.gec-floating-contact__item:nth-child(4) svg {
  animation-delay: 1.2s;
}
.gec-floating-contact__item:nth-child(5) svg {
  animation-delay: 1.6s;
}

/* Rê chuột thì dừng rung */
.gec-floating-contact__btn:hover svg,
.gec-floating-contact__btn:focus-visible svg {
  animation-play-state: paused;
}

/* Rung ~0.5s đầu chu kỳ, phần còn lại đứng yên */
@keyframes gec-floating-shake {
  0%,
  16%,
  100% {
    transform: rotate(0) scale(1);
  }
  2% {
    transform: rotate(-12deg) scale(1.06);
  }
  4% {
    transform: rotate(10deg) scale(1.06);
  }
  6% {
    transform: rotate(-8deg) scale(1.06);
  }
  8% {
    transform: rotate(6deg) scale(1.04);
  }
  10% {
    transform: rotate(-4deg) scale(1.02);
  }
  12% {
    transform: rotate(2deg);
  }
}

.gec-floating-contact__item--zalo svg {
  width: 38px;
  height: 38px;
}

.gec-floating-contact__item--facebook svg {
  width: 16px;
  height: 28px;
}

/* Nút lên đầu trang: nền màu chủ đạo, không rung.
   Ẩn khi ở đầu trang — thu chiều cao về 0 để các nút khác không bị hở khoảng. */
.gec-floating-contact__item--top {
  height: var(--gec-fc-size);
  transition:
    height 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    margin-top 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.3s ease,
    visibility 0.3s;
}

.gec-floating-contact__item--top:not(.is-visible) {
  height: 0;
  margin-top: calc(var(--gec-fc-gap) * -1);
  opacity: 0;
  visibility: hidden;
}

.gec-floating-contact__item--top .gec-floating-contact__btn {
  background: #1b5d6e;
}

.gec-floating-contact__item--top .gec-floating-contact__btn:hover,
.gec-floating-contact__item--top .gec-floating-contact__btn:focus-visible {
  background: #b69a67;
}

.gec-floating-contact__item--top svg {
  width: 24px;
  height: 24px;
  animation: none;
}

.gec-floating-contact__label {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  padding: 6px 12px;
  border-radius: 8px;
  background: #1d292d;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(6px, -50%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
}

.gec-floating-contact__btn:hover .gec-floating-contact__label,
.gec-floating-contact__btn:focus-visible .gec-floating-contact__label {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

@media (max-width: 767px) {
  .gec-floating-contact {
    --gec-fc-size: 44px;
    --gec-fc-gap: 10px;
    right: 12px;
    bottom: 20px;
  }

  .gec-floating-contact__label {
    display: none;
  }

  .gec-floating-contact__btn {
    border-radius: 12px;
  }

  .gec-floating-contact__item svg {
    width: 22px;
    height: 22px;
  }

  .gec-floating-contact__item--zalo svg {
    width: 30px;
    height: 30px;
  }

  .gec-floating-contact__item--facebook svg {
    width: 13px;
    height: 22px;
  }

  .gec-floating-contact__item--top svg {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gec-floating-contact__btn,
  .gec-floating-contact__label,
  .gec-floating-contact__item--top {
    transition: none;
  }

  .gec-floating-contact__item svg {
    animation: none;
  }
}
