/* Gooto — WebRTC Chat & Presence Indicator */

/* ─── Presence Badge ────────────────────────────────────────────────── */
.bia-presence-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  user-select: none;
  /* Acompanha a face frontal no flip 3D — desaparece quando o card é virado */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: opacity 0.18s ease;
}

/* Quando o card está virado (verso visível), oculta o badge para não sobrepor os botões de ação */
.bia-result-card.is-flipped .bia-presence-badge,
.bia-card.is-flipped .bia-presence-badge {
  opacity: 0;
  visibility: hidden;
}
.bia-presence-badge .bia-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.bia-presence-badge.is-online {
  color: #047857;
  background: rgba(220, 252, 231, 0.95);
}
.bia-presence-badge.is-online .bia-presence-dot {
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: bia-pulse 2s infinite;
}
.bia-presence-badge.is-offline {
  color: #6b7280;
  background: rgba(243, 244, 246, 0.95);
}
.bia-presence-badge.is-offline .bia-presence-dot {
  background: #9ca3af;
}
@keyframes bia-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(16, 185, 129, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(16, 185, 129, 0);   }
}

/* No template single-provider, alguns containers já são display:flex/grid sem posicionamento — força posicionamento */
.bia-provider-single { position: relative; }

/* ─── Chat Button (template) ────────────────────────────────────────── */
.bia-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff !important;
  border: none;
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-decoration: none;
}
.bia-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.32);
}

/* ─── Realtime Chat Widget ──────────────────────────────────────────── */
.bia-rt-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: inherit;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.bia-rt-widget--hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

.bia-rt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  gap: 8px;
}
.bia-rt-head-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bia-rt-status-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: #10b981;
  flex-shrink: 0;
}
.bia-rt-title {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bia-rt-status-text {
  font-size: 0.78rem;
  opacity: 0.85;
}
.bia-rt-head-actions { display: flex; gap: 6px; }

.bia-rt-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.bia-rt-btn:hover { background: rgba(255,255,255,0.32); }
.bia-rt-btn-call,
.bia-rt-btn-close { padding: 6px 10px; }

.bia-rt-incoming,
.bia-rt-call {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  font-size: 0.85rem;
  color: #78350f;
}
.bia-rt-call { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.bia-rt-incoming .bia-rt-btn,
.bia-rt-call .bia-rt-btn {
  background: rgba(0,0,0,0.06);
  color: inherit;
  margin-left: auto;
}
.bia-rt-incoming .bia-rt-btn-accept { background: #10b981; color: #fff; margin-left: 0; }
.bia-rt-incoming .bia-rt-btn-decline { background: #ef4444; color: #fff; }
.bia-rt-call .bia-rt-btn-hangup { background: #ef4444; color: #fff; }

.bia-rt-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f9fafb;
}
.bia-rt-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 2px;
  word-wrap: break-word;
}
.bia-rt-msg.is-mine {
  align-self: flex-end;
  background: #4f46e5;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bia-rt-msg.is-them {
  align-self: flex-start;
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.bia-rt-msg-text { white-space: pre-wrap; }
.bia-rt-msg-time {
  font-size: 0.68rem;
  opacity: 0.65;
  align-self: flex-end;
}

.bia-rt-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.bia-rt-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-family: inherit;
}
.bia-rt-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}
.bia-rt-btn-send {
  background: #4f46e5;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
}
.bia-rt-btn-send:hover { background: #4338ca; }

@media (max-width: 480px) {
  .bia-rt-widget {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: 70vh;
  }
}
