/* ============================================================
   NIARUX — chat-automensaje.css
   Widget de chat animado para index.php
   Estilo extraído de marketing-chatbot/styles.css
   No interfiere con los estilos globales de la web.
   ============================================================ */

/* ── VARIABLES PROPIAS (aisladas, no tocan el :root global) ── */
.nx-chat-widget {
  --nxc-dark:     #020408;
  --nxc-card:     #050d1a;
  --nxc-header:   #060f1e;
  --nxc-border:   rgba(0, 229, 255, 0.10);
  --nxc-accent:   #00e5ff;
  --nxc-accent2:  #0891b2;
  --nxc-green:    #22c55e;
  --nxc-text:     #e2e8f0;
  --nxc-muted:    #64748b;
  --nxc-shadow:   0 25px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 229, 255, 0.06);

  /* Layout */
  background: var(--nxc-card);
  border: 1px solid var(--nxc-border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  height: 420px;
  box-shadow: var(--nxc-shadow);
  font-family: 'DM Sans', 'Plus Jakarta Sans', sans-serif;
  margin: 0 auto;
}

/* ── HEADER ─────────────────────────────────────────────── */
.nx-chat-widget .nx-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  background: var(--nxc-header);
  border-bottom: 1px solid var(--nxc-border);
  flex-shrink: 0;
}

.nx-chat-widget .nx-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--nxc-accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.nx-chat-widget .nx-chat-info {
  display: flex;
  flex-direction: column;
}

.nx-chat-widget .nx-chat-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--nxc-text);
  line-height: 1.2;
}

.nx-chat-widget .nx-chat-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--nxc-green);
  margin-top: 2px;
}

.nx-chat-widget .nx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nxc-green);
  display: inline-block;
  animation: nxc-pulse 2s infinite;
}

@keyframes nxc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.5); }
}

/* ── BODY / MENSAJES ────────────────────────────────────── */
.nx-chat-widget .nx-chat-body {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--nxc-dark);
  scrollbar-width: none;
}
.nx-chat-widget .nx-chat-body::-webkit-scrollbar { display: none; }

/* Burbuja genérica */
.nx-chat-widget .nx-msg {
  max-width: 82%;
  padding: 0.65rem 0.95rem;
  font-size: 0.83rem;
  line-height: 1.55;
  animation: nxc-fadeUp 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
}

/* Bot */
.nx-chat-widget .nx-msg.bot {
  background: rgba(0, 229, 255, 0.07);
  border: 1px solid rgba(0, 229, 255, 0.12);
  color: var(--nxc-text);
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
}

/* Usuario */
.nx-chat-widget .nx-msg.user {
  background: linear-gradient(135deg, var(--nxc-accent), var(--nxc-accent2));
  color: #050810;
  font-weight: 600;
  border-radius: 14px 4px 14px 14px;
  align-self: flex-end;
}

/* Typing indicator */
.nx-chat-widget .nx-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0.7rem 1rem;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.10);
  border-radius: 4px 14px 14px 14px;
  align-self: flex-start;
  width: fit-content;
}

.nx-chat-widget .nx-typing span {
  width: 7px;
  height: 7px;
  background: var(--nxc-accent);
  border-radius: 50%;
  animation: nxc-bounce 1.3s ease-in-out infinite;
  opacity: 0.7;
}
.nx-chat-widget .nx-typing span:nth-child(2) { animation-delay: 0.18s; }
.nx-chat-widget .nx-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes nxc-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.7; }
  30%           { transform: translateY(-7px); opacity: 1;   }
}

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

/* ── FOOTER / INPUT ─────────────────────────────────────── */
.nx-chat-widget .nx-chat-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--nxc-border);
  flex-shrink: 0;
}

.nx-chat-widget .nx-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--nxc-border);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  color: var(--nxc-text);
  font-size: 0.82rem;
  outline: none;
  cursor: default;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}
.nx-chat-widget .nx-chat-input:focus {
  border-color: rgba(0, 229, 255, 0.3);
}
/* Texto visible mientras el JS escribe en el input */
.nx-chat-widget .nx-chat-input.typing-active {
  color: var(--nxc-text);
  border-color: rgba(0, 229, 255, 0.25);
}

.nx-chat-widget .nx-chat-send {
  background: var(--nxc-accent);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #050810;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nx-chat-widget .nx-chat-send:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.4);
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .nx-chat-widget {
    height: 380px;
    border-radius: 16px;
  }
  .nx-chat-widget .nx-msg {
    font-size: 0.8rem;
  }
}