/* =========================================
   COMMENTS.CSS — unified final version
   Усі стилі коментарів в одному місці
   ========================================= */

/* =========================
   Comments block shell
   ========================= */

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.comments-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
}

.comments-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);
  font-weight: 800;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition:
    background-color .22s ease,
    border-color .22s ease,
    transform .08s ease,
    box-shadow .22s ease;
}

.comments-toggle:hover {
  background: var(--btn-surface-hover);
}

.comments-toggle:active {
  transform: translateY(1px);
}

.comments-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.comments-body {
  content-visibility: auto;
  contain-intrinsic-size: 1px 420px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comments-empty {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.35;
}

.comments-auth-hint {
  color: var(--muted);
  margin: 4px 0 10px;
  font-size: .95rem;
  line-height: 1.35;
}

/* =========================
   Main comment form
   ========================= */

.comment-form {
  margin: 0 0 12px;
}

.comment-textarea,
.comment__textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 14px;
  background: #111418;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f5f7fb;
  font-size: .95rem;
  line-height: 1.35;
}

.comment-textarea {
  min-height: 84px;
}

.comment__textarea {
  min-height: 76px;
}

.comment-textarea::placeholder,
.comment__textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.comment-textarea:focus,
.comment__textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, .60);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}

body.theme-light .comment-textarea,
body.theme-light .comment__textarea {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #111827;
}

body.theme-light .comment-textarea::placeholder,
body.theme-light .comment__textarea::placeholder {
  color: rgba(17, 24, 39, 0.45);
}

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

/* =========================
   Generic comment buttons
   ========================= */

.cbtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);
  font-size: .92rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color .22s ease,
    border-color .22s ease,
    transform .08s ease,
    box-shadow .22s ease;
}

.cbtn:hover {
  background: var(--btn-surface-hover);
}

.cbtn:active {
  transform: translateY(1px);
}

.cbtn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.cbtn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.cbtn-danger {
  border-color: rgba(239, 68, 68, .42);
  background: rgba(239, 68, 68, .12);
  color: #fca5a5;
}

.cbtn-danger:hover {
  background: rgba(239, 68, 68, .18);
  border-color: rgba(239, 68, 68, .55);
}

body.theme-light .cbtn-danger {
  color: #b91c1c;
}

.cbtn-warn {
  border-color: rgba(245, 158, 11, .42);
  background: rgba(245, 158, 11, .12);
  color: #f5c16d;
}

.cbtn-warn:hover {
  background: rgba(245, 158, 11, .18);
  border-color: rgba(245, 158, 11, .55);
}

body.theme-light .cbtn-warn {
  color: #92400e;
}

.cbtn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.cbtn-ghost:hover {
  background: rgba(255, 255, 255, .08);
  border-color: var(--btn-border);
}

body.theme-light .cbtn-ghost:hover {
  background: rgba(0, 0, 0, .05);
}

/* =========================
   One comment
   ========================= */

.comment {
  position: relative;
  display: flex;
  gap: 4px;
  min-width: 0;
  padding-left: calc(1px + min(var(--level, 0), 12) * 5px);
}

.comment--root {
  padding-left: 0;
}

.comment__rail {
  position: absolute;
  left: calc(min(var(--level, 0), 12) * 5px);
  top: 2px;
  bottom: 2px;
  width: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.comment--root > .comment__rail {
  display: none;
}

body.theme-light .comment__rail {
  background: rgba(0, 0, 0, 0.12);
}

.comment__body {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 0;
}

/* =========================
   Top row
   ========================= */

.comment__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.comment__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.comment__author-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.comment__author-main {
  min-width: 0;
  flex: 1 1 auto;
}

.comment__author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.comment__avatar,
.comment__avatar-fallback {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.comment__avatar {
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

body.theme-light .comment__avatar {
  border-color: rgba(0, 0, 0, 0.10);
}

.comment__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  font-weight: 800;
  font-size: .9rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

body.theme-light .comment__avatar-fallback {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.10);
}

.comment__username {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.1;
  word-break: break-word;
}

.comment__rep {
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.02;
  white-space: nowrap;
}

.comment__meta-line {
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment__date {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.05;
}

.comment__deleted {
  color: #d9a35f;
  font-size: .88rem;
  line-height: 1.05;
}

/* =========================
   Comment menu
   ========================= */

.comment__menu-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.comment__vote-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.comment__vote-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  transition:
    background-color .22s ease,
    border-color .22s ease,
    color .22s ease,
    transform .08s ease,
    box-shadow .22s ease;
}

.comment__vote-btn:hover:not(:disabled) {
  background: var(--btn-surface-hover);
  color: var(--text);
}

.comment__vote-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.comment__vote-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.comment__vote-btn:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.comment__vote-btn.is-active.comment__vote-btn--up {
  color: #22c55e;
  border-color: rgba(34, 197, 94, .42);
  background: rgba(34, 197, 94, .12);
}

.comment__vote-btn.is-active.comment__vote-btn--down {
  color: #ef4444;
  border-color: rgba(239, 68, 68, .42);
  background: rgba(239, 68, 68, .12);
}

.comment__vote-score {
  min-width: 22px;
  text-align: center;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1;
  color: var(--muted);
  transition: color .22s ease;
}

.comment__vote-score.is-positive {
  color: #22c55e;
}

.comment__vote-score.is-negative {
  color: #ef4444;
}

body.theme-light .comment__vote-btn.is-active.comment__vote-btn--up {
  color: #15803d;
  border-color: rgba(21, 128, 61, .34);
  background: rgba(34, 197, 94, .10);
}

body.theme-light .comment__vote-btn.is-active.comment__vote-btn--down {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, .30);
  background: rgba(239, 68, 68, .10);
}

body.theme-light .comment__vote-score.is-positive {
  color: #15803d;
}

body.theme-light .comment__vote-score.is-negative {
  color: #b91c1c;
}

.comment__menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: var(--btn-surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  transition:
    background-color .22s ease,
    border-color .22s ease,
    transform .08s ease,
    box-shadow .22s ease;
}

.comment__menu-btn:hover {
  background: var(--btn-surface-hover);
}

.comment__menu-btn:active {
  transform: translateY(1px);
}

.comment__menu-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.comment__menu-btn[aria-expanded="true"] {
  background: var(--btn-surface-hover);
}

.comment__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  border-radius: 14px;
  padding: 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.30);
  z-index: 40;
}

.comment__menu-form {
  margin: 0;
}

.comment__menu-item {
  width: 100%;
  display: block;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: .93rem;
  line-height: 1.2;
}

.comment__menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-light .comment__menu-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.comment__menu-item--danger {
  color: #d88a5a;
}

/* =========================
   Text + actions
   ========================= */

.comment__text {
  margin: 4px 0 0 34px;
  color: var(--text);
  font-size: .98rem;
  line-height: 1.24;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment__text--deleted {
  opacity: .78;
}

.comment__bottom {
  margin: 5px 0 0 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.comment__reply-btn,
.comment__toggle-replies,
.comment__hide-replies {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border-radius: 999px;
}

.comment__toggle-count {
  opacity: .92;
}

.comment__toggle-icon,
.comment__hide-icon {
  font-size: .9rem;
  line-height: 1;
}

.comment__bottom:empty {
  display: none;
}

.comments-more-wrap{
  margin-top:14px;
  display:flex;
  justify-content:center;
}

.comments-more-btn{
  min-width:180px;
}

/* =========================
   Reply form
   ========================= */

.comment__reply-form {
  margin: 5px 0 0 34px;
}

.comment__reply-actions {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

/* =========================
   Replies tree
   ========================= */

.comment__replies {
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment__replies .comment__replies {
  margin-top: 1px;
  gap: 2px;
}

.comment__reply-item {
  min-width: 0;
}

/* =========================
   Tail controls for root
   ========================= */

.comment__tail-controls {
  margin: 5px 0 0 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.comment__tail-controls:empty {
  display: none;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 760px) {
  .comment {
    gap: 4px;
    padding-left: calc(1px + min(var(--level, 0), 12) * 4px);
  }

  .comment__rail {
    left: calc(min(var(--level, 0), 12) * 4px);
    width: 1px;
  }

  .comment__top {
    gap: 6px;
  }

  .comment__author-line {
    gap: 6px;
  }

  .comment__avatar,
  .comment__avatar-fallback {
    width: 30px;
    height: 30px;
  }

  .comment__text,
  .comment__bottom,
  .comment__reply-form,
  .comment__tail-controls {
    margin-left: 32px;
  }

  .comment__menu {
    min-width: 170px;
    right: 0;
  }

  .comment__author-row {
    gap: 5px;
  }

  .comment__username {
    font-size: .98rem;
  }

  .comment__rep,
  .comment__date {
    font-size: .88rem;
  }

  .comment__replies {
    margin-top: 3px;
    gap: 4px;
  }

  .comment__replies .comment__replies {
    margin-top: 1px;
    gap: 2px;
  }
}