/* === Dumont Web Chatbot Widget — independente de Tailwind === */

#dw-chat-btn,
#dw-chat-panel,
#dw-chat-panel * {
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === Botão flutuante (acima do WhatsApp FAB existente) === */
#dw-chat-btn {
  position: fixed;
  right: 1.5rem;
  bottom: 6.25rem; /* 100px — empilhado acima do WhatsApp FAB que fica em ~24px */
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border: 0;
  cursor: pointer;
  z-index: 99998;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124,58,237,.45), 0 0 0 4px rgba(124,58,237,.18);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: dwChatFloat 4s ease-in-out infinite;
}
#dw-chat-btn:hover { transform: scale(1.08); box-shadow: 0 12px 32px rgba(124,58,237,.6); }
#dw-chat-btn svg { width: 28px; height: 28px; }
#dw-chat-btn .dw-bubble-x { display: none; }
#dw-chat-btn.is-open .dw-bubble-msg { display: none; }
#dw-chat-btn.is-open .dw-bubble-x { display: block; }
#dw-chat-btn .dw-notif-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  background: #ef4444; color: #fff;
  border-radius: 9999px;
  font-size: 11px; font-weight: 800; line-height: 18px;
  padding: 0 5px;
  display: none;
}
#dw-chat-btn.has-notif .dw-notif-dot { display: block; animation: dwBlink 1.4s ease-in-out infinite; }
@keyframes dwChatFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes dwBlink     { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* === Painel === */
#dw-chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 6.25rem;
  width: 380px; max-width: calc(100vw - 3rem);
  height: 600px; max-height: calc(100vh - 8rem);
  background: #ffffff;
  border-radius: 18px;
  z-index: 99999;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0; transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#dw-chat-panel.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* Mobile: tela cheia */
@media (max-width: 540px) {
  #dw-chat-panel {
    right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #dw-chat-btn { right: 1rem; bottom: 5rem; }
}

/* === Header do painel === */
.dw-chat-header {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  padding: 1rem 1.125rem;
  display: flex; align-items: center; gap: .75rem;
  flex-shrink: 0;
  position: relative;
}
.dw-chat-header .dw-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.05rem;
  flex-shrink: 0;
}
.dw-chat-header .dw-info { flex: 1; min-width: 0; }
.dw-chat-header .dw-info strong { display: block; font-size: .95rem; font-weight: 700; }
.dw-chat-header .dw-info small { font-size: .72rem; color: rgba(255,255,255,.85); display: flex; align-items: center; gap: .35rem; }
.dw-chat-header .dw-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.7); }
.dw-chat-header .dw-actions { display: flex; gap: .25rem; }
.dw-chat-header button {
  background: none; border: 0; cursor: pointer;
  color: rgba(255,255,255,.85);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease;
}
.dw-chat-header button:hover { background: rgba(255,255,255,.15); color: #fff; }
.dw-chat-header button svg { width: 18px; height: 18px; }

.dw-menu {
  position: absolute; top: 56px; right: 12px;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  min-width: 200px; padding: .375rem; z-index: 10;
  display: none;
}
.dw-menu.is-open { display: block; }
.dw-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  padding: .5rem .75rem; border-radius: 6px;
  font-size: .88rem; color: #374151;
}
.dw-menu button:hover { background: #f3f4f6; }
.dw-menu button.danger { color: #dc2626; }
.dw-menu button.danger:hover { background: #fef2f2; }

/* === Banner LGPD === */
.dw-consent {
  background: #fef3c7; padding: .75rem 1rem;
  border-bottom: 1px solid #fde68a;
  font-size: .82rem; color: #92400e;
  display: flex; align-items: flex-start; gap: .5rem;
}
.dw-consent input { margin-top: .15rem; flex-shrink: 0; }
.dw-consent a { color: #92400e; text-decoration: underline; font-weight: 600; }

/* === Mensagens === */
.dw-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f9fafb;
  display: flex; flex-direction: column; gap: .625rem;
  scroll-behavior: smooth;
}
.dw-chat-msgs::-webkit-scrollbar { width: 6px; }
.dw-chat-msgs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.dw-chat-msgs::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.dw-msg {
  max-width: 85%;
  padding: .625rem .875rem;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: dwMsgIn .25s cubic-bezier(.16,1,.3,1);
}
.dw-msg.bot {
  background: #fff;
  color: #1f1d2b;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.dw-msg.user {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.dw-msg.system {
  background: #fef3c7;
  color: #92400e;
  border: 1px dashed #fde68a;
  font-size: .82rem;
  align-self: center;
  text-align: center;
  border-radius: 8px;
}
@keyframes dwMsgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.dw-typing {
  display: inline-flex; gap: 4px;
  padding: .75rem .875rem;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  margin-right: auto;
}
.dw-typing span {
  width: 7px; height: 7px;
  background: #9ca3af; border-radius: 50%;
  animation: dwTyping 1.4s ease-in-out infinite;
}
.dw-typing span:nth-child(2) { animation-delay: .2s; }
.dw-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dwTyping { 0%,80%,100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* === CTA wa quando transferir === */
.dw-cta-wa {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: .5rem;
  padding: .75rem 1.125rem;
  background: linear-gradient(135deg, #25d366, #1ebe57);
  color: #fff !important;
  border-radius: 9999px;
  font-weight: 700;
  text-decoration: none !important;
  align-self: flex-start;
  box-shadow: 0 6px 16px rgba(37,211,102,.35);
  transition: transform .2s ease, box-shadow .2s ease;
  font-size: .92rem;
}
.dw-cta-wa:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(37,211,102,.45); }
.dw-cta-wa svg { width: 18px; height: 18px; fill: currentColor; }

/* === Input === */
.dw-chat-input {
  padding: .75rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
  display: flex; gap: .5rem; align-items: flex-end;
}
.dw-chat-input textarea {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .625rem .75rem;
  resize: none;
  font-family: inherit;
  font-size: .92rem;
  line-height: 1.4;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color .2s ease;
  color: #1f1d2b;
  background: #fff;
}
.dw-chat-input textarea:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
.dw-chat-input textarea:disabled { background: #f3f4f6; cursor: not-allowed; }
.dw-chat-input button {
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  border: 0; border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s, transform .2s;
}
.dw-chat-input button:hover { transform: scale(1.05); }
.dw-chat-input button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.dw-chat-input button svg { width: 18px; height: 18px; }

.dw-chat-input .dw-honey { position: absolute; left: -9999px; top: -9999px; }

.dw-rate-warn {
  background: #fef2f2; color: #991b1b;
  padding: .625rem .875rem;
  font-size: .82rem;
  border-top: 1px solid #fecaca;
}

/* === Rodapé com link política === */
.dw-chat-footer {
  padding: .375rem .75rem;
  font-size: .68rem;
  color: #9ca3af;
  text-align: center;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}
.dw-chat-footer a { color: #6b7280; text-decoration: underline; }
