/* yanxin:im-quote-scroll-hotpatch v8 — quote block + layout fix */
.quote-block {
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  margin: 0 0 6px;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button.quote-block,
button.im-quote-block {
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.im-shell[data-im-theme='dark'] .quote-block {
  background: rgba(255, 255, 255, 0.1);
}

.im-msg-row.self .quote-block,
.im-bubble--self-wx .quote-block {
  background: rgba(255, 255, 255, 0.22) !important;
}

.quote-bar {
  width: 3px;
  background: var(--wx-green, #07c160);
  flex-shrink: 0;
}

.im-msg-row.self .quote-bar,
.im-bubble--self-wx .quote-bar {
  background: rgba(255, 255, 255, 0.85) !important;
}

.quote-content {
  padding: 4px 8px;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
  min-width: 0;
  flex: 1;
}

.im-msg-row.self .quote-content,
.im-bubble--self-wx .quote-content {
  color: rgba(255, 255, 255, 0.88) !important;
}

.quote-name {
  font-weight: 500;
  margin-right: 4px;
  color: #576b95;
}

.im-msg-row.self .quote-name,
.im-bubble--self-wx .quote-name {
  color: rgba(255, 255, 255, 0.96) !important;
}

.quote-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.yx-quote-body-text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.message-bubble-inline__body.yx-has-quote,
.message-bubble__body.yx-has-quote {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100%;
}

.im-msg-row.yx-has-quote .im-msg-col {
  max-width: min(78%, var(--im-bubble-max-width, 520px));
}

.im-msg-row.highlight-flash .im-bubble,
.im-msg-row.highlight-flash .im-msg-col {
  animation: yx-flash-bg 2s ease-in-out;
  border-radius: 8px;
}

.im-msg-row.highlight-flash {
  background: transparent !important;
  animation: none !important;
}

@keyframes yx-flash-bg {
  0%, 100% { background: transparent; }
  10%, 30% { background: rgba(255, 200, 0, 0.2); }
}

.im-msg-row.highlight-flash .im-bubble {
  animation: none !important;
}

/* 仅在有发送失败图标时调整横向布局，避免破坏默认气泡排版 */
.im-msg-row.self .im-msg-bubble-stack:has(.wx-msg-error) {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
}

.im-msg-row.self .im-msg-bubble-stack:has(.wx-msg-error) > .wx-msg-error {
  order: -1;
}
