/* ============================================
   CHAT.CSS — Modal de chat com vendas
   ============================================ */

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, 0.7);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-overlay.visible { opacity: 1; }

.chat-modal {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 380px;
  max-height: 580px;
  background: #0a1018;
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0,245,196,0.08);
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

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

.hidden { display: none !important; }

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 245, 196, 0.04);
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--bg);
  flex-shrink: 0;
}

.chat-status-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0a1018;
  animation: pulse 2.5s infinite;
}

.chat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.chat-status {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-top: 1px;
}

.chat-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.chat-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* Mensagens */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Bolhas */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: slideInUp 0.3s ease both;
}

.msg.incoming { align-self: flex-start; }
.msg.outgoing { align-self: flex-end; }

.msg-bubble {
  padding: 0.7rem 1rem;
  border-radius: 2px;
  font-size: 0.875rem;
  line-height: 1.55;
}

.msg.incoming .msg-bubble {
  background: rgba(0, 245, 196, 0.08);
  border: 1px solid rgba(0, 245, 196, 0.12);
  color: var(--text);
  border-radius: 2px 12px 12px 12px;
}

.msg.outgoing .msg-bubble {
  background: var(--accent);
  color: var(--bg);
  border-radius: 12px 2px 12px 12px;
}

.msg-time {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.25rem;
  padding: 0 0.25rem;
}

.msg.outgoing .msg-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-self: flex-start;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
  background: rgba(0, 245, 196, 0.06);
  border: 1px solid rgba(0, 245, 196, 0.1);
  border-radius: 2px 12px 12px 12px;
  animation: slideInUp 0.3s ease both;
}

.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingDot 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(-4px); }
}

/* Input */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.65rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { border-color: rgba(0, 245, 196, 0.4); }

.chat-send {
  width: 38px; height: 38px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.2s;
  color: var(--bg);
}

.chat-send svg { width: 16px; height: 16px; }
.chat-send:hover { opacity: 0.85; transform: scale(1.05); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Notificação de erro */
.chat-error {
  font-size: 0.75rem;
  color: var(--accent2);
  text-align: center;
  padding: 0.4rem;
  animation: slideInUp 0.3s ease both;
}
