/* ── FLOATING BUTTON ─────────────────────────────────────────────────── */
#gm-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(0,136,176,.50);
  transition: transform .2s, box-shadow .2s, background .2s;
}
#gm-chat-btn:hover {
  transform: scale(1.09);
  box-shadow: 0 6px 28px rgba(0,136,176,.60);
  background: var(--color-accent-600);
}
#gm-chat-btn.is-open { background: var(--color-accent-800); }

#gm-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #e53e3e;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  transition: opacity .2s, transform .2s;
}
#gm-chat-badge.hidden {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* ── CHAT WINDOW ─────────────────────────────────────────────────────── */
#gm-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9997;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 48px rgba(0,0,0,.20);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.95);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#gm-chat-window.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#gm-chat-header {
  background: var(--color-accent-900);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#gm-chat-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}
#gm-chat-avatar {
  position: relative;
  flex-shrink: 0;
}
#gm-chat-avatar img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.22);
  display: block;
}
.gm-chat-online {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #48bb78;
  border-radius: 50%;
  border: 2px solid var(--color-accent-900);
}
#gm-chat-header-text strong {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: system-ui, sans-serif;
  line-height: 1.2;
}
#gm-chat-header-text small {
  color: var(--color-accent-300);
  font-size: 12px;
  font-family: system-ui, sans-serif;
}
#gm-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  line-height: 1;
}
#gm-chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
}

/* Messages area */
#gm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Bubbles */
.gm-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  font-family: system-ui, sans-serif;
  word-break: break-word;
  animation: gm-fade-in .18s ease;
}
@keyframes gm-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gm-msg-bot {
  background: #f0f2f5;
  color: #1c1c2e;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}
.gm-msg-user {
  background: var(--color-accent);
  color: #fff;
  border-bottom-right-radius: 3px;
  align-self: flex-end;
}

/* Typing indicator */
.gm-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f0f2f5;
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}
.gm-typing span {
  width: 7px;
  height: 7px;
  background: #adb5bd;
  border-radius: 50%;
  animation: gm-bounce 1.2s infinite ease-in-out;
}
.gm-typing span:nth-child(2) { animation-delay: .2s; }
.gm-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes gm-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-7px); }
}

/* Option buttons */
.gm-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  max-width: 100%;
  animation: gm-fade-in .2s ease;
}
.gm-opt-btn {
  background: #fff;
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent-700);
  border-radius: 20px;
  padding: 6px 15px;
  font-size: 13px;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.gm-opt-btn:hover { background: var(--color-accent); color: #fff; }
.gm-opt-btn:disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}

/* Action buttons (CTA links) */
.gm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  width: 230px;
  animation: gm-fade-in .2s ease;
}
.gm-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: system-ui, sans-serif;
  border: none;
  transition: opacity .15s, transform .15s;
}
.gm-action-btn:hover { opacity: .88; transform: translateY(-1px); }
.gm-action-btn--accent    { background: var(--color-accent); color: #fff; }
.gm-action-btn--whatsapp  { background: #25d366; color: #fff; }
.gm-action-btn--outline   { background: transparent; border: 1.5px solid var(--color-accent); color: var(--color-accent-700); }

/* Footer / input */
#gm-chat-footer {
  border-top: 1px solid #e8eaed;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}
#gm-chat-input {
  flex: 1;
  border: 1.5px solid #e0e4e8;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: system-ui, sans-serif;
  outline: none;
  transition: border-color .15s, background .15s;
  background: #f8f9fa;
}
#gm-chat-input:focus   { border-color: var(--color-accent); background: #fff; }
#gm-chat-input:disabled { opacity: .5; cursor: default; }
#gm-chat-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .15s;
}
#gm-chat-send:hover    { background: var(--color-accent-600); }
#gm-chat-send:disabled { opacity: .4; cursor: default; }

/* Cards de imóveis no chat */
.gm-imoveis-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 8px;
}
.gm-imovel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s;
}
.gm-imovel-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.gm-imovel-thumb {
  width: 72px;
  height: 60px;
  object-fit: cover;
  flex-shrink: 0;
}
.gm-imovel-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #9ca3af;
  font-size: 24px;
}
.gm-imovel-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px 6px 0;
  min-width: 0;
}
.gm-imovel-title {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gm-imovel-detalhe {
  font-size: 11px;
  color: #6b7280;
}
.gm-imovel-preco {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent, #b8942e);
}

/* Mobile */
@media (max-width: 600px) {
  #gm-chat-window {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 86px;
    max-height: 70dvh;
  }
  #gm-chat-btn {
    right: 16px;
    bottom: 18px;
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
}
