/* TreeKnow INBOX Web 2.2.5 | 11 nov 2026
   Responder y corazones FUERA de las burbujas; respuesta a cita
   anclada al mensaje nuevo, no al ancho de su referencia.
   Sin cambios de backend ni de notificaciones. */

/* El SVG ya introducido en 2.2.4 queda exactamente igual; solo cambiamos
   su posicionamiento. Absoluto => no aumenta la altura del mensaje. */
body .tkai .tkai-messages .tkai-bubble > .tk221-bubble-reply,
body .tkai .tkai-messages .tkai-bubble .tk225-answer-wrap > .tk221-bubble-reply {
  position: absolute !important;
  display: inline-flex !important;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  flex: none !important;
  margin: 0 !important;
  padding: 4px !important;
  top: auto !important;
  bottom: 21px !important; /* justo ARRIBA del corazón que está a bottom:-13px */
  z-index: 5 !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #8995a1 !important;
  box-shadow: none !important;
  opacity: .85;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body .tkai .tkai-messages .tkai-bubble > .tk221-bubble-reply::before,
body .tkai .tkai-messages .tkai-bubble .tk225-answer-wrap > .tk221-bubble-reply::before {
  flex: 0 0 17px !important;
  width: 17px !important;
  height: 17px !important;
  -webkit-mask-size: 17px 17px !important;
  mask-size: 17px 17px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-bot > .tk221-bubble-reply {
  right: -28px !important;
  left: auto !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user > .tk221-bubble-reply {
  left: -28px !important;
  right: auto !important;
}
body .tkai .tkai-messages .tkai-bubble .tk221-bubble-reply:hover,
body .tkai .tkai-messages .tkai-bubble .tk221-bubble-reply:focus-visible {
  color: #495869 !important;
  opacity: 1 !important;
}

/* El corazón conserva su DOM, eventos, animación y posición original.
   Lo fijamos a -13px para evitar que reglas heredadas lo desplacen. */
body .tkai .tkai-messages .tkai-bubble:not(.tkai-copy-card) > .tkai-heart {
  bottom: -13px !important;
  top: auto !important;
}

/* Caso especial: si el estudiante cita algo, la referencia puede ocupar
   220px y su respuesta ser 'Hola' (55px). Colocar el corazón respecto de la
   referencia lo dejaba flotando en el vacío. El renderizador envuelve SOLO
   la nueva respuesta en .tk225-answer-wrap, sin mover la cita. */
body .tkai .tkai-messages .tkai-bubble.tkai-user:has(> .tk221-quoted-message) > .tk225-answer-wrap {
  position: relative !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  align-self: flex-end !important;
  box-sizing: border-box !important;
  width: max-content !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user:has(> .tk221-quoted-message) > .tk225-answer-wrap > .tkai-message-caption {
  display: block !important;
  box-sizing: border-box !important;
  width: fit-content !important;
  max-width: 100% !important;
  padding: 9px 12px !important;
  background: #111 !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 12px !important;
  font-weight: 500 !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  box-shadow: none !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user:has(> .tk221-quoted-message) > .tk225-answer-wrap > .tkai-message-time {
  display: block !important;
  align-self: flex-end !important;
  color: #7d8796 !important;
  margin-top: 3px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user .tk225-answer-wrap > .tk221-bubble-reply,
body .tkai .tkai-messages .tkai-bubble.tkai-user .tk225-answer-wrap > .tkai-heart {
  left: -28px !important;
  right: auto !important;
  top: auto !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user .tk225-answer-wrap > .tk221-bubble-reply {
  bottom: 21px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user .tk225-answer-wrap > .tkai-heart {
  bottom: -13px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-user .tk225-answer-wrap > .tkai-heart[hidden] {
  display: none !important;
}

/* DATO COMPARTIDO: su corazón ya estaba por debajo de la tarjeta. Ambos
   controles quedan uno encima del otro por debajo (no en el texto). */
body .tkai .tkai-messages .tkai-bubble.tkai-copy-card {
  margin-bottom: 68px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-copy-card > .tk221-bubble-reply {
  left: auto !important;
  right: 9px !important;
  bottom: -23px !important;
}
body .tkai .tkai-messages .tkai-bubble.tkai-copy-card > .tkai-heart {
  left: auto !important;
  right: 9px !important;
  top: auto !important;
  bottom: -55px !important;
}

/* El texto / hora son los únicos contenidos visuales de las burbujas;
   los iconos están fuera, sin ocupar altura. Accesibilidad conservada. */
@media (prefers-reduced-motion: reduce) {
  body .tkai .tkai-messages .tkai-bubble .tk221-bubble-reply { transition: none !important; }
}
