/* ============================================================
   chat.css — Painel lateral: área de mensagens e input
   ============================================================ */

.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(ellipse 80% 100% at 50% 0%, rgba(201, 168, 76, 0.025) 0%, transparent 60%),
    var(--bg);
}

.chat-day-divider {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--sp-3) 0 var(--sp-1);
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.msg-row.msg-row-advogado { align-self: flex-end; align-items: flex-end; }
.msg-row.msg-row-cliente  { align-self: flex-start; align-items: flex-start; }

.msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 100%;
}

.msg-cliente {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-advogado {
  background: var(--gold-soft);
  border: 1px solid rgba(201, 168, 76, 0.28);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.msg-row-advogado .msg-meta { justify-content: flex-end; }

/* ── Áudio / imagem / documento ── */
.msg-audio audio {
  width: 240px;
  max-width: 100%;
}

.msg-imagem img {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
}

.msg-documento {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}

.msg-doc-icon { font-size: 22px; }
.msg-doc-info { flex: 1; min-width: 0; }
.msg-doc-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-doc-size { font-size: 11px; color: var(--text-muted); }

/* ── Input do chat ── */
.chat-input {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color var(--transition);
}

.chat-input-row textarea:focus { border-color: var(--gold-dim); }

.btn-chat-action {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.btn-chat-action:hover { background: var(--surface3); color: var(--text); }
.btn-chat-action.recording {
  background: rgba(239, 68, 68, 0.15);
  color: var(--etapa-desqualificado);
  border-color: rgba(239, 68, 68, 0.35);
  animation: pulse 1.2s infinite;
}

.btn-send {
  background: var(--gold);
  color: #0f0e0c;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.btn-send:hover    { opacity: 0.88; }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.chat-recording-indicator {
  font-size: 12px;
  color: var(--etapa-desqualificado);
  text-align: center;
  padding: 4px;
}

/* ── Preview de imagem antes do envio ── */
.chat-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chat-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.chat-preview-info { flex: 1; min-width: 0; }
.chat-preview-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-preview-size { font-size: 11px; color: var(--text-muted); }

.btn-remove-preview {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
