@keyframes chat-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.12); }
}
#chat-fab {
  position: fixed !important;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  will-change: transform;
}
#chat-fab::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.3);
  z-index: -1;
  animation: chat-pulse 2.5s ease-in-out infinite;
  will-change: opacity, transform;
}
#chat-fab.open::after { animation: none; }
#chat-fab:hover::after { animation: none; }
#chat-fab svg { width: 26px; height: 26px; fill: white; }
#chat-fab .icon-close { display: none; }
#chat-fab.open .icon-chat { display: none; }
#chat-fab.open .icon-close { display: block; }

#chat-panel {
  position: fixed !important;
  bottom: 96px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 700px;
  max-height: calc(100dvh - 120px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}
#chat-panel.open {
  opacity: 1;
  pointer-events: auto;
}
#chat-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
@media (max-width: 480px) {
  #chat-panel {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: 75dvh;
    max-height: 75dvh;
    border-radius: 12px;
  }
  #chat-fab {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: 50px;
    height: 50px;
  }
}
