/* ═══════════════════════════════════════════════════════════════════════
   InmoBot — Chat oscuro estilo WhatsApp (chat.html)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --chat-bg:        #0c1512;
  --chat-panel:     #14231e;
  --chat-header:    #182b25;
  --chat-burbuja-bot:  #1d322b;
  --chat-burbuja-user: #0e7c66;
  --chat-texto:     #e8f0ed;
  --chat-muted:     #8aa39b;
  --chat-borde:     #24382f;
  --chat-acento:    #21c063;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--chat-bg);
  color: var(--chat-texto);
}
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

.chat-app {
  height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 20%, rgba(14,124,102,.08), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(14,124,102,.06), transparent 40%),
    var(--chat-bg);
  border-left: 1px solid var(--chat-borde);
  border-right: 1px solid var(--chat-borde);
}

/* ─── Header ───────────────────────────────────────────────────────────── */
.chat-header {
  background: var(--chat-header);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--chat-borde);
  flex-shrink: 0;
}
.btn-volver {
  color: var(--chat-muted);
  font-size: 1.3rem;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all .15s ease;
}
.btn-volver:hover { background: rgba(255,255,255,.08); color: #fff; }
.bot-avatar {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #0e7c66, #21c063);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.bot-info { flex: 1; }
.bot-nombre { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.bot-badge {
  background: rgba(33,192,99,.18);
  color: var(--chat-acento);
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 50px;
  letter-spacing: .05em;
}
.bot-estado { font-size: .74rem; color: var(--chat-muted); display: flex; align-items: center; gap: 5px; }
.dot-online {
  width: 7px; height: 7px;
  background: var(--chat-acento);
  border-radius: 50%;
  display: inline-block;
}
.btn-header-chat {
  font-size: 1.05rem;
  padding: 8px;
  border-radius: 8px;
  transition: background .15s ease;
}
.btn-header-chat:hover { background: rgba(255,255,255,.08); }

/* ─── Mensajes ─────────────────────────────────────────────────────────── */
.chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.msg-fecha {
  align-self: center;
  background: rgba(255,255,255,.06);
  color: var(--chat-muted);
  font-size: .7rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 50px;
  margin-bottom: 6px;
}
.msg { display: flex; max-width: 78%; animation: msgEntra .22s ease; }
@keyframes msgEntra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg-bot  { align-self: flex-start; }
.msg-user { align-self: flex-end; }
.msg-burbuja {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg-bot .msg-burbuja {
  background: var(--chat-burbuja-bot);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--chat-borde);
}
.msg-user .msg-burbuja {
  background: var(--chat-burbuja-user);
  border-bottom-right-radius: 4px;
  color: #fff;
}
.msg-hora {
  display: block;
  font-size: .64rem;
  color: rgba(255,255,255,.45);
  text-align: right;
  margin-top: 5px;
}
.folio-destacado {
  display: inline-block;
  background: rgba(33,192,99,.16);
  color: var(--chat-acento);
  font-family: 'Consolas', monospace;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 6px;
}
.msg-error .msg-burbuja {
  background: rgba(239,68,68,.14);
  border: 1px solid rgba(239,68,68,.4);
}

/* Chips de sugerencias */
.chips-sugerencias {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 10px;
}
.chip {
  background: rgba(14,124,102,.14);
  border: 1px solid rgba(14,124,102,.5);
  color: #7fd8c4;
  font-size: .8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 50px;
  transition: all .15s ease;
}
.chip:hover { background: rgba(14,124,102,.3); color: #fff; transform: translateY(-1px); }

/* ─── Typing ───────────────────────────────────────────────────────────── */
.typing-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 10px;
  flex-shrink: 0;
}
.typing-burbuja {
  background: var(--chat-burbuja-bot);
  border: 1px solid var(--chat-borde);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--chat-muted);
  border-radius: 50%;
  animation: typingAnim 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes typingAnim {
  0%, 60%, 100% { transform: none; opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}
.typing-label { font-size: .74rem; color: var(--chat-muted); font-style: italic; }

/* ─── Input ────────────────────────────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 16px;
  background: var(--chat-header);
  border-top: 1px solid var(--chat-borde);
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  background: var(--chat-panel);
  border: 1px solid var(--chat-borde);
  border-radius: 14px;
  color: var(--chat-texto);
  font-family: inherit;
  font-size: .92rem;
  padding: 12px 15px;
  resize: none;
  max-height: 130px;
  line-height: 1.45;
}
#chat-input:focus { outline: none; border-color: var(--chat-burbuja-user); }
#chat-input::placeholder { color: var(--chat-muted); }
#btn-enviar-chat {
  width: 46px; height: 46px;
  background: var(--chat-burbuja-user);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: all .15s ease;
  flex-shrink: 0;
}
#btn-enviar-chat svg { width: 20px; height: 20px; margin-left: 2px; }
#btn-enviar-chat:hover { background: #12987e; transform: scale(1.05); }
#btn-enviar-chat:disabled { opacity: .5; cursor: wait; transform: none; }

/* Scrollbar */
.chat-mensajes::-webkit-scrollbar { width: 8px; }
.chat-mensajes::-webkit-scrollbar-thumb { background: var(--chat-borde); border-radius: 4px; }

@media (max-width: 640px) {
  .msg { max-width: 88%; }
  .chat-app { border: none; }
}
