/* comment.css */

/* 댓글 레이아웃 */
.comment-tree {
  margin-top: 12px;
}

.comment-node {
  padding: 10px 0;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-writer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.comment-time {
  font-size: 0.85rem;
  color: #888;
}

.comment-edited {
  font-size: 0.8rem;
  color: #999;
}

.comment-content {
  margin: 4px 0 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-mention-text {
  color: #065fd4;
  font-weight: 600;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #606060;
}

/* 댓글 아래 액션 버튼은 텍스트 링크 스타일 */
.comment-actions button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.comment-actions button:hover {
  text-decoration: underline;
}

.comment-edit-form,
.comment-reply-form {
  margin-top: 8px;
}

.comment-edit-form textarea,
.comment-reply-form textarea,
.comment-form textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
}

/* 답글 멘션 블록 */
.comment-reply-form {
  position: relative;
}

.comment-mention-wrap {
  position: relative;
}

.comment-mention-pill {
  position: absolute;
  left: 10px;
  top: 9px;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f0fe;
  color: #065fd4;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

.comment-mention-pill[hidden] {
  display: none !important;
}

.comment-mention-pill:empty {
  display: none !important;
}

.comment-mention-pill + textarea {
  padding-left: 10px;
}

.comment-mention-pill:not([hidden]) + textarea {
  padding-left: 110px;
}

/* 댓글 작성 폼 */
.comment-form {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.comment-form-body {
  flex: 1;
  min-width: 0;
}

.comment-form textarea {
  border: none;
  border-bottom: 1px solid #ddd;
  border-radius: 0;
  padding: 8px 0;
  min-height: 40px;
}

.comment-form-actions {
  display: none;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.comment-form.comment-form-active .comment-form-actions {
  display: flex;
}

.comment-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* 답글/수정/댓글 폼 버튼 스타일 통일 */
/* .btn, .btn-primary을 사용하는 버튼은 덮어쓰지 않음 */
.comment-form-actions button:not(.btn),
.comment-edit-form button:not(.btn),
.comment-reply-actions button:not(.btn) {
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  color: #333;
}

.comment-form-actions button:not(.btn):hover,
.comment-edit-form button:not(.btn):hover,
.comment-reply-actions button:not(.btn):hover {
  background: #f2f2f2;
}

.comment-replies-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #065fd4;
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-replies-toggle:hover {
  text-decoration: underline;
}

/* 답글 더보기 버튼 (JS로 생성되는 버튼) */
.comment-children-more {
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #065fd4;
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-children-more:hover {
  text-decoration: underline;
}

.comment-children-more:disabled {
  opacity: 0.6;
  cursor: default;
}

.comment-children-more:focus-visible {
  outline: 2px solid rgba(44, 126, 251, 0.35);
  outline-offset: 2px;
}

.comment-children {
  display: none;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid #eee;
}

.comment-children.is-open {
  display: block;
}

.comment-deleted {
  color: #888;
  font-size: 0.9rem;
  padding: 6px 0;
}

/* 댓글 하이라이트 */
.comment-node.comment-focus {
  border: 2px solid #9cc9ff;
  border-radius: 12px;
  background: transparent;
  padding: 8px 10px;
}

.comment-node.comment-flash {
  animation: commentFlash 1.2s ease-out;
}

@keyframes commentFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(156, 201, 255, 0.0);
  }
  30% {
    box-shadow: 0 0 0 6px rgba(156, 201, 255, 0.35);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(156, 201, 255, 0.0);
  }
}
