/* =========================
   Reply preview wrapper (contenedor envolvente)
   ========================= */

.reply-preview-wrapper {
  display: flex;
  width: 100%;
  max-width: 100%;
  padding: 6px 10px;
  box-sizing: border-box;
  overflow: hidden;
}

/* =========================
   Reply preview (WhatsApp-like)
   ========================= */

.reply-preview{
  display: flex;
  align-items: stretch;
  gap: 8px;

  margin: 11px 10px 6px 10px;
  padding: 8px 10px;

  border-radius: 14px;
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(0,0,0,.08);
  backdrop-filter: blur(8px);

  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  
  /* Evitar que crezca horizontalmente - SAFARI FIX */
  width: auto;
  max-width: calc(100% - 20px);
  min-width: 0;  /* ← Permite que flex comprima */
  box-sizing: border-box;  /* ← FIX SAFARI */
  overflow: hidden;  /* ← Contiene overflow */
}

/* barrita de color a la izquierda */
.reply-preview .rp-bar{
  width: 4px;
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  flex: 0 0 4px;
}

/* contenido */
.reply-preview .rp-content{
  display: flex;
  flex-direction: column;
  min-width: 0; /* importante para que flex pueda comprimir */
  flex: 1 1 auto;
  width: 100%;  /* ← FIX SAFARI */
  max-width: calc(100% - 20px);  /* ← Deja espacio para botón X */
  overflow: hidden;  /* ← Contiene overflow */
  box-sizing: border-box;  /* ← FIX SAFARI */
}

.reply-preview .rp-title{
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  opacity: .85;
  
  /* FIX SAFARI: limitar ancho */
  min-width: 0;  /* ← Permite que comprima */
  overflow: hidden;  /* ← Contiene overflow */
  text-overflow: ellipsis;  /* ← Trunca si es necesario */
}

.reply-preview .rp-snippet{
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
  opacity: .75;

  /* Permitir múltiples líneas en lugar de ellipsis */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  word-wrap: break-word;  /* ← Older browsers */
  
  /* Limitar alto máximo para evitar preview excesivamente largo */
  max-height: 60px;
  overflow-y: auto;
  
  /* FIX SAFARI: limitar ancho */
  width: auto;
  max-width: 100%;
  min-width: 0;  /* ← Permite que comprima */
  box-sizing: border-box;  /* ← FIX SAFARI */
}

/* botón X */
.reply-preview .rp-cancel{
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;

  font-size: 18px;
  line-height: 1;
  opacity: .6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 4px;
  border-radius: 8px;
  
  /* FIX SAFARI: prevenir que se comprima */
  flex: 0 0 28px;  /* ← No comprimirse */
  min-width: 28px;
}

.reply-preview .rp-cancel:hover{
  opacity: 1;
}

/* Mobile: que no ocupe medio mundo */
@media (max-width: 768px){
  .reply-preview-wrapper {
    padding: 6px 8px;
  }
  
  .reply-preview{
    margin: 0;
    padding: 7px 10px;
    padding-right: 36px;  /* ← MÁS ESPACIO PARA BOTÓN X EN MÓVIL */
    border-radius: 12px;
    width: 100%;  /* ← 100% del wrapper */
    max-width: calc(100vw - 32px);  /* ← Viewport - margins */
    box-sizing: border-box;  /* ← FIX SAFARI */
    overflow: hidden;  /* ← FIX SAFARI */
  }
}


.msg-reply-quote{
  display:flex;
  gap:8px;
  align-items:center;
  margin: 2px 0 6px;
  padding:6px 8px;
  border-radius:12px;
  background: rgba(0,0,0,.06);
  max-width: 100%;
}

.msg-reply-quote .mrq-bar{
  width:3px;
  height:22px;
  border-radius:999px;
  background: rgba(0,0,0,.25);
  flex:0 0 3px;
}

.msg-reply-quote .mrq-text{
  font-size:12px;
  line-height:1.2;
  opacity:.85;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
}
