/* ═══════════════════════════════════════════════════════
   FLOATING CHAT WIDGET
   ═══════════════════════════════════════════════════════ */

/* --- Floating Action Button --- */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5),
              0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.3s ease;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6),
              0 3px 10px rgba(0, 0, 0, 0.3);
}

.chat-fab:active {
  transform: scale(0.95);
}

/* Icon inside the FAB */
.chat-fab svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-fab .chat-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
}

.chat-fab.active .chat-icon-msg {
  opacity: 0;
  transform: rotate(90deg);
}

.chat-fab.active .chat-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Subtle pulse animation when idle */
@keyframes chatPulse {
  0%   { box-shadow: 0 4px 15px rgba(0,0,0,0.5), 0 0 0 0 rgba(0,0,0,0.4); }
  70%  { box-shadow: 0 4px 15px rgba(0,0,0,0.5), 0 0 0 12px rgba(0,0,0,0); }
  100% { box-shadow: 0 4px 15px rgba(0,0,0,0.5), 0 0 0 0 rgba(0,0,0,0); }
}

.chat-fab:not(.active) {
  animation: chatPulse 2.5s ease-in-out infinite;
}

.chat-fab.active {
  animation: none;
}


/* --- Popup Menu --- */
.chat-popup {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9998;
  width: 280px;
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border-radius: 12px 12px 12px 2px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15),
              0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.3s ease,
              transform 0.3s cubic-bezier(.34,1.56,.64,1),
              visibility 0.3s ease;
  overflow: hidden;
}

.chat-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header inside popup */
.chat-popup-header {
  padding: 16px 20px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  border-bottom: 1px solid #f0f0f5;
  letter-spacing: -0.01em;
}

/* Links list */
.chat-popup-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.chat-popup-list li {
  margin: 0;
}

.chat-popup-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.18s ease;
  border-left: 3px solid transparent;
}

.chat-popup-list a:hover {
  background: #f7f8fb;
  border-left-color: var(--accent-primary);
}

/* Channel icons */
.chat-channel-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-channel-icon svg {
  width: 20px;
  height: 20px;
}

.chat-channel-icon.whatsapp  { background: #25D366; }
.chat-channel-icon.email     { background: #5B7FFF; }
.chat-channel-icon.messenger { background: #0084FF; }
.chat-channel-icon.telegram  { background: #2AABEE; }

.chat-channel-icon svg { fill: #fff; }


/* --- Backdrop overlay (mobile-friendly) --- */
.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-backdrop.open {
  opacity: 1;
  visibility: visible;
}


/* --- Mobile tweaks --- */
@media (max-width: 480px) {
  .chat-fab {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }

  .chat-fab svg {
    width: 24px;
    height: 24px;
  }

  .chat-popup {
    right: 16px;
    bottom: 86px;
    width: calc(100vw - 32px);
    max-width: 320px;
  }
}
