/* ========================================
   ASSISTENTE VIRTUAL DA NATACHA — Chat Widget
   Fase 1: Árvore de botões, sem IA
   ======================================== */

/* ===== Botão flutuante (canto inferior esquerdo) ===== */
.nv-chat-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 998;
  box-shadow: 0 4px 20px rgba(255, 8, 79, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  animation: nvChatPulse 2.5s infinite;
}

.nv-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 30px rgba(255, 8, 79, 0.5);
  animation: none;
}

.nv-chat-toggle.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

@keyframes nvChatPulse {
  0%   { box-shadow: 0 4px 20px rgba(255, 8, 79, 0.4); }
  50%  { box-shadow: 0 4px 20px rgba(255, 8, 79, 0.4), 0 0 0 12px rgba(255, 8, 79, 0.15); }
  100% { box-shadow: 0 4px 20px rgba(255, 8, 79, 0.4); }
}

/* Badge "1" que aparece na abertura automática */
.nv-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: white;
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-primary);
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition);
}

.nv-chat-toggle.has-notification .nv-chat-badge {
  opacity: 1;
  transform: scale(1);
}

/* ===== Janela do chat ===== */
.nv-chat-window {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 60px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.5) translateY(40px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom left;
  transition: all var(--transition);
  font-family: var(--font-heading);
}

.nv-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ===== Cabeçalho ===== */
.nv-chat-header {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
  color: white;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.nv-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nv-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}

.nv-chat-title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nv-chat-status {
  font-size: 0.7rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.nv-chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25);
}

.nv-chat-actions {
  display: flex;
  gap: 6px;
}

.nv-chat-actions button {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: background var(--transition);
}

.nv-chat-actions button:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Corpo das mensagens ===== */
.nv-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.nv-chat-body::-webkit-scrollbar {
  width: 6px;
}

.nv-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

/* ===== Bolhas de mensagem ===== */
.nv-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: nvMsgIn 0.3s ease;
}

@keyframes nvMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nv-msg-bot {
  align-self: flex-start;
}

.nv-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.nv-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  align-self: flex-end;
}

.nv-msg-user .nv-msg-avatar {
  background: var(--color-primary);
}

.nv-msg-bubble {
  background: white;
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.nv-msg-user .nv-msg-bubble {
  background: var(--color-primary);
  color: white;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

.nv-msg-time {
  font-size: 0.68rem;
  color: #999;
  margin-top: 4px;
}

/* ===== Indicador "a escrever..." ===== */
.nv-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.nv-typing span {
  width: 7px;
  height: 7px;
  background: #bbb;
  border-radius: 50%;
  animation: nvTyping 1.2s infinite ease-in-out;
}

.nv-typing span:nth-child(2) { animation-delay: 0.15s; }
.nv-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes nvTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ===== Zona dos botões de opção ===== */
.nv-chat-options {
  padding: 10px 14px 14px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.nv-chat-options button {
  background: white;
  border: 1.5px solid rgba(2, 57, 99, 0.15);
  color: var(--color-navy);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nv-chat-options button:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  transform: translateX(2px);
}

.nv-chat-options button .nv-opt-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Botão "Voltar" — estilo mais discreto */
.nv-chat-options button.nv-opt-back {
  background: transparent;
  border: none;
  color: #999;
  font-size: 0.8rem;
  justify-content: center;
  padding: 6px;
}

.nv-chat-options button.nv-opt-back:hover {
  color: var(--color-navy);
  background: transparent;
  transform: none;
}

/* ===== Rodapé (branding + legal) ===== */
.nv-chat-footer {
  padding: 8px 14px;
  background: white;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.7rem;
  color: #999;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.nv-chat-footer a {
  color: #666;
  text-decoration: none;
  transition: color var(--transition);
}

.nv-chat-footer a:hover {
  color: var(--color-primary);
}

.nv-chat-footer .nv-brand-mark {
  color: var(--color-primary);
  font-weight: 700;
}

/* ===== Filtro de imóveis (aplicado pelo chatbot) ===== */
.property-card.nv-hidden {
  display: none !important;
}

.nv-filter-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 28px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(2, 57, 99, 0.2);
  animation: nvFilterIn 0.4s ease;
  flex-wrap: wrap;
}

@keyframes nvFilterIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nv-filter-banner i {
  color: var(--color-primary);
  font-size: 1rem;
}

.nv-filter-banner .nv-filter-label {
  font-weight: 600;
}

.nv-filter-banner .nv-filter-label strong {
  color: #ffd9e5;
}

.nv-filter-banner button {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 50px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.nv-filter-banner button:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .nv-chat-toggle {
    bottom: 20px;
    left: 20px;
    width: 54px;
    height: 54px;
    font-size: 1.4rem;
  }

  .nv-chat-window {
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    height: calc(100vh - 100px);
    max-height: 600px;
  }
}
