/* Contact widget. Mirrors the floating widget used by the ampu product page. */
.b24-widget {
  position: fixed;
  z-index: 2147483647;
  right: 1rem;
  bottom: 1rem;
  cursor: pointer;
  pointer-events: none;
}

/* scrollUp is appended to body after the widget and otherwise wins when both
 * elements use the maximum z-index. Keep it below the contact controls. */
#scrollUp {
  z-index: 2147483646 !important;
}

body.b24-contact-open #scrollUp {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.b24-main,
.b24-item {
  display: flex;
  align-items: center;
}

.b24-main {
  position: relative;
  z-index: 2;
  width: 3rem;
  height: 3rem;
  padding: 0;
  justify-content: center;
  background: #39393a;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  cursor: pointer;
  outline: 0;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.b24-main:focus,
.b24-main:hover {
  box-shadow: 0 0 0 3px rgba(220, 220, 220, .7), 0 6px 20px rgba(0, 0, 0, .25);
}

.b24-pulse {
  position: absolute;
  inset: 0;
  border: 2px solid #39393a;
  border-radius: 50%;
  animation: essenceB24Pulse 1.5s infinite;
}

.b24-icon-switch {
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
}

.b24-icon-switch.chat {
  animation: essenceB24ChatSwitch 3s infinite;
}

.b24-icon-switch.phone-icon {
  margin: 0;
  padding: 0;
  background: none;
  text-align: inherit;
  animation: essenceB24PhoneSwitch 3s infinite;
}

.b24-icon-switch.close-icon {
  opacity: 0;
}

.b24-main.expanded {
  background: #9e9e9e;
  transition: background .2s;
}

.b24-main.expanded .close-icon {
  opacity: 1;
}

.b24-main.expanded .chat,
.b24-main.expanded .phone-icon {
  display: none;
}

.b24-main.expanded .b24-pulse {
  opacity: 0;
  animation: none;
}

.b24-item {
  position: absolute;
  right: 0;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  transition: opacity .22s, transform .22s, visibility .22s;
  cursor: pointer;
  pointer-events: none;
  will-change: transform, opacity;
}

.b24-widget.is-open .b24-item,
.b24-widget.ai-minimized .b24-item.ai-assistant {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.b24-widget .b24-item.viber {
  bottom: 70px;
}

.b24-widget .b24-item.telegram {
  bottom: 130px;
}

.b24-widget .b24-item.phone-call-kyiv {
  bottom: 190px;
}

.b24-widget.has-ai .b24-item.ai-assistant {
  bottom: 70px;
}

.b24-widget.has-ai .b24-item.viber {
  bottom: 130px;
}

.b24-widget.has-ai .b24-item.telegram {
  bottom: 190px;
}

.b24-widget.has-ai .b24-item.phone-call-kyiv {
  bottom: 250px;
}

.b24-label {
  padding: 8px 12px;
  color: #242424;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.b24-icon {
  display: flex;
  flex: 0 0 45px;
  width: 45px;
  height: 45px;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  font-weight: 700;
}

.b24-icon.ai-assistant-icon {
  position: relative;
  overflow: visible;
  background: transparent;
}

.b24-icon.ai-assistant-icon img {
  display: block;
  width: 45px;
  height: 45px;
}

.b24-icon.bg-viber {
  background: #7360f2;
}

.b24-icon.bg-telegram {
  background: #2ca5e0;
}

.b24-icon.bg-phone {
  background: #00c853;
}

.ai-webchat-unread {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #ff313d;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(168, 10, 30, .4);
  opacity: 0;
  transform: scale(.55);
  transition: opacity .18s, transform .18s, background .18s;
  pointer-events: none;
}

.ai-webchat-unread.waiting {
  background: #8b5cf6;
  opacity: 1;
  transform: scale(.72);
  animation: essenceAiWaitingPulse 1.7s ease-in-out infinite;
}

.ai-webchat-unread.show {
  background: #ff313d;
  opacity: 1;
  transform: scale(1);
  animation: essenceAiUnreadPulse 1.8s ease-out 1;
}

.essence-ai-chat-dialog[hidden] {
  display: none;
}

.essence-ai-chat-dialog {
  position: fixed;
  z-index: 2147483647;
  inset: 0;
}

.essence-ai-chat-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(21, 13, 28, .62);
  border: 0;
}

.essence-ai-chat-modal {
  position: absolute;
  right: 20px;
  bottom: 16px;
  width: 440px;
  max-width: calc(100vw - 40px);
  height: calc(100vh - 32px);
  max-height: 760px;
  overflow: hidden;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 65px rgba(0, 0, 0, .34);
}

.essence-ai-chat-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 0;
}

.essence-ai-chat-close,
.essence-ai-chat-minimize {
  position: absolute;
  z-index: 3;
  top: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #33293c;
  background: rgba(34, 27, 42, .08);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  text-align: center;
}

.essence-ai-chat-close {
  right: 8px;
  font-size: 25px;
  line-height: 32px;
}

.essence-ai-chat-minimize {
  right: 50px;
  font-size: 27px;
  line-height: 29px;
}

.essence-ai-chat-loading {
  position: absolute;
  z-index: 2;
  top: 64px;
  right: 20px;
  left: 20px;
  color: #746d7c;
  font-size: 14px;
  text-align: center;
}

body.essence-ai-chat-open {
  overflow: hidden;
}

@keyframes essenceB24Pulse {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(1.7); opacity: 0; }
}

@keyframes essenceB24ChatSwitch {
  0%, 45% { opacity: 1; transform: scale(1); }
  50%, 100% { opacity: 0; transform: scale(.5); }
}

@keyframes essenceB24PhoneSwitch {
  0%, 45% { opacity: 0; transform: scale(.5); }
  50%, 100% { opacity: 1; transform: scale(1); }
}

@keyframes essenceAiWaitingPulse {
  50% { opacity: .55; transform: scale(.62); }
}

@keyframes essenceAiUnreadPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 49, 61, .55); }
  70% { box-shadow: 0 0 0 7px rgba(255, 49, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 49, 61, 0); }
}

@media only screen and (max-width: 759px) {
  .essence-ai-chat-modal {
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .b24-pulse,
  .b24-icon-switch.chat,
  .b24-icon-switch.phone-icon,
  .ai-webchat-unread.waiting,
  .ai-webchat-unread.show {
    animation: none;
  }

  .b24-icon-switch.chat {
    opacity: 1;
    transform: scale(1);
  }

  .b24-icon-switch.phone-icon {
    opacity: 0;
  }
}
