/* ── Contenedor General del Chat ─────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #efeae2; /* Fondo cálido estilo chat */
  position: relative;
}

.chat-header {
  padding: 10px 16px;
  background-color: #f0f2f5;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #d1d5db;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-contact-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.chat-contact-status {
  font-size: 0.72rem;
  color: var(--color-tertiary-hover);
  font-weight: 600;
}

/* ── Historial de Mensajes (Scrollable) ────────────────────────────────────── */
.chat-messages {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

/* Mensajes Entrantes (Cliente) */
.bubble-incoming {
  align-self: flex-start;
  background-color: #ffffff;
  color: var(--text-main);
  border-top-left-radius: 2px;
}

/* Mensajes Salientes (Asesor) - Verde suave tipo WhatsApp */
.bubble-outgoing {
  align-self: flex-end;
  background-color: #E7F8D8;
  border: 1px solid #C5E8A6;
  color: #1e293b;
  border-top-right-radius: 2px;
}

/* Etiqueta interna de remitente (visible solo en CRM) */
.bubble-sender-tag {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 4px;
  border-bottom: 1px dashed rgba(22, 101, 52, 0.25);
  padding-bottom: 2px;
}

/* Adjuntos multimedia en chat */
.chat-media-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  display: block;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.08);
  object-fit: cover;
}

.chat-media-video {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  display: block;
  margin-bottom: 6px;
  border: 1px solid rgba(0,0,0,0.08);
}

.chat-media-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #1e293b;
  margin-bottom: 6px;
  font-size: 0.82rem;
  transition: background 0.15s ease;
}

.chat-media-doc:hover {
  background: rgba(0, 0, 0, 0.09);
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.bubble-outgoing .check-double {
  color: var(--color-tertiary); /* Doble check verde agro */
}

/* ── Barra de Redacción (Composer) ────────────────────────────────────────── */
.chat-composer {
  padding: 10px 14px;
  background-color: #f0f2f5;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-chat-clip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-chat-clip:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

.chat-input {
  flex: 1;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 0.86rem;
  max-height: 100px;
  min-height: 38px;
  resize: none;
  line-height: 1.35;
}

.chat-input:focus {
  border-color: var(--color-tertiary);
  box-shadow: 0 0 0 2px rgba(151, 189, 51, 0.2);
}

.btn-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--color-tertiary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn-chat-send:hover {
  background-color: var(--color-tertiary-hover);
}

