/* ==========================================================
   💬 CHAT GERAL — Layout Fullscreen e Estrutura
   ========================================================== */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #0a0a0a;
  overflow: hidden;
}

/* ==========================================================
   🧭 Cabeçalho (Título + Seta)
   ========================================================== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.chat-back-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: opacity 0.2s ease;
}

.chat-back-btn:hover {
  opacity: 0.7;
}

.chat-back-btn i {
  width: 22px;
  height: 22px;
  color: #fff;
}

.chat-header-placeholder {
  width: 22px;
}

/* ==========================================================
   🔍 Campo de Busca
   ========================================================== */
.chat-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #151922;
  border-radius: 15px;
  padding: 8px 12px;
  margin: 12px 16px;
  border: 1px solid #1a1a1a;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease 0.3s forwards;
}


.chat-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cor-text-input);
  font-size: 15px;
}

.chat-search input::placeholder {
  color: var(--cor-placeholder-input);
}

/* ===============================
   BOTÃO LIMPAR BUSCA (×)
=============================== */
.chat-search-clear {
  position: absolute;
  right: 10px;

  width: 28px;
  height: 28px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.12); /* fundo sutil */
  border-radius: 50%; /* 50% = círculo perfeito */
  border: none;

  color: #fff;
  font-size: 20px;
  line-height: 1;

  cursor: pointer;
  opacity: 0.7;

  transition:
    opacity 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

/* Hover */
.chat-search-clear:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

/* Active (toque / clique) */
.chat-search-clear:active {
  transform: scale(0.9);
}

/* Estado oculto */
.chat-search-clear.hidden {
  display: none;
}
.chat-search-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--cor-icon-input);
  cursor: pointer;
}

.chat-search-btn .icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* Hover opcional */
.chat-search-btn:hover {
  color: var(--cor-acento);
}



/* ==========================================================
   💬 Lista de Conversas
   ========================================================== */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 0px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.chat-thread {
  display: flex;
  align-items: center;
  background: #131313;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  transition: background 0.2s ease, border 0.2s ease;
  border: 2px solid transparent;
  animation: fadeInUp 0.5s ease forwards;
}

.chat-thread:hover {
  background: #181818;
}

.chat-thread.active {
  border-color: #00e1ff;
}

/* ==========================================================
   🧍 Avatar e Status
   ========================================================== */
.chat-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-status-indicator {
  position: absolute;
  bottom: 2px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0a0a0a;
  background-color: #444;
}

.chat-status-indicator.online {
  background-color: #00ff73;
}

/* ==========================================================
   🧾 Conteúdo da conversa (texto e hora)
   ========================================================== */
.chat-info {
  flex: 1;
  margin-left: 0px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.chat-name {
  color: #fff;
  font-weight: 500;
  font-size: 15px;
}

.chat-time {
  color: #888;
  font-size: 12px;
}

.chat-last {
  color: #aaa;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================
   🔵 Badge de mensagens não lidas
   ========================================================== */
.chat-badge {
  background: #E8636C;
  color: white;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 999px;
  margin: -13px 0 0 -10px;
}


.chat-badge.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}


/* ==========================================================
   ➕ Botão Flutuante
   ========================================================== */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #00e1ff, #d33686);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, opacity 0.4s ease;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.6s forwards;
  z-index: 20;
}

.chat-fab:hover {
  transform: scale(1.05);
}

/* ==========================================================
   ⚙️ Scrollbar
   ========================================================== */
.chat-list::-webkit-scrollbar {
  width: 5px;
}

.chat-list::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}

/* ==========================================================
   ✨ Transição estilo Instagram — versão fluida
   ========================================================== */
/* ==========================================================
   ✨ Modais de chat — sempre por cima de tudo
   ========================================================== */
#chatModal,
#chatDetailModal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    opacity 0.3s ease,
    visibility 0.3s ease;
  will-change: transform, opacity;
  z-index: 99999; /* 🔥 garante sobreposição total sobre o menu_bottom */
}

/* Inbox ativa (lista de conversas) */
#chatModal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateX(0);
}

/* Inbox desliza levemente pra esquerda ao abrir conversa */
#chatModal.hide-left {
  transform: translateX(-40%);
  opacity: 0.4;
}

/* Modal de conversa (chatDetail) */
#chatDetailModal {
  transform: translateX(100%);
  z-index: 100000; /* 🔥 ainda mais alto que o anterior */
}

/* Quando ativo, desliza da direita pra esquerda */
#chatDetailModal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateX(0);
}

/* Quando fecha (volta pra direita) */
#chatDetailModal.closing {
  transform: translateX(100%);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    opacity 0.3s ease;
}

/* Animação interna (conteúdo deslizando com bounce leve) */
#chatDetailModal.active .chat-detail-window {
  animation: bounceInRight 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bounceInRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  60% {
    transform: translateX(-4%);
    opacity: 1;
  }
  100% {
    transform: translateX(0);
  }
}

/* ==========================================================
   ✨ Animações extras — Fade / Slide internos
   ========================================================== */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}




/* ==========================================================
   💬 MODAL DE CONVERSA (CHAT DETAIL)
   ========================================================== */

.chat-detail-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transform: translateX(100%);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.chat-detail-modal.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.chat-detail-modal.closing {
  transform: translateX(100%);
  opacity: 0;
}

/* =========================
   Cabeçalho
   ========================= */
.chat-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111;
  padding: 12px 16px;
  border-bottom: 1px solid #222;
}

.chat-back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
}

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

.chat-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-user-name {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}


.chat-options-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

/* =========================
   Mensagens
   ========================= */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #0a0a0a;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}

.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble {
  background: #1c1c1c;
  border-radius: 16px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  transition: background 0.2s ease;
}

.chat-message.sent .chat-bubble {
  background: linear-gradient(135deg, #d33686, #a82d96);
}

.chat-message.received .chat-bubble {
  background: #242424;
}

.chat-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-time {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: #999;
  margin-top: 4px;
}


.chat-input-area input {
  flex: 1;
  background: #1a1a1a;
  border: none;
  color: #fff;
  font-size: 0.95rem;
  border-radius: 20px;
  padding: 10px 14px;
  outline: none;
}



.chat-input-area button:hover {
  transform: scale(1.1);
}

/* =========================
   Transição tipo Instagram
   ========================= */
.chat-modal.hide-left {
  transform: translateX(-100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}






/* ===== MODAL DE CONVERSA ===== */
.chat-detail-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  background: #0e0e0e;
  display: none;
  flex-direction: column;
  z-index: 9999;
  transition: transform 0.35s ease, opacity 0.3s ease;
}
.chat-detail-modal.active {
  display: flex;
  transform: translateX(0);
  opacity: 1;
}
.chat-detail-modal.closing {
  transform: translateX(100%);
  opacity: 0;
}

/* ===== CABEÇALHO ===== */
.chat-detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0e0e0e;
  padding: 12px 16px;
  border-bottom: 1px solid #1c1c1c;
}
.chat-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-user-name {
  font-weight: 600;
  color: #fff;
  font-size: 15px;
}

/* ===== MENSAGENS ===== */
.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 80%;
}
.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-bubble {
  background: #2a2a2a;
  border-radius: 18px;
  padding: 10px 14px;
  color: #fff;
  position: relative;
  font-size: 14px;
  word-wrap: break-word;
}
.chat-message.sent .chat-bubble {
  background: #d33686;
  border-bottom-right-radius: 6px;
}
.chat-message.received .chat-bubble {
  background: #222;
  border-bottom-left-radius: 6px;
}
.chat-time {
  display: block;
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  text-align: right;
}
.chat-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.chat-input-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 8px;
}
.chat-input-area input {
  flex: 1;
  background: #1a1a1a;
  border: none;
  border-radius: 20px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
}
.chat-input-area input::placeholder {
  color: #777;
}


.chat-detail-modal {
  position: fixed;
  inset: 0;
  background: #0e0e0e;
  display: none;
  flex-direction: column;
  z-index: 10000;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
  transform: translateX(100%);
}

.chat-detail-modal.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.chat-detail-header {
  position: sticky;
  top: 0;
  background: #0e0e0e;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1e1e1e;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;

}

/* ================================
   😀 Carousel de Emojis
================================ */
.chat-emoji-carousel {
  display: flex;
  gap: 0.4rem;

  padding: 0.4rem 0.6rem;
  background: var(--cor-fundo);
  border-top: 0px solid #1f1f1f;

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* WebView iOS/Android */
}

.chat-emoji-carousel::-webkit-scrollbar {
  display: none;
}

.chat-emoji {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: #121622;
  border: 1px solid #1a2033;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
}

/* ================================
   ✏️ Área de Input do Chat
================================ */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  background: var(--cor-fundo);
  border-top: 1px solid #121622;
}

.chat-input-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

#chatMessageInput {
  flex: 1;
  height: 42px;
  padding: 0 0.9rem;

  border-radius: 999px;
  border: 1px solid transparent;
/*
  background:
   
    linear-gradient(#181818, #181818) padding-box,

    borda com gradiente
    linear-gradient(
      180deg,
      #EA646C 5.2%,
      #2226DF 100%
    ) border-box;
 */

  background: var(--bg-input);
   color: #f1f1f1;
  font-size: 0.95rem;
  outline: none;

  caret-color: #EA646C; /* combina com o topo do gradiente */
}


/* ===============================
   BOTÃO SEND — CHAT
=============================== */
.chat-send-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;

  padding: 16px;

  background: #222; /* DESATIVADO */
  opacity: .35;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: not-allowed;

  transition:
    opacity .25s ease,
    transform .25s cubic-bezier(.25, 1.25, .5, 1),
}

/* ===============================
   BOTÃO SEND — CHAT (BASE)
=============================== */
.chat-send-btn {
  width: 42px;
  height: 42px;

  border-radius: 50%;
  border: none;

  padding: 0; /* 🔥 REMOVE padding */

  background: linear-gradient(180deg, #EA646C 5.2%, #2226DF 100%);
  opacity: .35;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: not-allowed;

  transition:
    opacity .25s ease,
    transform .25s cubic-bezier(.25, 1.25, .5, 1),

}

/* ===============================
   BOTÃO SEND — ATIVO
=============================== */
.chat-send-btn.gt-enabled {
  background: linear-gradient(180deg, #EA646C 5.2%, #2226DF 100%);
  opacity: 1;
  cursor: pointer;
  transform: scale(1.12);
}

.chat-send-btn .icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  margin-top: 3px;
  margin-left: 2px;  
}

/* Estado desabilitado */
.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Clique */
.chat-send-btn.gt-enabled:active {
  transform: scale(0.85);
}


/* ===============================
   ÍCONE SEND
=============================== */
.chat-send-btn .icon-send {
  width: 20px;
  height: 20px;

  pointer-events: none;
  color: #fff;

  transform: rotate(45deg) translate(-3px, 1px);
}

/* ===========================================
   💬 Chat Modal (Layout Instagram Direct)
   =========================================== */

.chat-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  justify-content: center;
  align-items: flex-end;
  flex-direction: column;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.chat-detail-modal.active {
  display: flex;
  opacity: 1;
}

/* Container principal da conversa */
.chat-detail-box {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0e0e0e;
  display: flex;
  flex-direction: column;
}

/* ==========================
   🧭 Cabeçalho fixo
   ========================== */
.chat-detail-header {
  position: sticky;
  top: 0;
  background: #0e0e0e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

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

.chat-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-user-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: block;
}



.chat-back-btn,
.chat-options-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
}

/* ==========================
   💬 Área de mensagens
   ========================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
 /*  padding: 10px 12px 80px; espaço para o input */
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}

.chat-message.sent {
  align-self: flex-end;
  justify-content: flex-end;
}

.chat-message.received {
  align-self: flex-start;
}

.chat-bubble {
  background: #2c2c2c;
  border-radius: 18px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  position: relative;
}

.chat-message.sent .chat-bubble {
  background: linear-gradient(135deg, #d33686, #7a1ba4);
  color: #fff;
}

.chat-time {
  font-size: 11px;
  color: #a5a5a5;
  margin-top: 2px;
  display: block;
  text-align: right;
}


.chat-input-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-input-area input {
  flex: 1;
  background: #1a1a1a;
  border: none;
  border-radius: 25px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.chat-input-area input::placeholder {
  color: #999;
}


/* ==========================
   💎 Animações suaves
   ========================== */
.chat-detail-modal {
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.chat-detail-modal.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-bubble {
  animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* =========================================
   🔗 Preview Universal estilo Facebook Ghostune
   ========================================= */
.chat-link-preview.facebook-ghostune {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 8px;
  transition: all 0.25s ease;
}

.chat-link-preview.facebook-ghostune:hover {
  transform: scale(1.01);
}

.preview-image-top {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.preview-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-title {
  color: #D33686; /* 🌸 Cor primária do Ghostune */
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
}

.preview-title:hover {
  text-decoration: underline;
}

.preview-desc {
  color: #333;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 2px;
}

.preview-domain {
  color: #777;
  font-size: 12px;
  margin-top: 4px;
  text-transform: lowercase;
}

/* =========================================
   💬 Ajustes gerais
   ========================================= */
.chat-text {
  white-space: normal;     /* 🔥 ESSENCIAL */
  word-wrap: break-word;
  margin: 0;
  padding: 0;
}


.chat-bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: 16px;
  max-width: 80%;
}

.chat-message.sent .chat-bubble {
  background: linear-gradient(180deg, #d33686, #a22b68);
  color: #fff;
  align-self: flex-end;
}

.chat-message.received .chat-bubble {
  background: #1c1c1c;
  color: #fff;
}

.chat-time {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}



/* ==========================================================
   💬 CHAT GERAL — Estrutura e Layout Base
   ========================================================== */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--cor-fundo);
  overflow: hidden;
}

/* ===================================================== */
/* 🧭 CHAT HEADER — PADRÃO GHOSTUNE                      */
/* ===================================================== */

.chat-header {
  /* position: fixed; */
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  /* padding-inline: 12px; */
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cor-fundo);
  border-bottom: 0px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
}

/* Título central */
.chat-title {
  font-size: 1rem;       /* 🔥 padrão */
  font-weight: 600;
  color: var(--cor-title-header);

  margin: 0;
  text-align: center;

  white-space: nowrap;
  pointer-events: none;
}


/* Botão voltar */
.chat-back-btn {
  width: 24px;
  height: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* Ícone */
.chat-header-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}


/* Placeholder direito (equilibra o centro) */
.chat-header-placeholder {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* ==========================================================
   💬 LISTA DE CONVERSAS
   ========================================================== */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 0px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

/* ==========================================================
   💬 MODAL DE CONVERSA
   ========================================================== */
.chat-detail-modal {
  position: fixed;
  inset: 0;
  background: #0e0e0e;
  display: none;
  flex-direction: column;
  z-index: 9999;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
  transform: translateX(100%);
}

.chat-detail-modal.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================
   🧭 HEADER — CHAT MODAL (PADRÃO GLOBAL)
========================================== */
.chat-detail-header {
  position: sticky; /* fica fixo dentro do modal */
  top: 0;
  height: 56px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--cor-fundo);
  border-bottom: 0px solid #1f1f1f;
  z-index: 10; /* acima do conteúdo do chat */
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}


.chat-user-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;

  text-decoration: none;
  color: inherit; /* mantém a cor original */
}

.chat-user-link:hover {
  opacity: 0.9;
}


/* ==========================================================
   💬 MENSAGENS
   ========================================================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 17px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cor-fundo);
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
  margin-bottom: 4px;
}

.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-message.received {
  align-self: flex-start;
}

.chat-bubble {
  background: #2c2c2c;
  border-radius: 18px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  max-width: 100%;
  animation: fadeIn 0.25s ease forwards;
}

.chat-message.sent .chat-bubble {
  background: var(--bg-chat-message-sent);
  color: var(--cor-texto);
}
.chat-message.received .chat-bubble {
  background: var(--bg-chat-message-received);
  color: var(--cor-texto);
}

/* Horário */
.chat-time {
  display: block;
  font-size: 11px;
  color: #a5a5a5;
  margin-top: 4px;
  text-align: right;
}

/* Avatar pequeno (recebidas) */
.chat-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-input-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(180deg, #EA646C 5.2%, #2226DF 100%);
  padding: 2px;
}


.chat-input-area input {
  flex: 1;
  background: #1a1a1a;
  border: none;
  border-radius: 25px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.chat-input-area input::placeholder {
  color: #999;
}

/* ==========================================================
   🔗 PREVIEW UNIVERSAL — Facebook Ghostune
   ========================================================== */
.chat-link-preview.facebook-ghostune {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 4px; /* 🔧 reduzido para alinhar com mensagens comuns */
  transition: all 0.25s ease;
}

.chat-link-preview.facebook-ghostune:hover {
  transform: scale(1.01);
}

.preview-image-top {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.preview-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-title {
  color: #D33686; /* cor primária Ghostune */
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
}
.preview-title:hover {
  text-decoration: underline;
}

.preview-desc {
  color: #333;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 2px;
}
.preview-domain {
  color: #777;
  font-size: 12px;
  margin-top: 4px;
  text-transform: lowercase;
}


/* ==========================================================
   💎 Animações suaves
   ========================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}


.chat-thread {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.2s;
}

.chat-thread:hover {
  background: rgba(255,255,255,0.05);
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.chat-info {
  flex: 1;
  overflow: hidden;
}

.chat-name {
  font-weight: 600;
  display: block;
}

.chat-last {
  color: #aaa;
  font-size: 0.9rem;
  margin-top: 0px;
}

.chat-time {
  font-size: 0.8rem;
  color: #ffffff;
}




/* =========================================
   🔹 Estilo da lista de conversas
   ========================================= */
.chat-thread {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.75rem;
  border-radius: 0px;
  background: #151922;
  position: relative;
  transition: border 0.2s, background 0.2s;
  text-decoration: none;
  color: #fff;
  border: 1.5px solid transparent;
  margin-bottom: 10px;
  border-radius: 15px;
}

.chat-thread:hover {
  background: #1c2332;
}

/* 💬 Conversas não lidas: borda e badge azul */
.chat-thread.has-unread {
  background: #1A2040;
}

.thread-badge {
  background: #E8636C;
  color: rgba(255,255,255,0.88);;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  position: absolute;
  right: 18px;
  bottom: 12px;
}

/* Avatar + texto */
.chat-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}



/* ==========================================================
   💬 Estilos do indicador de presença (online/offline)
   ========================================================== */
.chat-avatar-wrapper {
  position: relative;
  display: inline-block;
}

.chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--chat-bg, #0d0d0d); /* contorno do fundo */
  background: #6b6b6b; /* cinza padrão (offline) */
  transition: background 0.3s ease;
}

.chat-status-dot.online {
  background: #00e676; /* verde quando online */
}


/* ==========================================================
   💬 Indicador de status no topo do chat (igual Inbox)
   ========================================================== */
.chat-avatar-wrapper {
  position: relative;
  display: inline-block;
}

.chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--chat-bg, #0d0d0d);
  background: #6b6b6b;
  transition: background 0.3s ease;
}

.chat-status-dot.online {
  background: #00e676; /* verde = online */
}



/* ==========================================================
   💬 Indicador de status (Inbox)
   ========================================================== */
.chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--chat-bg, #0d0d0d);
  background: #6b6b6b; /* offline padrão */
  opacity: 0.8;
  transform: scale(0.9);
  transition:
    background 0.25s ease,
    transform 0.25s ease,
    opacity 0.25s ease;
}

/* 🟢 Online */
.chat-status-dot.online {
  background: #00e676;
  opacity: 1;
  transform: scale(1);
}

/* 🔘 Suave saída offline */
.chat-status-dot.status-off {
  background: #6b6b6b;
  opacity: 0.7;
  transform: scale(0.85);
}

/* ✨ Breve animação de entrada */
@keyframes pulseStatus {
  0% { transform: scale(0.7); opacity: 0.5; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.chat-status-dot.status-anim {
  animation: pulseStatus 0.25s ease;
}



/* ==========================================================
   🔄 CHAT LOADER — 3 DOTS COLORIDOS (PROFISSIONAL)
   ========================================================== */

.chat-loader {
  position: absolute;
  top: 50px; /* abaixo do header */
  left: 0;
  width: 100%;
  height: 42px;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;

  

  z-index: 20;
  pointer-events: none;
}

/* esconder */
.chat-loader.hidden {
  display: none;
}

/* ----------------------------------------------------------
   🔵 DOTS
---------------------------------------------------------- */
.chat-loader .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;

  animation: chat-dot-bounce 1.4s infinite ease-in-out both;
}

/* 🎨 cores diferentes */
.chat-loader .dot:nth-child(1) {
  background: #EA646C; /* verde */
  animation-delay: -0.32s;
}

.chat-loader .dot:nth-child(2) {
  background: #2226DF; /* azul neon */
  animation-delay: -0.16s;
}

.chat-loader .dot:nth-child(3) {
  background: #ffffff; /* vermelho */
}

/* ----------------------------------------------------------
   🎞️ ANIMAÇÃO
---------------------------------------------------------- */
@keyframes chat-dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.3);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}


#chatDetailMessagesContainer {
  overflow-y: auto;

  /* ESSENCIAL: evita bug de momentum */
  -webkit-overflow-scrolling: auto;

  /* remove smooth scroll */
  scroll-behavior: auto !important;

  position: relative;
}

.chat-message {
  contain: paint; /* ⚠️ NÃO use layout */
}



/* =========================================
   💤 EMPTY STATE — CHAT
========================================= */

.chat-empty-wrapper {
  flex: 1;
  display: flex;
  align-items: center;      /* 🔥 centraliza vertical */
  justify-content: center;  /* 🔥 centraliza horizontal */
  height: 100%;
  padding: 24px;
}

.chat-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
}

.chat-empty-icon {
  width: 48px;
  height: 48px;
  color: #777;
}

.chat-empty {
  font-size: 0.95rem;
  color: #999;
  text-align: center;
  line-height: 1.4;
}




/* ======================================================
   🗑️ MODAL EXCLUIR CONVERSA — ESTILO FINAL
   ====================================================== */

.modal-excluir-conversa {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

/* estado oculto */
.modal-excluir-conversa.hidden {
  display: none;
}

.modal-excluir-box {
  background: #151922;
  color: #fff;
  width: 90%;
  max-width: 360px;
  padding: 24px;
  border-radius: 14px;
  text-align: center;
}

.modal-excluir-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.modal-excluir-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.modal-excluir-text {
  font-size: 14px;
  color: #bbb;
  margin-bottom: 10px;
}

.modal-excluir-actions {
  display: flex;
  gap: 10px;
}

.modal-excluir-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-cancelar-exclusao {
  background: #2b3343;
  color: #fff;
}

.btn-confirmar-exclusao {
  background: #e53935;
  color: #fff;
}


.modal-excluir-error {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #ff6b6b;
  margin-bottom: 10px;
  text-align: center;
}




/* =========================================================
   🦴 CHAT — SKELETON CARD
    🦴 CHAT INBOX — SKELETON
========================================================= */

.chat-scroll-skeleton {
  padding: 0px;
}

.chat-inbox-skeleton {
  padding: 0 16px 0;
}

/* Card */
.chat-skeleton-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0.75rem 0.75rem;
  margin-bottom: 12px;
  border-radius: 18px;
  background-color: var(--skeleton-card);
  pointer-events: none;
}

/* Avatar */
.chat-skeleton-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--skeleton-line-avatar);
  position: relative;
  overflow: hidden;
}

/* Conteúdo */
.chat-skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Linhas */
.chat-skeleton-line {
  height: 12px;
  border-radius: 8px;
  background: var(--skeleton-line-avatar);
  position: relative;
  overflow: hidden;
}

/* Nome */
.chat-skeleton-line.title {
  width: 35%;
}

/* Mensagem */
.chat-skeleton-line.message {
  width: 80%;
}


/* =========================================================
   ✨ SHIMMER SUAVE (PREMIUM)
   ========================================================= */

.chat-skeleton-avatar::after,
.chat-skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;

  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.08),
    transparent
  );

  animation: chatSkeletonShimmer 1.6s infinite;
}

@keyframes chatSkeletonShimmer {
  to {
    transform: translateX(100%);
  }
}



.chat-search-loader {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.chat-search-loader.hidden {
  display: none;
}

.spinner-search {
  width: 18px;
  height: 18px;
  margin-top: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


.chat-avatar-wrapper {
  position: relative;
}
/* ==========================================
   PRESENCE DOT — PADRÃO SEGURO
========================================== */



.presence-dot {
  position: absolute;
  bottom: 5px;
  right: 9px;

  width: 12px;
  height: 12px;
  border-radius: 50%;

  border: 2px solid #0b0e14; /* fundo do app */
  box-sizing: border-box;

  background: transparent;
  opacity: 0.6;

  transition: background-color 0.2s ease, opacity 0.2s ease;
}

/* Estado OFFLINE */
.presence-dot.presence-offline {
  background: #6b7280;
  opacity: 0.5;
}

/* Estado ONLINE */
.presence-dot.presence-online {
  background: #22c55e;
  opacity: 1;
}


/* ==========================================================
   🟢 Status de presença — Chat aberto (header da conversa)
   ========================================================== */

.chat-user-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  font-size: 12px;
  font-weight: 500;
  line-height: 1;

  user-select: none;
  white-space: nowrap;

  transition: color 0.2s ease, opacity 0.2s ease;
}

/* 🔴 OFFLINE */
.chat-user-status.presence-offline {
  color: #9ca3af; /* cinza suave */
  opacity: 0.7;
}

/* 🟢 ONLINE */
.chat-user-status.presence-online {
  color: #22c55e; /* verde elegante */
  opacity: 1;
}
