/* ---- Comments (text-anchored threads, independent of Suggesting mode) --- */

.docx-editor-comment-highlight {
  background: rgba(255, 179, 0, 0.28);
  border-bottom: 1px solid rgba(230, 140, 0, 0.55);
  cursor: pointer;
}
.docx-editor-comment-highlight:hover {
  background: rgba(255, 179, 0, 0.42);
}
.docx-editor-comment-highlight[data-resolved='true'] {
  background: transparent;
  border-bottom: 1px dashed var(--de-border-raw);
  opacity: 0.7;
}

/* Toggle bubble pinned to the page's margin */
.docx-editor-comments-toggle {
  position: fixed;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--de-border-raw);
  background: #ffffff;
  color: var(--de-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--de-card-shadow);
  z-index: 9998;
}
.docx-editor-comments-toggle:hover {
  color: var(--de-text, #1f2328);
  background: var(--de-surface-hover);
}
.docx-editor-comments-toggle[data-active='true'] {
  color: #b45309;
  border-color: #f0b429;
}
.docx-editor-comments-toggle__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* Small "Add comment" button that appears near a text selection */
.docx-editor-comment-add-trigger {
  position: fixed;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--de-border-raw);
  background: #ffffff;
  color: var(--de-text, #1f2328);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  animation: docx-editor-suggestion-popover-in 100ms ease-out;
}
.docx-editor-comment-add-trigger:hover {
  background: var(--de-surface-hover);
}

/* Draggable panel */
.docx-editor-comments-panel {
  position: fixed;
  width: 300px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--de-border-raw);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.03);
  z-index: 10000;
  overflow: hidden;
  animation: docx-editor-suggestion-popover-in 100ms ease-out;
}
.docx-editor-comments-panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--de-border-raw);
  cursor: grab;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

/* Mobile presentation (see CommentsPanel.tsx's `mobile` branch): the same
   list content, inside a MobileSheet instead of a draggable card. */
.docx-editor-comments-sheet .docx-editor-sheet__body {
  padding: 0;
}
.docx-editor-comments-sheet .docx-editor-comments-panel__list {
  max-height: none;
}
.docx-editor-comments-panel__header[data-dragging='true'] {
  cursor: grabbing;
}
.docx-editor-comments-panel__grip {
  color: var(--de-text-muted);
  flex-shrink: 0;
}
.docx-editor-comments-panel__title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--de-text, #1f2328);
}
.docx-editor-comments-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--de-text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.docx-editor-comments-panel__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--de-text, #1f2328);
}

.docx-editor-comments-panel__list {
  max-height: 420px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.docx-editor-comments-panel__empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--de-text-muted);
}
.docx-editor-comments-panel__new {
  border-top: 1px solid var(--de-border-raw);
  padding: 8px;
  flex-shrink: 0;
}

/* One thread: collapsed snippet <-> expanded accordion */
.docx-editor-comment-thread {
  border: 1px solid var(--de-border-raw);
  border-radius: 8px;
  background: #ffffff;
}
.docx-editor-comment-thread[data-resolved='true'] {
  opacity: 0.6;
}
.docx-editor-comment-thread__head {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.docx-editor-comment-thread__avatar {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #5f6368;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.docx-editor-comment-thread__preview {
  flex: 1;
  min-width: 0;
}
.docx-editor-comment-thread__author-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.docx-editor-comment-thread__author {
  font-size: 12px;
  font-weight: 600;
  color: var(--de-text, #1f2328);
}
.docx-editor-comment-thread__time {
  font-size: 10px;
  color: var(--de-text-muted);
}
.docx-editor-comment-thread__quote {
  font-size: 10.5px;
  color: var(--de-text-muted);
  font-style: italic;
  margin: 2px 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docx-editor-comment-thread__snippet {
  font-size: 12px;
  color: var(--de-text, #1f2328);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.docx-editor-comment-thread__chevron {
  flex-shrink: 0;
  color: var(--de-text-muted);
  margin-top: 2px;
  transition: transform 120ms ease;
}
.docx-editor-comment-thread__chevron[data-expanded='true'] {
  transform: rotate(180deg);
}

.docx-editor-comment-thread__expanded {
  padding: 0 8px 8px;
}
.docx-editor-comment-thread__messages {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.docx-editor-comment-thread__message {
  font-size: 12px;
  line-height: 1.45;
  color: var(--de-text, #1f2328);
}
.docx-editor-comment-thread__message-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 1px;
}
.docx-editor-comment-thread__message-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.docx-editor-comment-thread__mention {
  color: #2563eb;
  font-weight: 600;
}
.docx-editor-comment-thread__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.docx-editor-comment-thread__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--de-border-raw);
  background: #ffffff;
  color: var(--de-text-muted);
  font-size: 11px;
  cursor: pointer;
}
.docx-editor-comment-thread__action-btn:hover {
  background: var(--de-surface-hover);
  color: var(--de-text, #1f2328);
}
.docx-editor-comment-thread__action-btn--danger:hover {
  color: #d93025;
  background: rgba(217, 48, 37, 0.08);
}

/* Composer: shared between new-thread creation and replies */
.docx-editor-comment-composer {
  position: relative;
  margin-top: 8px;
}
.docx-editor-comment-composer__row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.docx-editor-comment-composer__textarea {
  flex: 1;
  resize: none;
  min-height: 30px;
  max-height: 120px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--de-border-raw);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: var(--de-text, #1f2328);
}
.docx-editor-comment-composer__textarea:focus {
  outline: none;
  border-color: var(--de-primary, #3b82f6);
}
.docx-editor-comment-composer__send {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--de-accent, #3b82f6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.docx-editor-comment-composer__send:disabled {
  opacity: 0.4;
  cursor: default;
}

.docx-editor-comment-mention-menu {
  max-height: 200px;
  overflow-y: auto;
}
.docx-editor-comment-mention-menu__empty {
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--de-text-muted);
}
