/* ==========================================================================
   Chat de suporte com mascote (canto inferior direito)
   ========================================================================== */
.ig-mascot {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 46;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

.ig-mascot img {
  width: auto;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgb(0 0 0 / 0.6));
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.25, 1);
  user-select: none;
}

.ig-mascot:hover img { transform: translateY(-4px) scale(1.06); }

/* a arte já tem o balão "posso ajudar?", então a bolinha de status
   não aparece em cima dela (o status fica no cabeçalho do chat) */
.ig-mascot__ping {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid #0a0a0c;
  background: #9ca3af;
}

.ig-mascot__ping--on {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: ig-chat-pulse 1.8s infinite;
}

@keyframes ig-chat-pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ---- painel ---- */
.ig-chat {
  position: fixed;
  right: 22px;
  bottom: 126px;
  z-index: 47;
  left: 12px;
  width: auto;
  max-width: 340px;
  margin-left: auto;
  max-height: calc(100dvh - 150px);
  display: none;
}

.ig-chat[data-open='true'] { display: block; }

.ig-chat__card {
  border-radius: 18px;
  background: #0a0a0c;
  border: 1px solid rgb(255 255 255 / 0.1);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.75);
  overflow: hidden;
  will-change: transform, opacity;
}

.ig-chat__card[data-state='open'] { animation: ig-chat-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.ig-chat__card[data-state='closed'] { animation: ig-chat-out 0.22s ease-in forwards; }

@keyframes ig-chat-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ig-chat-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(14px) scale(0.96); }
}

.ig-chat__bar { height: 2px; background: linear-gradient(to right, hsl(var(--primary)), hsl(var(--primary) / 0.4), transparent); }

.ig-chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgb(255 255 255 / 0.07);
}

.ig-chat__avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: hsl(var(--primary) / 0.14);
  border: 1px solid hsl(var(--primary) / 0.22);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}

.ig-chat__avatar img { width: 100%; height: 100%; object-fit: cover; }

.ig-chat__who { flex: 1; min-width: 0; }
.ig-chat__who strong { display: block; font-size: 14px; font-weight: 600; color: #fff; line-height: 1.1; }
.ig-chat__who span { font-size: 11px; color: #34d399; }
.ig-chat__who span[data-off='true'] { color: #eab308; }

.ig-chat__close { border: 0; background: none; color: #52525b; cursor: pointer; padding: 4px; line-height: 0; }
.ig-chat__close:hover { color: #d4d4d8; }

.ig-chat__msgs {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
  max-height: min(40dvh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---- balões ---- */
@keyframes ig-bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.ig-bubble { animation: ig-bubble-in 0.22s ease forwards; opacity: 0; }

.ig-bubble__bot { display: flex; align-items: flex-end; gap: 8px; }
.ig-bubble__bot .ig-bubble__txt {
  max-width: 82%;
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 14px 14px 14px 4px;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1.45;
  color: #e4e4e7;
}

.ig-bubble__me { display: flex; justify-content: flex-end; }
.ig-bubble__me .ig-bubble__txt {
  max-width: 82%;
  background: hsl(var(--primary));
  border-radius: 14px 14px 4px 14px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: #fff;
}

.ig-bubble__pic {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: hsl(var(--primary) / 0.14);
  border: 1px solid hsl(var(--primary) / 0.2);
  overflow: hidden;
  flex: none;
}
.ig-bubble__pic img { width: 100%; height: 100%; object-fit: cover; }

/* ---- "digitando" ---- */
@keyframes ig-typing { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.35; } 40% { transform: scale(1); opacity: 1; } }
.ig-typing { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: #a1a1aa; animation: ig-typing 1.2s ease-in-out infinite; }
.ig-typing:nth-child(2) { animation-delay: 0.15s; }
.ig-typing:nth-child(3) { animation-delay: 0.3s; }

/* ---- opções ---- */
@keyframes ig-chips-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ig-chips { display: flex; flex-direction: column; gap: 6px; animation: ig-chips-in 0.28s ease forwards; }

.ig-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: rgb(255 255 255 / 0.68);
  background: rgb(255 255 255 / 0.04);
  border: 1px solid rgb(255 255 255 / 0.08);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.ig-chip svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: hsl(var(--primary));
}

.ig-chat__cta svg { width: 15px; height: 15px; flex: none; }

.ig-chip:hover {
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  border-color: var(--primary-border);
  transform: translateX(3px);
}

.ig-chat__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 11px;
  background: #5865f2;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 14px;
  text-decoration: none;
}
.ig-chat__cta:hover { filter: brightness(1.12); }
.ig-chat__cta--sac { background: hsl(var(--primary)); }

.ig-chat__back {
  align-self: flex-start;
  border: 0;
  background: none;
  color: rgb(255 255 255 / 0.3);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
}
.ig-chat__back:hover { color: rgb(255 255 255 / 0.65); }

@media (max-width: 620px) {
  .ig-mascot { right: 8px; bottom: 92px; }
  .ig-mascot img { height: 108px; }
  .ig-chat { bottom: 178px; right: 10px; left: 10px; max-height: calc(100dvh - 210px); }
}

@media (prefers-reduced-motion: reduce) {
  .ig-mascot img, .ig-chat__card, .ig-bubble, .ig-chips, .ig-typing { animation: none !important; transition: none !important; }
}