/* ---------- Conversas — visual estilo Instagram Direct (tema claro) ----------
   Cores de fidelidade ao IG (literais de propósito):
   #3797f0 = azul dos balões/ações do Direct · #efefef = cinza dos balões recebidos.
   Regra do projeto: ZERO box-shadow (elevação = borda + tonalidade). */

/* Layout: lista um pouco mais larga, como no Direct web */
.chat-layout { grid-template-columns: 350px minmax(0, 1fr); }
.chat-layout__list { overflow: hidden; display: flex; flex-direction: column; }

/* ---------- Painel esquerdo ---------- */
.dm-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #fff; }

.dm-panel__account { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; }
.dm-panel__username { font-weight: 700; font-size: 15.5px; }

/* Busca: pílula cinza com lupa discreta */
.dm-search { padding: 0 16px 4px; }
.dm-search__pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 8px 14px;
}
.dm-search__pill:focus-within { border-color: var(--border-strong); }
.dm-search__icon { font-size: 12.5px; line-height: 1; opacity: .5; }
.dm-search__input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 14px; color: var(--text);
}
.dm-search__input::placeholder { color: var(--text-3); }
.dm-search__input:focus-visible { outline: none; }

/* Label "Mensagens" + contagem de não lidas */
.dm-panel__label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px 6px;
  font-weight: 700; font-size: 16px;
}
.dm-panel__count { font-size: 12.5px; font-weight: 700; color: #3797f0; } /* azul IG */

.dm-panel__items { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.dm-panel__empty { padding: 28px 16px; text-align: center; font-size: 13.5px; color: var(--text-2); }

/* Itens da lista: avatar grande, nome + prévia, ponto azul de não lida */
.conv-item { padding: 8px 16px; gap: 12px; border-bottom: 0; }
.conv-item--active { background: var(--surface-2); }
.conv-item__name {
  font-weight: 500; font-size: 14px;
  display: flex; align-items: center; gap: 5px; min-width: 0;
}
.conv-item__name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item__last { font-size: 13px; color: var(--text-2); }
.conv-item__time { color: var(--text-3); font-weight: 400; }
.conv-item--unread .conv-item__name { font-weight: 700; }
.conv-item--unread .conv-item__last { color: var(--text); font-weight: 600; }
.conv-item__dot { width: 8px; height: 8px; border-radius: 50%; background: #3797f0; flex: none; } /* azul IG */

/* Micro-indicadores no nome (bot/você/humano) e janela fechada */
.conv-icon { font-size: 12px; line-height: 1; opacity: .85; flex: none; cursor: help; }
.conv-window-dot { font-size: 11px; line-height: 1; opacity: .7; flex: none; cursor: help; }

/* ---------- Cabeçalho da conversa aberta ---------- */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.chat-header__id { flex: 1; min-width: 0; }
.chat-header__name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.chat-header__handle { font-size: 12.5px; color: var(--text-2); }
.chat-header__actions {
  flex: none;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap;
}

/* Banners dentro da coluna da conversa */
.chat-banner { margin: 12px 16px 0; }

/* ---------- Mensagens ---------- */
.chat-msgs { background: #fff; gap: 3px; padding: 20px 16px; }
.chat-msgs .dm-bubble { border-radius: 22px; padding: 9px 14px; font-size: 14px; max-width: 68%; }
.chat-msgs .dm-bubble--in { background: #efefef; color: var(--text); } /* cinza IG */
.chat-msgs .dm-bubble--out,
.chat-msgs .dm-bubble--human { background: #3797f0; color: #fff; }    /* azul IG (bot e humano) */

/* Grupo recebido: avatar pequeno só na última bolha (como no IG) */
.dm-row { align-self: flex-start; display: flex; align-items: flex-end; gap: 8px; max-width: 68%; }
.dm-row .dm-bubble { max-width: 100%; }
.dm-row__spacer { width: 28px; flex: none; }

/* Divisor de dia e rótulos de remetente */
.chat-msgs .dm-meta { margin: 10px 0 2px; }
.dm-meta--day { font-size: 11px; }
.dm-meta--start { align-self: flex-start; }
.dm-meta--end { align-self: flex-end; }

/* Opções rápidas do bot: chips com borda azul IG */
.chat-msgs .dm-chips { margin: 4px 0 4px 36px; }
.chat-msgs .dm-chip { border-color: #3797f0; color: #3797f0; }

/* Botão de link dentro das bolhas */
.chat-msgs .dm-link-btn { border-radius: var(--r-full); }
.chat-msgs .dm-bubble--in .dm-link-btn { background: #fff; border-color: var(--border-strong); color: #3797f0; }

/* Conversa aberta sem mensagens */
.chat-msgs__hint { margin: auto; color: var(--text-3); font-size: 13px; text-align: center; }

/* ---------- Composer (pílula com enviar dentro da linha) ---------- */
.chat-composer { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.chat-composer__note { margin: 0; font-size: 11.5px; color: var(--text-3); }
.chat-composer__pill {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  padding: 4px 6px 4px 16px;
  background: #fff;
}
.chat-composer__pill:focus-within { border-color: #3797f0; } /* azul IG */
.chat-composer__input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 14px; color: var(--text);
  padding: 6px 0;
}
.chat-composer__input::placeholder { color: var(--text-3); }
.chat-composer__input:focus-visible { outline: none; }
.chat-composer__pill .btn--text { color: #3797f0; } /* azul IG */

/* ---------- Coluna principal vazia (index) — "Suas mensagens" ---------- */
.chat-main-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 40px 20px;
  text-align: center;
  background: #fff;
}
.chat-main-empty__icon {
  width: 96px; height: 96px; flex: none;
  border: 2px solid var(--text);
  border-radius: 50%;
  display: grid; place-items: center;
}
.chat-main-empty__icon svg { width: 44px; height: 44px; color: var(--text); }
.chat-main-empty h3 { margin: 0; font-size: 20px; font-weight: 400; }
.chat-main-empty__sub { margin: 0; font-size: 13px; color: var(--text-2); }
@media (max-width: 900px) { .chat-main-empty { display: none; } }

/* ---------- Janela de 24h da Meta ---------- */

/* Badge discreta (verde = aberta, cinza = fechada) */
.window-badge {
  font-size: 11px;
  padding: 2px 8px;
  cursor: help;
  white-space: nowrap;
}

/* Banner que substitui o composer quando a janela fecha (conta real) */
.chat-banner--composer { margin: 12px 16px 16px; }

/* Dica da janela gratuita sob o composer */
.chat-window-hint {
  margin: 6px 4px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.chat-window-hint strong { color: var(--green-strong); }
