/* ===== Academia — chat estilo WhatsApp Web ===================================
   Classes usadas exclusivamente em pages/academia.py
   ============================================================================ */

/* Layout dois painéis */
.acad-wa-layout {
  display: flex;
  height: calc(100vh - 100px);
  min-height: 500px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

/* ── Painel esquerdo: lista de atendimentos ── */
.acad-sidebar {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #d1d7db;
}

.acad-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f0f2f5;
  border-bottom: 1px solid #d1d7db;
  flex-shrink: 0;
}

.acad-sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111b21;
}

.acad-sidebar-list {
  flex: 1;
  overflow-y: auto;
}

/* Item de contato */
.acad-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  position: relative;
  transition: background-color 0.1s;
}

.acad-contact-item:hover {
  background-color: #f5f6f6;
}

.acad-contact-item.ativa {
  background-color: #f0f2f5;
}

/* Avatar circular com iniciais */
.acad-contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #202c33;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  user-select: none;
}

.acad-contact-info {
  flex: 1;
  min-width: 0;
}

.acad-contact-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.acad-contact-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acad-contact-time {
  font-size: 0.72rem;
  color: #667781;
  flex-shrink: 0;
  margin-left: 4px;
}

.acad-contact-preview {
  font-size: 0.8rem;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acad-contact-preview.nao-lido {
  font-weight: 700;
  color: #111b21;
}

.acad-contact-preview.encerrado {
  font-style: italic;
  color: #aaa;
}

/* Botão X para remover sessão */
.acad-contact-close {
  opacity: 0;
  transition: opacity 0.15s;
  color: #667781 !important;
  padding: 2px 6px !important;
  flex-shrink: 0;
}

.acad-contact-item:hover .acad-contact-close,
.acad-contact-item.ativa .acad-contact-close {
  opacity: 1;
}

/* ── Painel direito: chat ativo ── */
.acad-wa-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.acad-wa-main-empty {
  background-color: #f0f2f5;
}

/* Shell: painel completo do chat (dentro do painel direito) */
.acad-wa-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Cabeçalho escuro estilo WhatsApp */
.acad-wa-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #202c33;
  color: #fff;
  padding: 10px 16px;
  flex-shrink: 0;
}

/* Avatar circular com iniciais */
.acad-wa-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #00a884;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  user-select: none;
}

/* Área de mensagens */
.acad-wa-body {
  flex: 1;
  overflow-y: auto;
  background-color: #efeae2;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Wrapper de cada mensagem */
.acad-wa-message {
  display: flex;
  max-width: 72%;
}

.acad-wa-message-client {
  align-self: flex-start;
}

.acad-wa-message-seller {
  align-self: flex-end;
}

/* Bolha de mensagem */
.acad-wa-bubble {
  padding: 7px 10px 4px;
  border-radius: 7.5px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Bolha do cliente: fundo branco, notch esquerdo */
.acad-wa-message-client .acad-wa-bubble {
  background-color: #ffffff;
  color: #111;
  border-top-left-radius: 2px;
}

/* Bolha do vendedor: fundo verde, notch direito */
.acad-wa-message-seller .acad-wa-bubble {
  background-color: #d9fdd3;
  color: #111;
  border-top-right-radius: 2px;
}

/* Nome do remetente acima da mensagem */
.acad-wa-sender {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.2;
}

.acad-wa-message-client .acad-wa-sender {
  color: #00a884;
}

.acad-wa-message-seller .acad-wa-sender {
  color: #5b8dee;
}

/* Metadados: horário + checkmarks */
.acad-wa-meta {
  font-size: 0.67rem;
  color: #667781;
  text-align: right;
  margin-top: 2px;
  user-select: none;
}

/* Barra de rodapé */
.acad-wa-footer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background-color: #f0f2f5;
  padding: 8px 12px;
  flex-shrink: 0;
}

/* Campo de texto */
.acad-wa-input {
  flex: 1 !important;
  border-radius: 20px !important;
  border: 1px solid transparent !important;
  padding: 8px 14px !important;
  font-size: 0.92rem !important;
  background: #fff !important;
  resize: none !important;
  overflow-y: hidden !important;
  max-height: 120px;
  line-height: 1.4 !important;
  box-shadow: none !important;
  outline: none !important;
  transition: border-color 0.15s;
}

.acad-wa-input:focus {
  border-color: #adb5bd !important;
  box-shadow: none !important;
}

/* Botões de ícone decorativos (emoji, anexo, mic) */
.acad-wa-icon-btn {
  border: none;
  background: transparent;
  color: #54656f;
  padding: 0;
  font-size: 1.25rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s;
  line-height: 1;
}

.acad-wa-icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: #3c4043;
}

/* Botão de envio — círculo verde */
.acad-wa-send-btn {
  border: none !important;
  background-color: #00a884 !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.1rem !important;
  flex-shrink: 0;
  transition: background-color 0.15s !important;
}

.acad-wa-send-btn:hover {
  background-color: #017f63 !important;
}

/* Indicador de "digitando..." estilo WhatsApp */
.acad-typing-bubble {
  background-color: #fff !important;
  padding: 10px 14px !important;
  min-width: 72px;
}

.acad-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 16px;
}

.acad-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #90a4ae;
  display: inline-block;
  animation: acad-dot-bounce 1.4s ease-in-out infinite;
}

.acad-dot:nth-child(1) { animation-delay: 0s; }
.acad-dot:nth-child(2) { animation-delay: 0.2s; }
.acad-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes acad-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}
