/* ===== VOGA CHAT WIDGET ===== */

.chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
  padding: 0;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,.28); }
.chat-fab.open { background: #fff; overflow: visible; }
.chat-fab.dragging { cursor: grabbing !important; transform: scale(1.06); }
.chat-fab svg { color: #000; transition: opacity .2s; }
.chat-fab .chat-fab-close { display: none; }
.chat-fab.open .chat-fab-icon { display: none; }
.chat-fab.open .chat-fab-close { display: block; }

/* Mascote no FAB */
.chat-fab-mascot {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-fab-mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 10%;
  display: block;
}

/* Avatar do mascote nas mensagens e header */
.chat-mascot-avatar {
  background: transparent !important;
  padding: 0 !important;
  overflow: hidden;
}
.chat-mascot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 50%;
  display: block;
}

.chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg);
  font-size: .6rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== JANELA ===== */

.chat-window {
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  z-index: 899;
  width: min(380px, calc(100vw - 2rem));
  height: min(540px, calc(100dvh - 8rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.20);
  transform: scale(.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  overflow: hidden;
}
.chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-avatar svg { color: #fff; }
.chat-header-info { flex: 1; }
.chat-header-name { font-size: .88rem; font-weight: 700; color: #fff; }
.chat-header-status {
  font-size: .72rem;
  color: rgba(255,255,255,.65);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.chat-header-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}
.chat-header-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.6);
  padding: .25rem;
  border-radius: 6px;
  transition: color .15s;
}
.chat-header-close:hover { color: #fff; }

/* Mensagens */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  animation: chatMsgIn .22s ease;
}
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-bot { justify-content: flex-start; }
.chat-msg-user { justify-content: flex-end; }

.chat-msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #052e16, #064e3b);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-msg-avatar svg { color: #fff; }

.chat-bubble {
  max-width: 78%;
  padding: .6rem .85rem;
  border-radius: 16px;
  font-size: .85rem;
  line-height: 1.55;
}
.chat-msg-bot .chat-bubble {
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg-user .chat-bubble {
  background: var(--green);
  color: #000;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing .chat-bubble {
  padding: .65rem .85rem;
  display: flex;
  gap: 4px;
  align-items: center;
}
.chat-typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-sec);
  animation: typingBounce 1.2s infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: .2s; }
.chat-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* Quick replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .5rem 1rem;
  flex-shrink: 0;
}
.chat-quick-btn {
  padding: .4rem .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .78rem;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.chat-quick-btn:hover {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

/* Input */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .55rem 1rem;
  font-size: .85rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.chat-input:focus { border-color: var(--green); }
.chat-input::placeholder { color: var(--text-sec); }
.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
  flex-shrink: 0;
}
.chat-send-btn:hover { opacity: .85; }
.chat-send-btn svg { color: #000; }
