/* ============================================
   06-MSG.CSS
   Balões de mensagem, header, meta, status, sistema, apagada
============================================ */

/* ============================================
   LINHA DA MENSAGEM
============================================ */

.msg-row {
  display: flex;
  width: 100%;
  min-width: 0;
}

.msg-row.left {
  justify-content: flex-start;
}

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

/* ============================================
   CARD DA MENSAGEM
============================================ */

.msg-card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  width: fit-content;
  max-width: calc(100vw - 32px);
  min-width: 0;
  overflow: visible;
  box-sizing: border-box;
  border-radius: 24px;
}

.msg-layer {
  position: relative;
  background: linear-gradient(135deg, #2f7cff, #2563eb);
  border-radius: 24px;
  padding: 10px 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.msg-row.right .msg-layer {
  min-width: 220px;
}

.msg-row.left .msg-layer {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}

/* ============================================
   HEADER DA MENSAGEM
============================================ */

.msg-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.msg-row.right .msg-header {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  gap: 8px;
  padding-right: 4px;
}

.msg-row.left .msg-header {
  justify-content: flex-start;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}

.msg-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.msg-row.right .msg-meta {
  align-items: flex-end;
  text-align: right;
}

.msg-meta b {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
}

.msg-row.left .msg-meta b {
  color: #082f49;
}

.msg-meta span {
  font-size: 11px;
  font-weight: 700;
  opacity: .92;
  color: rgba(255,255,255,.92);
}

.msg-row.left .msg-meta span {
  color: #0c4a6e;
}

/* ============================================
   BOTÃO MENU DA MENSAGEM
============================================ */

.msg-menu-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
  cursor: pointer;
  align-self: flex-start;
}

.msg-row.left .msg-menu-btn {
  color: #0c4a6e;
  background: rgba(255,255,255,.82);
}

.msg-row.right .msg-menu-btn {
  color: #fff;
  background: rgba(255,255,255,.18);
}

/* ============================================
   STATUS DA MENSAGEM
============================================ */

.msg-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
  color: #fff;
  margin-right: 2px;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,.18);
  align-self: flex-start;
}

/* ⚠️ Status "enviando" — ícone pulsando */
.msg-status.status-enviando {
  animation: pulsoEnviandoNex 1.2s ease-in-out infinite;
}

@keyframes pulsoEnviandoNex {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ⚠️ Status "erro" — vermelho */
.msg-status.status-erro {
  color: #ef4444;
  font-weight: 900;
}

/* ============================================
   CONTEÚDO DA MENSAGEM
============================================ */

.msg-content {
  position: relative;
  background: #fff;
  border-radius: 22px;
  padding: 12px 14px;
  color: #111827;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  min-width: 170px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.msg-text {
  font-size: 19px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: .1px;
  color: #1f2937;
  word-break: break-word;
}
/* ============================================
   MENSAGEM DE SISTEMA
============================================ */

.msg-row.left .msg-layer.msg-sistema {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.10));
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.msg-row.left .msg-layer.msg-sistema .msg-content {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.msg-row.left .msg-layer.msg-sistema .msg-text {
  color: #fbbf24;
  font-weight: 700;
}

/* ============================================
   MENSAGEM APAGADA
============================================ */

.msg-apagada-nex {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.55);
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.msg-apagada-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 6px 0;
}

/* ============================================
   ANEXOS: PDF
============================================ */

.msg-pdf-card {
  width: min(100%, 245px);
  max-width: 245px;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.18);
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
  backdrop-filter: blur(12px);
}

.msg-pdf-cover {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  border-radius: 18px;
  background: #17233d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.msg-pdf-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,.58) 0%,
    rgba(0,0,0,.20) 38%,
    rgba(0,0,0,0) 100%
  );
  z-index: 2;
  pointer-events: none;
}

.msg-pdf-thumb {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
}

.msg-pdf-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  margin: 30px auto 0;
}

.msg-pdf-filename {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
  color: #fff;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 6px rgba(0,0,0,.28);
  padding: 16px;
  position: relative;
  z-index: 3;
}

.msg-pdf-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.78);
  padding: 0 16px 16px;
  position: relative;
  z-index: 3;
}

.msg-pdf-view-btn {
  width: 100%;
  background: #2563eb;
  border: none;
  border-radius: 16px;
  padding: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 10px 24px rgba(37,99,235,.28);
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
}

.msg-pdf-view-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.msg-pdf-view-btn:active {
  transform: scale(.98);
}

/* ============================================
   ANEXOS: LOCALIZAÇÃO (CARD ELEGANTE)
============================================ */

.msg-location-card-elegante {
  width: 100%;
  max-width: 280px;
  border-radius: 16px;
  overflow: hidden;
  background: #1e293b;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  margin-top: 8px;
}

.msg-location-capa {
  width: 100%;
  height: 90px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background-color: #0f172a;
}

.msg-location-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  border: 3px solid #1e293b;
  position: absolute;
  bottom: -25px;
  overflow: hidden;
}

.msg-location-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-location-info {
  padding: 32px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-location-address {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
  text-align: center;
  word-break: break-word;
}

.msg-location-btn-elegante {
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.msg-location-btn-elegante:active {
  background: #1d4ed8;
  transform: scale(0.98);
}
/* ============================================
   ANEXOS: ÁLBUM
============================================ */

.msg-album-card {
  width: min(100%, 300px);
  max-width: 300px;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-album-cover {
  position: relative;
  overflow: hidden;
  min-height: 165px;
  width: 100%;
  border-radius: 20px;
  background: linear-gradient(180deg, #2b6bff 0%, #7b61ff 100%);
}

.msg-album-blur-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 6px;
  padding: 10px;
  filter: blur(9px) saturate(1.15);
  transform: scale(1.08);
}

.msg-album-blur-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.12);
}

.msg-album-blur-thumb img,
.msg-album-blur-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-album-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(10,15,30,.12) 0%, rgba(10,15,30,.52) 100%);
}

.msg-album-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
  font-size: 22px;
}

.msg-album-title {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
  color: #fff;
}

.msg-album-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.86);
}

/* ============================================
   ANEXOS: MÍDIA ÚNICA (imagem/vídeo drop)
============================================ */

.msg-anexo-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-midia-thumb,
.msg-video-thumb {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}

.msg-midia-thumb {
  max-height: 260px;
  object-fit: cover;
}

.msg-video-thumb video {
  width: 100%;
  display: block;
}

.msg-open-anexo-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  background: #2563eb;
  color: #fff;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
}

/* ============================================
   PREVIEW DO DROP
============================================ */

.msg-drop-preview-open {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.msg-drop-preview-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

.msg-drop-preview-title {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.25;
}

.msg-drop-preview-date {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
  line-height: 1.2;
}

.msg-drop-profile-btn {
  max-width: 100%;
  border: 1.5px solid rgba(0,0,0,.22);
  border-radius: 16px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  color: #111827;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: .18s ease;
  box-shadow:
    0 8px 20px rgba(0,0,0,.08),
    inset 0 1px 0 rgba(255,255,255,.7);
}

.msg-drop-profile-btn:active {
  transform: scale(.98);
}

/* ============================================
   GRID DE MÍDIAS (VÁRIAS FOTOS/VÍDEOS)
============================================ */

.msg-midias-grid {
  display: grid;
  width: 100%;
  gap: 6px;
  max-width: 240px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  align-items: stretch;
}

.msg-midias-grid-1 {
  grid-template-columns: 1fr;
}

.msg-midias-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.msg-midias-grid-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.msg-midias-grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.msg-grid-item {
  position: relative;
  min-width: 0;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #eaf2ff;
}

.msg-midias-grid-1 .msg-grid-item {
  aspect-ratio: 3 / 4;
  max-width: 340px;
}

.msg-midias-grid-3 .msg-grid-item:nth-child(1) {
  grid-row: span 2;
  aspect-ratio: 3 / 4;
}

.msg-grid-item img,
.msg-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* ============================================
   MÍDIA ÚNICA (LARGURA MAIOR)
============================================ */

.msg-card.midias-unica {
  max-width: 92%;
}

.msg-card.midias-unica .msg-content {
  padding: 10px;
}

.msg-midias-grid.msg-midias-single {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.msg-midias-grid.msg-midias-single .msg-grid-item {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  overflow: hidden;
}

.msg-midias-grid.msg-midias-single .msg-grid-item img,
.msg-midias-grid.msg-midias-single .msg-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-midias-single {
  display: flex;
  justify-content: center;
  align-items: center;
}

.msg-midias-single .msg-grid-item {
  width: min(72vw, 320px);
  height: min(118vw, 620px);
  flex: 0 0 min(72vw, 320px);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dfe8f7;
}

.msg-midias-single .msg-grid-item img,
.msg-midias-single .msg-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================
   REAÇÃO EM MÍDIA (PREVIEW PEQUENO)
============================================ */

.msg-anexo-card,
.msg-grid-item,
.msg-video-thumb {
  position: relative;
}

.msg-reaction-preview {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13,20,36,.92);
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
  font-size: 18px;
  z-index: 10;
  pointer-events: none;
}

/* ============================================
   ÁUDIO NA MENSAGEM
============================================ */

.audio-msg {
  width: 100%;
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.audio-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-bar {
  flex: 1;
  height: 8px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}

.audio-progress {
  width: 0%;
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width .15s linear;
}

.audio-time {
  min-width: 54px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.audio-open-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  background: #2563eb;
  color: #fff;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 18px rgba(37,99,235,.18);
}

/* ============================================
   RESPOSTAS (LINK E CITAÇÃO)
============================================ */

.reply-linked-top,
.reply-cited-bottom {
  width: calc(100% - 20px);
  margin: 8px 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: none;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  box-sizing: border-box;
}

.reply-linked-top {
  background: #dff7df;
  color: #1f7a1f;
  border: 1px solid #bde8bd;
  margin-top: 2px;
  min-height: 34px;
  justify-content: flex-start;
  border-radius: 999px;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
}

.reply-cited-bottom {
  background: #fff4cc;
  color: #9a6b00;
  border: 1px solid #ffe08a;
  margin-top: 2px;
  margin-bottom: 2px;
}

.reply-linked-top span:first-child,
.reply-cited-bottom span:last-child {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.reply-arrow {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.reply-count-pill {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255,255,255,.55);
  box-sizing: border-box;
  flex-shrink: 0;
}

.reply-linked-top .reply-count-pill {
  color: #1f7a1f;
}

.reply-cited-bottom .reply-count-pill {
  color: #9a6b00;
}

.reply-next-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #dff7df;
  border: 1px solid #bde8bd;
  color: #1f7a1f;
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ============================================
   DESTAQUE DE MENSAGEM
============================================ */

.msg-destaque-verde-nex,
.msg-destaque-amarelo-nex {
  border-radius: 20px;
  box-sizing: border-box;
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

.msg-destaque-verde-nex {
  box-shadow: 0 0 0 3px #92d9a0, 0 0 0 7px rgba(195, 240, 201, .35);
}

.msg-destaque-amarelo-nex {
  box-shadow: 0 0 0 3px #f1d97a, 0 0 0 7px rgba(255, 243, 179, .35);
}

/* ============================================
   MENSAGEM EDITADA
============================================ */

.msg-editada-nex {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}
/* ⚠️ Selo de comentário do Nearby */
.msg-nearby-comment {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.msg-nearby-comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.msg-nearby-comment-icone {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.msg-nearby-comment-texto {
  font-size: 13px;
  font-weight: 800;
  color: #92400e;
  line-height: 1.2;
}

/* ⚠️ Botão "Ver Drop" dentro do card de comentário do Nearby */
.msg-nearby-comment-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 12px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.msg-nearby-comment-btn:active {
  transform: scale(0.97);
  filter: brightness(1.08);
}

/* ⚠️ Badge de reação em mídia do chat */
.msg-midia-badge-slot {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 12;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(13,20,36,.88);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  pointer-events: none;
}

.msg-midia-badge-slot.visivel {
  display: inline-flex;
}

.msg-midia-badge-slot .badge-emoji {
  font-size: 15px;
  line-height: 1;
}

.msg-midia-badge-slot .badge-count {
  line-height: 1;
}

/* Se for a MINHA reação, fica destacado */
.msg-midia-badge-slot.minha-reacao {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 6px 16px rgba(37,99,235,.5);
}

/* ⚠️ Foto/vídeo normal precisa ter posição relativa pro badge ancorar */
.msg-anexo-card[data-midia-msg-id] {
  position: relative;
}