:root {
  --viber: #6f4bd8;
  --telegram: #2aa8df;
  --text: #1f1f1f;
  --border: #ececec;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.contact-widget {
  position: fixed;
  right: 22px;
  top: calc(50% + 38px);
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.contact-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transform-origin: bottom center;
}

.contact-item {
  opacity: 0;
  transform: translateY(calc(var(--step) * 61px)) scale(0);
  transform-origin: center;
  filter: blur(2px);
  transition:
    opacity 0.26s ease,
    filter 0.26s ease,
    transform 0.34s cubic-bezier(.25, 1, .5, 1);
}

.contact-item:nth-child(1) { --step: 4; }
.contact-item:nth-child(2) { --step: 3; }
.contact-item:nth-child(3) { --step: 2; }
.contact-item:nth-child(4) { --step: 1; }

.contact-widget.is-open .contact-options,
.contact-widget:hover .contact-options {
  pointer-events: auto;
}

.contact-widget.is-open .contact-item,
.contact-widget:hover .contact-item {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition:
    opacity 0.26s ease,
    filter 0.26s ease,
    transform 0.34s cubic-bezier(.18, .9, .22, 1.25);
}

.contact-widget.is-open .contact-item:nth-child(4),
.contact-widget:hover .contact-item:nth-child(4) {
  transition-delay: 0.02s;
}

.contact-widget.is-open .contact-item:nth-child(3),
.contact-widget:hover .contact-item:nth-child(3) {
  transition-delay: 0.06s;
}

.contact-widget.is-open .contact-item:nth-child(2),
.contact-widget:hover .contact-item:nth-child(2) {
  transition-delay: 0.10s;
}

.contact-widget.is-open .contact-item:nth-child(1),
.contact-widget:hover .contact-item:nth-child(1) {
  transition-delay: 0.14s;
}

.contact-widget:not(.is-open):not(:hover) .contact-item:nth-child(1) {
  transition-delay: 0s;
}

.contact-widget:not(.is-open):not(:hover) .contact-item:nth-child(2) {
  transition-delay: 0.04s;
}

.contact-widget:not(.is-open):not(:hover) .contact-item:nth-child(3) {
  transition-delay: 0.08s;
}

.contact-widget:not(.is-open):not(:hover) .contact-item:nth-child(4) {
  transition-delay: 0.12s;
}

.contact-btn,
.contact-main {
  position: relative;
  z-index: 2;
  width: 53px;
  height: 53px;
  border-radius: 50%;
  border: 0;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-btn:hover,
.contact-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.contact-kyivstar {
  background: #01539B;
}

.contact-kyivstar svg {
  width: 29px;
  height: 29px;
  transform: scale(1.3);
  transform-origin: center;
}

.contact-kyivstar svg g {
  stroke: #FFC72C;
  stroke-width: 8px;
  stroke-linecap: round;
  fill: none;
}

.contact-lifecell {
  background: #0050a6;
}

.contact-lifecell svg {
  width: 100%;
  height: 100%;
  transform: scale(1.08);
}

.contact-viber {
  background: #7f3fb7;
}

.contact-viber svg {
  width: 31px;
  height: 31px;
}

#viber-path72,
#viber-path80 {
  fill: #ffffff !important;
}

#viber-path74,
#viber-path76,
#viber-path78 {
  fill: none !important;
  stroke: #ffffff !important;
}

.contact-telegram {
  background: linear-gradient(135deg, #38b6e8, #1494d2);
}

.contact-main {
  width: 56px;
  height: 56px;
  background: #050505;
  cursor: pointer;
}

.contact-main svg {
  transition: transform 0.24s ease;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-widget.is-open .contact-main svg,
.contact-widget:hover .contact-main svg {
  transform: rotate(8deg) scale(1.04);
}

.contact-telegram svg {
  width: 43px;
  height: 43px;
}

.contact-telegram svg path:first-of-type {
  display: none;
}

.contact-label {
  position: absolute;
  right: 67px;
  min-width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  color: #333;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.contact-item {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1;
}

.contact-item:hover .contact-label {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 767px) {
  .contact-widget:hover .contact-options {
    pointer-events: none;
  }

  .contact-widget:hover .contact-item {
    opacity: 0;
    transform: translateY(calc(var(--step) * 61px)) scale(0);
    filter: none;
  }

  .contact-widget.is-open .contact-options {
    pointer-events: auto;
  }

  .contact-widget.is-open .contact-item {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: none;
  }

  .contact-item {
    filter: none;
  }

  .contact-widget:hover .contact-main svg {
    transform: none;
  }

  .contact-widget.is-open .contact-main svg {
    transform: rotate(8deg) scale(1.04);
  }

  .contact-widget {
    right: 18px;
    top: auto;
    bottom: 28px;
    transform: none;
  }

  #back-top {
    right: 28px !important;
    bottom: 112px !important;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease !important;
  }

  #back-top a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 1rem !important;
  }

  #back-top.felex-backtop-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(10px) scale(0.9) !important;
  }
}

@media (max-width: 360px) {
  .contact-widget {
    right: 12px;
    bottom: 22px;
  }

  .contact-btn {
    width: 48px;
    height: 48px;
  }

  .contact-main {
    width: 51px;
    height: 51px;
  }

  .contact-item {
    transform: translateY(calc(var(--step) * 56px)) scale(0);
  }

  .contact-widget:hover .contact-item {
    transform: translateY(calc(var(--step) * 56px)) scale(0);
  }

  .contact-widget.is-open .contact-item {
    transform: translateY(0) scale(1);
  }

  .contact-kyivstar svg {
    width: 26px;
    height: 26px;
  }

  .contact-viber svg {
    width: 28px;
    height: 28px;
  }

  .contact-telegram svg {
    width: 38px;
    height: 38px;
  }

  .contact-main svg {
    width: 25px;
    height: 25px;
  }

  #back-top {
    right: 19.5px !important;
  }
}

/* Premium pulse micro-animation for the main button when closed */
.contact-widget:not(.is-open):not(:hover) .contact-main {
  animation: contactPulse 3s ease-in-out infinite;
}

@keyframes contactPulse {
  0% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-widget:not(.is-open):not(:hover) .contact-main {
    animation: none;
  }
}

