/**
 * Nút nổi BConnect — Tư vấn ngay (trái) + Zalo/Messenger (phải) + căn chatbot.
 * Brand: --tz-prime-c #395aef
 */

@keyframes bconnect-float-ripple {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  30% {
    opacity: 0.45;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes bconnect-float-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* —— Stack Zalo + Messenger —— */
.bconnect-float-stack {
  position: fixed;
  right: 30px;
  /* Trên Support Assistant (~92+50) + gap; chừa scrollup */
  bottom: 154px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  pointer-events: none;
}

.bconnect-float-btn {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  width: 50px;
  height: 50px;
  min-width: 50px;
  min-height: 50px;
  max-width: 50px;
  max-height: 50px;
  box-sizing: border-box;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  text-decoration: none;
  animation: bconnect-float-in 0.45s ease forwards;
  overflow: visible;
  flex-shrink: 0;
}

.bconnect-float-btn__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-sizing: border-box;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow:
    0 0 0 6px rgba(57, 90, 239, 0.14),
    0 4px 14px rgba(57, 90, 239, 0.28);
}

.bconnect-float-btn::before,
.bconnect-float-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: rgba(57, 90, 239, 0.2);
  animation: bconnect-float-ripple 2s ease-out infinite;
}

.bconnect-float-btn::after {
  animation-delay: 1s;
}

.bconnect-float-btn img {
  position: relative;
  z-index: 2;
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.bconnect-float-btn--messenger {
  animation-delay: 0.15s;
}

.bconnect-float-btn--messenger::before {
  animation-delay: 0.15s;
}

.bconnect-float-btn--messenger::after {
  animation-delay: 1.15s;
}

.bconnect-float-btn:hover .bconnect-float-btn__inner,
.bconnect-float-btn:focus-visible .bconnect-float-btn__inner {
  transform: scale(1.08);
  box-shadow:
    0 0 0 8px rgba(57, 90, 239, 0.2),
    0 6px 20px rgba(57, 90, 239, 0.38);
}

/* —— Tư vấn ngay (góc trái) —— */
.bconnect-float-call {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 10001;
  display: flex;
  align-items: center;
  text-decoration: none;
  animation: bconnect-float-in 0.45s ease forwards;
}

.bconnect-float-call__icon {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  overflow: visible;
}

.bconnect-float-call__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tz-prime-c, #395aef);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(57, 90, 239, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.bconnect-float-call__inner i {
  transform: rotate(-18deg);
}

.bconnect-float-call__icon::before,
.bconnect-float-call__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: rgba(57, 90, 239, 0.35);
  animation: bconnect-float-ripple 2s ease-out infinite;
}

.bconnect-float-call__icon::after {
  animation-delay: 1s;
}

.bconnect-float-call__text {
  position: relative;
  z-index: 1;
  margin-left: -14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-height: 44px;
  padding: 6px 18px 6px 26px;
  background: #fff;
  border: 2px solid var(--tz-prime-c, #395aef);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.bconnect-float-call__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #111;
  text-transform: uppercase;
  white-space: nowrap;
}

.bconnect-float-call__number {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--tz-prime-c, #395aef);
  white-space: nowrap;
}

.bconnect-float-call:hover .bconnect-float-call__inner,
.bconnect-float-call:focus-visible .bconnect-float-call__inner {
  transform: scale(1.06);
  background: #2f4ad4;
  box-shadow: 0 6px 20px rgba(47, 74, 212, 0.42);
}

.bconnect-float-call:hover .bconnect-float-call__text,
.bconnect-float-call:focus-visible .bconnect-float-call__text {
  border-color: #2f4ad4;
  box-shadow: 0 6px 18px rgba(57, 90, 239, 0.18);
}

/* —— Chatbot BCONNECT: 60px → 50px, xếp dưới Zalo/Messenger —— */
chatbot-widget {
  right: 30px !important;
  bottom: 92px !important;
  transform: scale(0.8333) !important;
  transform-origin: bottom right !important;
  z-index: 10001 !important;
}

chatbot-widget.bconnect-chatbot-open {
  transform: none !important;
  bottom: 20px !important;
  right: 20px !important;
}

/* Scroll-up không bị che */
.scrollup {
  right: 30px !important;
  bottom: 20px !important;
  width: 50px !important;
  height: 50px !important;
  line-height: 50px !important;
  z-index: 10000 !important;
}

@media (prefers-reduced-motion: reduce) {
  .bconnect-float-btn::before,
  .bconnect-float-btn::after,
  .bconnect-float-call__icon::before,
  .bconnect-float-call__icon::after {
    animation: none;
    opacity: 0;
  }

  .bconnect-float-btn,
  .bconnect-float-call {
    animation: none;
    opacity: 1;
  }
}

@media (max-width: 575px) {
  .bconnect-float-stack {
    right: 16px;
    bottom: 134px;
    gap: 10px;
  }

  .bconnect-float-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    max-width: 46px;
    max-height: 46px;
  }

  .bconnect-float-btn img {
    width: 26px;
    height: 26px;
    max-width: 26px;
    max-height: 26px;
  }

  .bconnect-float-call {
    left: 16px;
    bottom: 16px;
  }

  .bconnect-float-call__icon {
    width: 48px;
    height: 48px;
  }

  .bconnect-float-call__inner {
    font-size: 18px;
  }

  .bconnect-float-call__text {
    margin-left: -12px;
    padding: 5px 14px 5px 22px;
    min-height: 40px;
  }

  .bconnect-float-call__label {
    font-size: 10px;
  }

  .bconnect-float-call__number {
    font-size: 13px;
  }

  chatbot-widget {
    right: 16px !important;
    bottom: 78px !important;
    transform: scale(0.7667) !important;
  }

  chatbot-widget.bconnect-chatbot-open {
    transform: none !important;
    bottom: 12px !important;
    right: 12px !important;
  }

  .scrollup {
    right: 16px !important;
    bottom: 16px !important;
    width: 46px !important;
    height: 46px !important;
    line-height: 46px !important;
  }
}
