/* Reply-to-message and reactions, shared by the agent page and the admin page */
.chat-row { display: flex; flex-direction: column; max-width: 82%; position: relative; }
.chat-row.me { align-self: flex-end; align-items: flex-end; }
.chat-row.them { align-self: flex-start; align-items: flex-start; }
.chat-row .chat-msg { max-width: 100%; min-width: 0; cursor: pointer; outline: none; align-self: auto; }
.chat-row .chat-msg:focus-visible { box-shadow: 0 0 0 2px #fff; }
.chat-row.picked .chat-msg { filter: brightness(1.15); }
.chat-row.flash .chat-msg { animation: chatFlash 1.2s ease; }
@keyframes chatFlash { 0%, 40% { box-shadow: 0 0 0 3px #FFD60A; } 100% { box-shadow: 0 0 0 0 transparent; } }

.chat-line { display: flex; align-items: center; gap: 4px; max-width: 100%; }
.chat-row.me .chat-line { flex-direction: row-reverse; }
.chat-acts { display: flex; gap: 2px; opacity: 0; transition: opacity .15s ease; flex: none; }
.chat-row:hover .chat-acts, .chat-acts:focus-within { opacity: 1; }
@media (hover: none) { .chat-acts { display: none; } }
.chat-act {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: #8E8E93; display: flex; align-items: center; justify-content: center;
}
.chat-act:hover, .chat-act:focus-visible { background: #2C2C2E; color: #fff; outline: none; }

/* Quoted message above a reply */
.chat-quote {
  display: flex; flex-direction: column; gap: 2px; max-width: 100%; margin-bottom: -6px; padding: 6px 12px 12px;
  background: #3A3A3C; color: #AEAEB2; border: none; border-radius: 14px; font: inherit; text-align: left; cursor: pointer;
  opacity: .9;
}
.chat-row.me .chat-quote { text-align: right; }
.chat-quote-who { font-size: 11px; font-weight: 600; color: #8E8E93; }
.chat-quote-text { font-size: 13px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.chat-row .chat-quote + .chat-line .chat-msg { position: relative; }

/* Reactions under the bubble */
.chat-reacts {
  margin-top: -8px; position: relative; z-index: 1; padding: 1px 6px; border-radius: 999px;
  background: #2C2C2E; border: 2px solid #1C1C1E; color: #fff; font: inherit; font-size: 13px; line-height: 18px; cursor: pointer;
}
.chat-row.me .chat-reacts { margin-right: 6px; }
.chat-row.them .chat-reacts { margin-left: 6px; }

/* Reaction picker */
.chat-picker {
  position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px 6px;
  background: #2C2C2E; border: 1px solid #48484A; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: chatPickerIn .18s cubic-bezier(.2,.8,.2,1) both;
}
.chat-picker[hidden] { display: none; }
@keyframes chatPickerIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.chat-picker-emoji {
  width: 36px; height: 36px; border: none; border-radius: 50%; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; transition: transform .12s ease;
}
.chat-picker-emoji:hover, .chat-picker-emoji:focus-visible { transform: scale(1.25); outline: none; }
.chat-picker-emoji.on { background: #48484A; }
.chat-picker-reply {
  width: 34px; height: 34px; margin-left: 2px; border: none; border-left: 1px solid #48484A; border-radius: 0 999px 999px 0;
  background: transparent; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* "Replying to" bar above the input */
.chat-replybar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid #38383A; background: #1C1C1E; }
.chat-replybar[hidden] { display: none; }
.chat-replybar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.chat-replybar-text strong { font-size: 12px; color: #fff; }
.chat-replybar-text span { color: #8E8E93; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-replybar-close { flex: none; width: 28px; height: 28px; border: none; border-radius: 50%; background: #2C2C2E; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.chat-replybar + .chat-form { border-top: none; }

@media (prefers-reduced-motion: reduce) {
  .chat-picker, .chat-row.flash .chat-msg { animation: none; }
}
