/* Acciones de cada mensaje (app-chat-acciones.js): reacciones, responder,
   copiar, eliminar. Como WhatsApp, con la estética de DondeVoy. */

/* El cuerpo del mensaje no se selecciona al mantener pulsado (abre el menú) */
#chatMessages .chat-msg-body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
}

/* Mensaje elegido y mensaje al que se salta desde una cita */
#chatMessages .chat-msg.is-elegido .chat-msg-body {
  filter: brightness(1.18);
}
#chatMessages .chat-msg.is-destacado .chat-msg-body {
  box-shadow: 0 0 0 2px var(--accent, #d2f365);
  transition: box-shadow 0.2s ease;
}

/* Cita (respuesta a otro mensaje) dentro de la burbuja */
.chat-cita {
  min-height: 0 !important;
  display: grid;
  gap: 1px;
  width: 100%;
  min-width: 150px;
  margin: 0 0 2px;
  padding: 6px 10px;
  border: 0;
  border-left: 3px solid var(--cita-color, #d2f365);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-cita strong {
  font-size: 12.5px;
  color: var(--cita-color, #d2f365);
}
.chat-cita span {
  font-size: 13px;
  line-height: 1.35;
  color: rgba(244, 246, 239, 0.75);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
#chatPrivateModal .chat-msg.is-me .chat-cita {
  background: rgba(0, 0, 0, 0.12);
}
#chatPrivateModal .chat-msg.is-me .chat-cita strong {
  color: #20300a;
}
#chatPrivateModal .chat-msg.is-me .chat-cita span {
  color: rgba(17, 19, 15, 0.75);
}

/* «Se eliminó este mensaje» */
.chat-msg-eliminado {
  margin: 0;
  font-style: italic;
  color: rgba(244, 246, 239, 0.55) !important;
}
#chatPrivateModal .chat-msg.is-me .chat-msg-eliminado {
  color: rgba(17, 19, 15, 0.6) !important;
}
.chat-msg.is-eliminado .chat-msg-body {
  opacity: 0.85;
}

/* Reacciones debajo de la burbuja */
#chatMessages .chat-msg.con-reacciones {
  margin-bottom: 14px;
}
.chat-reacciones {
  position: absolute;
  bottom: -14px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  /* Los botones de la web tienen 44px de alto mínimo: aquí no. */
  height: 26px;
  min-height: 0 !important;
  padding: 0 7px;
  border: 2px solid #0b0c0a;
  border-radius: 999px;
  background: #22261e;
  color: #f4f6ef;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
#chatPrivateModal .chat-msg.is-me .chat-reacciones {
  left: auto;
  right: 10px;
}
.chat-reacciones.is-mia {
  background: #2d3624;
}
.chat-reacciones em {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  margin-left: 3px;
  color: #cfd3c6;
}
.chat-reacciones img.emoji {
  width: 15px;
  height: 15px;
}

/* Respondiendo a… (encima de la caja de escribir) */
.chat-respuesta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 8px 8px 8px 12px;
  border-left: 3px solid var(--accent, #d2f365);
  border-radius: 10px;
  background: #171915;
}
.chat-respuesta.hidden {
  display: none;
}
.chat-respuesta-cita {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 1px;
}
.chat-respuesta-cita strong {
  font-size: 12.5px;
  color: var(--accent, #d2f365);
}
.chat-respuesta-cita span {
  font-size: 13px;
  color: #a9ae9f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-respuesta-quitar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #cfd3c6;
}

/* Hoja de acciones: reacciones arriba, opciones debajo (abajo del todo, como
   un menú del móvil) */
.chat-hoja-acciones {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3000;
  width: min(420px, calc(100vw - 24px));
  padding: 10px;
  border-radius: 20px;
  background: #171915;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 8px;
  animation: chat-hoja-entra 0.16s ease;
}
.chat-hoja-acciones.hidden {
  display: none;
}
@keyframes chat-hoja-entra {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}
.chat-hoja-reacciones {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #22261e;
}
.chat-hoja-reacciones button {
  flex: 1 1 0;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.chat-hoja-reacciones button:hover,
.chat-hoja-reacciones button:focus-visible {
  transform: scale(1.15);
}
.chat-hoja-reacciones button.is-mia {
  background: rgba(210, 243, 101, 0.22);
}
.chat-hoja-reacciones img.emoji {
  width: 26px;
  height: 26px;
}
.chat-hoja-opciones {
  display: grid;
}
.chat-hoja-opciones button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #f4f6ef;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.chat-hoja-opciones button:hover,
.chat-hoja-opciones button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}
.chat-hoja-opciones button i {
  width: 20px;
  text-align: center;
  color: #a9ae9f;
}
.chat-hoja-opciones button.is-peligro,
.chat-hoja-opciones button.is-peligro i {
  color: #ff8a80;
}

/* --- Menú ⋮ de los chats privados (app-chat-opciones.js) ---------------- */
.chat-bloqueado-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 8px 8px 8px 14px;
  border-radius: 14px;
  background: #171915;
  color: #cfd3c6;
  font-size: 14px;
}
.chat-bloqueado-bar.hidden,
#chatPrivateModal .chat-compose.hidden {
  display: none !important;
}
.chat-bloqueado-bar i {
  color: #ff8a80;
  margin-right: 6px;
}
.chat-bloqueado-bar button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(210, 243, 101, 0.14);
  color: var(--accent, #d2f365);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.chat-thread-silenciado,
.chat-conv-silenciado {
  color: #8b9083;
  font-size: 13px;
}
.chat-thread-silenciado {
  margin-left: 6px;
}
.chat-conv-silenciado {
  flex: 0 0 auto;
  margin-left: 6px;
}
/* La hoja de opciones del chat privado cubre todo el panel */
#chatOpcionesHoja {
  z-index: 45;
}
.chat-op-titulo {
  margin: 4px 12px 2px;
  font-size: 18px;
}
.chat-op-texto {
  margin: 0 12px 10px;
  color: #a9ae9f;
  font-size: 14px;
  line-height: 1.45;
}
.cgi-hoja-caja .chat-op-peligro {
  justify-content: center;
  margin-top: 6px;
  background: rgba(255, 138, 128, 0.12);
  color: #ff8a80;
  font-weight: 700;
}
.chat-op-motivos {
  display: grid;
  gap: 2px;
  margin: 0 4px 8px;
}
.chat-op-motivos label,
.chat-op-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}
.chat-op-motivos label:has(input:checked) {
  background: rgba(210, 243, 101, 0.1);
}
.chat-op-motivos input,
.chat-op-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent, #d2f365);
}
.chat-op-detalles {
  margin: 0 8px 6px;
  padding: 10px 12px;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #0b0c0a;
  color: #f4f6ef;
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
#chatOpcionesHoja .cgi-hoja-caja {
  max-height: 92%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Ticks del último mensaje en la lista de chats (app-chat.js chatConvTicksHtml) */
.chat-conv-preview .chat-conv-ticks {
  margin-right: 5px;
  font-size: 0.82em;
  color: #8b9083;
  vertical-align: 0;
}
.chat-conv-preview .chat-conv-ticks.is-leido {
  color: #4ade80;
}
