/* Reply quotes — Telegram-like, readable on own & peer bubbles */

.chat-reply-quote {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 7px 10px 7px 11px;
  border: 0;
  border-left: 3px solid #4c6fff;
  border-radius: 10px;
  background: #eef2ff;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.chat-reply-quote:hover {
  background: #e4eaff;
  box-shadow: 0 1px 0 rgba(76, 111, 255, 0.12);
}
.chat-reply-quote__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.chat-reply-quote__icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #4c6fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.chat-reply-quote__texts {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-reply-quote__name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: #2f4fd6;
}
.chat-reply-quote__text {
  font-size: 13px;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #475569;
}

/* Inside own (blue) bubble — light glass quote */
.chat-message--own .chat-message__bubble .chat-reply-quote,
.chat-widget__msg--own .chat-message__bubble .chat-reply-quote {
  border-left-color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.2);
}
.chat-message--own .chat-message__bubble .chat-reply-quote:hover,
.chat-widget__msg--own .chat-message__bubble .chat-reply-quote:hover {
  background: rgba(255, 255, 255, 0.28);
}
.chat-message--own .chat-message__bubble .chat-reply-quote__name,
.chat-widget__msg--own .chat-message__bubble .chat-reply-quote__name {
  color: #fff;
}
.chat-message--own .chat-message__bubble .chat-reply-quote__text,
.chat-widget__msg--own .chat-message__bubble .chat-reply-quote__text {
  color: rgba(255, 255, 255, 0.92);
}
.chat-message--own .chat-message__bubble .chat-reply-quote__icon,
.chat-widget__msg--own .chat-message__bubble .chat-reply-quote__icon {
  color: #fff;
}

/* Quote sitting above the bubble (legacy layout) — always dark-on-light */
.chat-message__body > .chat-reply-quote,
.chat-message__content > .chat-reply-quote,
.message > .chat-reply-quote {
  max-width: min(420px, 85%);
  border-left-color: #4c6fff;
  background: linear-gradient(90deg, #eef2ff 0%, #f8fafc 100%);
}
.chat-message__body > .chat-reply-quote .chat-reply-quote__name,
.chat-message__content > .chat-reply-quote .chat-reply-quote__name,
.message > .chat-reply-quote .chat-reply-quote__name {
  color: #2f4fd6;
}
.chat-message__body > .chat-reply-quote .chat-reply-quote__text,
.chat-message__content > .chat-reply-quote .chat-reply-quote__text,
.message > .chat-reply-quote .chat-reply-quote__text {
  color: #475569;
}
.chat-message__body > .chat-reply-quote .chat-reply-quote__icon,
.chat-message__content > .chat-reply-quote .chat-reply-quote__icon,
.message > .chat-reply-quote .chat-reply-quote__icon {
  color: #4c6fff;
}
.chat-message--own .chat-message__body > .chat-reply-quote {
  align-self: flex-end;
}

/* Unified bubble shell (conversation / support) */
.chat-message__bubble {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: min(420px, 85%);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e8edf5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.chat-message--own .chat-message__bubble {
  background: linear-gradient(145deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
}
.chat-message__bubble .chat-reply-quote {
  margin: 8px 8px 0;
  width: auto;
}
.chat-message__bubble .chat-message__text,
.support-chat .chat-message__bubble .chat-message__text,
.support-chat .chat-message--own .chat-message__bubble .chat-message__text {
  background: transparent !important;
  box-shadow: none !important;
  max-width: none !important;
  border-radius: 0;
  color: inherit;
}
.support-chat .chat-message--own .chat-message__bubble .chat-message__text {
  color: #fff;
}
.support-chat .chat-message--own .chat-message__bubble .chat-message__text--stacked .chat-message__lead {
  color: #fff;
}
.chat-message__bubble .chat-message__attachment {
  padding: 6px 8px 8px;
}
.chat-message__bubble .chat-message__image {
  display: block;
  max-width: 100%;
  border-radius: 10px;
}

/* Composer reply bar */
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #d7e0ff;
  border-left: 3px solid #4c6fff;
  border-radius: 12px;
  background: #f0f4ff;
  box-shadow: 0 1px 0 rgba(76, 111, 255, 0.06);
}
.chat-reply-bar[hidden] { display: none !important; }
.chat-reply-bar__body { flex: 1; min-width: 0; }
.chat-reply-bar__name { font-size: 12px; font-weight: 700; color: #2f4fd6; }
.chat-reply-bar__text {
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-reply-bar__cancel {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.chat-reply-bar__cancel:hover {
  background: rgba(100, 116, 139, 0.12);
  color: #0f172a;
}

/* Context menu */
.chat-reply-menu {
  position: fixed;
  z-index: 4000;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8edf5;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}
.chat-reply-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: #0f172a;
}
.chat-reply-menu button:hover { background: #f1f5f9; }
.chat-reply-menu button i {
  width: 16px;
  color: #64748b;
  text-align: center;
}

/* PC: message selected as reply target */
.chat-message--replying,
.message--replying {
  position: relative;
  z-index: 1;
}
.chat-message--replying::before,
.message--replying::before {
  content: "";
  position: absolute;
  inset: -8px -10px;
  border-radius: 16px;
  background: rgba(76, 111, 255, 0.1);
  border: 1.5px solid rgba(76, 111, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(76, 111, 255, 0.08);
  pointer-events: none;
}

/* Jump-to-quote flash */
.chat-reply-flash {
  animation: chatReplyFlash 1.15s ease;
  border-radius: 14px;
}
@keyframes chatReplyFlash {
  0%,
  35% {
    background: rgba(76, 111, 255, 0.16);
    box-shadow: 0 0 0 3px rgba(76, 111, 255, 0.4);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 rgba(76, 111, 255, 0);
  }
}
