/* =============================================================
   ENGAGEMENT — проактивное облачко чата + анимация точек на кнопке
   ============================================================= */

/* ---------- PROACTIVE CHAT BUBBLE (dark glassmorphism style) ---------- */
.eng-bubble {
  position: fixed;
  right: 24px;
  bottom: 104px;
  z-index: 9997;
  max-width: 290px;
  background: rgba(21, 37, 55, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-white, #e2e8f0);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px 18px 4px 18px;
  padding: 16px 40px 16px 18px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(97, 117, 162, 0.08);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.45s ease;
  cursor: pointer;
}
.eng-bubble.active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* Subtle shimmer glow on the bubble border */
.eng-bubble::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(97, 117, 162, 0.15) 0%, transparent 50%, rgba(97, 117, 162, 0.08) 100%);
  z-index: -1;
  pointer-events: none;
}

.eng-bubble__name {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent-cyan, #67b5e2);
  margin-bottom: 4px;
}
.eng-bubble::after {
  content: '';
  position: absolute;
  right: 28px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: rgba(21, 37, 55, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  clip-path: polygon(0% 100%, 100% 100%, 100% 0%);
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
  box-shadow: 4px 4px 8px rgba(0,0,0,0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.eng-bubble__close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s ease;
}
.eng-bubble__close:hover { color: var(--text-white, #e2e8f0); }

@media (max-width: 480px) {
  .eng-bubble { right: 16px; bottom: 92px; max-width: calc(100vw - 90px); }
  .eng-bubble::after { right: 23px; }
}

/* ---------- BOUNCING DOTS (на кнопке чата перед облачком) ---------- */
.chat-toggle-btn .eng-dots {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.chat-toggle-btn.eng-typing img { display: none; }
.chat-toggle-btn.eng-typing .eng-dots { display: flex; }

.eng-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
  animation: eng-dot-bounce 1.1s infinite ease-in-out both;
}
.eng-dots span:nth-child(1) { animation-delay: -0.32s; }
.eng-dots span:nth-child(2) { animation-delay: -0.16s; }
.eng-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes eng-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-7px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .eng-bubble { transition-duration: 0.001ms !important; }
  .eng-dots span { animation: none; }
}


/* Скрываем облачко, когда открыта любая модалка (body.overflow-hidden) */
body.overflow-hidden .eng-bubble { opacity: 0; visibility: hidden; pointer-events: none; }
