/* ============================================================
   PedidoLink — Widget de Suporte (bolha flutuante + chat)
   Depende de tokens.css (cores --brand, --bg-card, etc).
   ============================================================ */

:root {
  --sup-bubble-size: 56px;
  --sup-panel-w: 380px;
  --sup-panel-h: 560px;
  --sup-radius: 16px;
}

/* Bolha flutuante */
.sup-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: var(--sup-bubble-size);
  height: var(--sup-bubble-size);
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--brand-light, #E85D26), var(--brand, #C8420F));
  color: #fff;
  box-shadow: 0 10px 32px rgba(232,93,38,0.45), 0 2px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sup-bubble:hover  { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(232,93,38,0.55), 0 4px 12px rgba(0,0,0,0.35); }
.sup-bubble:active { transform: translateY(0); }
.sup-bubble svg    { width: 26px; height: 26px; }

.sup-bubble[hidden] { display: none; }

/* Badge "novo" sobre a bolha */
.sup-bubble-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-root, #0a0a12);
}

/* Painel de chat */
.sup-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: var(--sup-panel-w);
  max-width: calc(100vw - 24px);
  height: var(--sup-panel-h);
  max-height: calc(100vh - 110px);
  background: var(--bg-card, #151428);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--sup-radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}
.sup-panel.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Header do painel */
.sup-head {
  background: linear-gradient(135deg, var(--brand, #C8420F), var(--purple, #6B21A8));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sup-head-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sup-head-avatar svg { width: 18px; height: 18px; }
.sup-head-title { font-weight: 600; font-size: 14px; line-height: 1.2; }
.sup-head-sub   { font-size: 12px; opacity: .85; }
.sup-head-close {
  margin-left: auto;
  background: transparent; border: 0; color: #fff;
  cursor: pointer; padding: 6px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sup-head-close:hover { background: rgba(255,255,255,0.15); }
.sup-head-close svg { width: 18px; height: 18px; }

/* Body de mensagens */
.sup-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-root, #0a0a12);
}
.sup-body::-webkit-scrollbar { width: 6px; }
.sup-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: 3px;
}

/* Bolhas de mensagem */
.sup-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.sup-msg-user {
  align-self: flex-end;
  background: var(--brand, #C8420F);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sup-msg-bot {
  align-self: flex-start;
  background: var(--bg-card-2, #1A1930);
  color: var(--text-1, #fff);
  border: 1px solid rgba(255,255,255,.06);
  border-bottom-left-radius: 4px;
}
.sup-msg-system {
  align-self: center;
  background: transparent;
  color: var(--text-3, #8a8aa3);
  font-size: 12px;
  font-style: italic;
  max-width: 95%;
  text-align: center;
}
.sup-msg-meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: .65;
}

/* Bot "digitando" */
.sup-typing {
  align-self: flex-start;
  background: var(--bg-card-2, #1A1930);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 4px;
}
.sup-typing span {
  width: 6px; height: 6px;
  background: rgba(255,255,255,.45);
  border-radius: 50%;
  animation: supDot 1.2s infinite;
}
.sup-typing span:nth-child(2) { animation-delay: .15s; }
.sup-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes supDot {
  0%,80%,100% { transform: translateY(0); opacity: .35; }
  40%         { transform: translateY(-4px); opacity: 1; }
}

/* Banner de "escalei pro humano" */
.sup-escalated {
  align-self: stretch;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.35);
  color: #86efac;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Footer com input */
.sup-foot {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: var(--bg-card, #151428);
  border-top: 1px solid rgba(255,255,255,.06);
}
.sup-input {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  background: var(--bg-card-2, #1A1930);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  color: var(--text-1, #fff);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.sup-input:focus { border-color: var(--brand-light, #E85D26); }

.sup-send {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--brand, #C8420F);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
.sup-send:hover:not(:disabled)  { background: var(--brand-light, #E85D26); }
.sup-send:disabled              { opacity: .5; cursor: not-allowed; }
.sup-send svg                   { width: 18px; height: 18px; }

/* Mobile */
@media (max-width: 480px) {
  .sup-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 80px;
    height: calc(100vh - 100px);
  }
  .sup-bubble {
    right: 14px;
    bottom: 14px;
  }
}
