/* ---- AgentMention ("@" trigger + bubble) ------------------------------
   Was 100% inline-styled (see git history) — CSS-classed here so
   `injectedCss` / the `--de-*` theme tokens / dark mode can reach it,
   same as every other component in this package. */

.docx-editor-agent-mention-menu__hint {
  padding: 2px 10px 4px;
  font-size: 11px;
  color: var(--de-text-muted, #9ca3af);
  line-height: 1.4;
}

/* ---- Desktop floating card -------------------------------------------- */

.docx-editor-agent-mention-bubble {
  position: fixed;
  z-index: 1000;
  max-width: 92vw;
  background: var(--de-surface, #ffffff);
  border: 1px solid var(--de-border-raw, #d0d7de);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: 10px;
  font-size: 13px;
  color: var(--de-text, #1f2328);
}

.docx-editor-agent-mention-bubble__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.docx-editor-agent-mention-bubble__header[data-dragging='true'] {
  cursor: grabbing;
}
.docx-editor-agent-mention-bubble__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--de-text, #374151);
  flex: 1;
}
.docx-editor-agent-mention-bubble__grip {
  color: var(--de-border-raw, #d1d5db);
  font-size: 12px;
  letter-spacing: 1px;
}
.docx-editor-agent-mention-bubble__close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--de-text-muted, #9ca3af);
  font-size: 13px;
  padding: 2px;
  line-height: 1;
}

/* ---- Mobile sheet content ---------------------------------------------
   Same body markup as the desktop card, just wrapped in MobileSheet's
   own header/scrim instead of a positioned+draggable div — see
   AgentMentionBubble.tsx. */
.docx-editor-agent-mention-sheet .docx-editor-sheet__body {
  padding: 4px 12px 12px;
  font-size: 13px;
  color: var(--de-text, #1f2328);
}

/* ---- Shared body content (context chip, activity feed, input row) ----- */

.docx-editor-agent-mention__context {
  margin-bottom: 8px;
  padding: 5px 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--de-primary-foreground, #1e40af);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.docx-editor-agent-mention__context-label {
  flex-shrink: 0;
  font-weight: 600;
}
.docx-editor-agent-mention__context-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-style: italic;
}

.docx-editor-agent-mention__activity {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 8px;
  padding: 4px 8px;
  background: var(--de-surface-hover, #f9fafb);
  border: 1px solid var(--de-border-raw, #f0f1f3);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}
.docx-editor-agent-mention__working {
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--de-text-muted, #9ca3af);
  font-style: italic;
}

.docx-editor-agent-mention__input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.docx-editor-agent-mention__textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--de-border-raw, #e5e7eb);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: var(--de-text, #1f2328);
  background: var(--de-surface, #ffffff);
}
.docx-editor-agent-mention__textarea:focus {
  border-color: var(--de-primary, #3b82f6);
}
.docx-editor-agent-mention__send {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--de-border-raw, #e5e7eb);
  color: #fff;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.docx-editor-agent-mention__send:not(:disabled) {
  background: var(--de-accent, #2563eb);
  cursor: pointer;
}

.docx-editor-agent-mention__error {
  margin-top: 6px;
  font-size: 11px;
  color: #b91c1c;
}
.docx-editor-agent-mention__hint {
  margin-top: 6px;
  font-size: 10px;
  color: var(--de-text-muted, #9ca3af);
}

/* ---- Activity feed: user/assistant lines ------------------------------- */

.docx-editor-agent-activity__user-row {
  display: flex;
  justify-content: flex-end;
  padding: 3px 0;
}
.docx-editor-agent-activity__user-bubble {
  max-width: 85%;
  background: var(--de-accent, #2563eb);
  color: #fff;
  border-radius: 10px 10px 2px 10px;
  padding: 5px 9px;
  white-space: pre-wrap;
  word-break: break-word;
}
.docx-editor-agent-activity__assistant {
  padding: 3px 0;
  color: var(--de-text, #1f2328);
}

/* ---- Thinking row (collapsible reasoning block) ------------------------ */

.docx-editor-agent-thinking {
  margin: 4px 0;
  border-radius: 8px;
  border: 1px solid var(--de-border-raw, #eef0f2);
  background: var(--de-surface-hover, #fafafa);
}
.docx-editor-agent-thinking__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.docx-editor-agent-thinking__label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--de-text-muted, #9ca3af);
  flex: 1;
}
.docx-editor-agent-thinking__chevron {
  color: var(--de-text-muted, #9ca3af);
  flex-shrink: 0;
  transition: transform 120ms ease;
}
.docx-editor-agent-thinking__chevron[data-expanded='true'] {
  transform: rotate(180deg);
}
.docx-editor-agent-thinking__text {
  padding: 0 8px 6px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--de-text-muted, #8b8f97);
  font-style: italic;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.docx-editor-agent-thinking__text[data-expanded='true'] {
  max-height: 180px;
  overflow-y: auto;
  display: block;
  -webkit-line-clamp: unset;
}

/* ---- Tool call timeline ------------------------------------------------- */

.docx-editor-agent-tool-timeline {
  margin: 4px 0;
  display: flex;
  flex-direction: column;
}
.docx-editor-agent-tool-row {
  display: flex;
  gap: 7px;
}
.docx-editor-agent-tool-row__rail {
  width: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.docx-editor-agent-tool-row__dot {
  margin-top: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--de-text-muted, #9ca3af);
  flex-shrink: 0;
}
.docx-editor-agent-tool-row__dot[data-status='done'] {
  background: #059669;
}
.docx-editor-agent-tool-row__dot[data-status='error'] {
  background: #dc2626;
}
.docx-editor-agent-tool-row__line {
  flex: 1;
  width: 1px;
  background: var(--de-border-raw, #e5e7eb);
  margin-top: 2px;
}
.docx-editor-agent-tool-row__content {
  flex: 1;
  padding-bottom: 5px;
  min-width: 0;
}
.docx-editor-agent-tool-row__content[data-last='true'] {
  padding-bottom: 2px;
}
.docx-editor-agent-tool-row__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 1px 0;
  text-align: left;
}
.docx-editor-agent-tool-row__label {
  font-size: 11.5px;
  color: var(--de-text, #4b5563);
  flex: 1;
}
.docx-editor-agent-tool-row__ellipsis {
  color: var(--de-text-muted, #9ca3af);
}
.docx-editor-agent-tool-row__chevron {
  color: var(--de-border-raw, #c1c5cb);
  flex-shrink: 0;
  transition: transform 120ms ease;
}
.docx-editor-agent-tool-row__chevron[data-expanded='true'] {
  transform: rotate(180deg);
}
.docx-editor-agent-tool-row__details {
  margin-top: 3px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--de-surface-hover, #f8f9fa);
  border: 1px solid var(--de-border-raw, #f0f0f0);
  font-family: monospace;
  font-size: 10.5px;
  color: var(--de-text-muted, #6b7280);
  white-space: pre-wrap;
  word-break: break-word;
}
.docx-editor-agent-tool-row__details-name {
  color: var(--de-text-muted, #9ca3af);
  margin-bottom: 3px;
}
.docx-editor-agent-tool-row__details-result {
  margin-top: 4px;
  color: #059669;
}
.docx-editor-agent-tool-row__details-result[data-status='error'] {
  color: #dc2626;
}

/* ---- Shared "working" pulse dots ---------------------------------------- */

.docx-editor-agent-pulse-dots {
  display: inline-flex;
  gap: 3px;
}
.docx-editor-agent-pulse-dots__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--de-border-raw, #cbd5e1);
  display: inline-block;
  animation: docx-editor-agent-pulse 1.4s infinite;
}
.docx-editor-agent-pulse-dots__dot:nth-child(2) {
  animation-delay: 0.2s;
}
.docx-editor-agent-pulse-dots__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes docx-editor-agent-pulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}
