/* =========================
   OVERLAY COMENTÁRIOS
========================= */

.comments-overlay {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.58);

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.25s ease;

  z-index: 99990;
}

.comments-overlay.active {
  opacity: 1;
  pointer-events: auto;
}


/* =========================
   DRAWER COMENTÁRIOS
========================= */

.comments-drawer {
  position: fixed;

  left: 0;
  bottom: 0;

  width: 100%;
  height: 72vh;

  display: flex;
  flex-direction: column;

  background: #0d1424;

  border-radius: 26px 26px 0 0;

  transform: translateY(100%);

  transition:
    transform 0.32s cubic-bezier(.22, .8, .28, 1);

  z-index: 99999;

  overflow: hidden;
}

.comments-drawer.active {
  transform: translateY(0);
}


/* =========================
   HANDLE
========================= */

.comments-handle {
  flex: 0 0 auto;

  width: 54px;
  height: 5px;

  margin: 12px auto 4px;

  border-radius: 999px;

  background: rgba(255, 255, 255, 0.22);
}


/* =========================
   HEADER
========================= */

.comments-header {
  flex: 0 0 auto;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 10px 18px 14px;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.08);
}

.comments-header h2 {
  margin: 0;

  color: #f3f6ff;

  font-size: 20px;
  font-weight: 700;
}

#closeCommentsDrawer {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 0;
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.06);

  color: #dfe6f5;

  font-size: 18px;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

#closeCommentsDrawer:active {
  transform: scale(0.92);
}


/* =========================
   LISTA
========================= */

.comments-list {
  flex: 1;

  min-height: 0;

  overflow-y: auto;
  overscroll-behavior: contain;

  padding: 14px 16px 22px;
}


/* =========================
   COMENTÁRIO
========================= */

.community-comment {
  display: flex;
  align-items: flex-start;

  gap: 10px;

  padding: 12px 0;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.06);
}

.community-comment:last-child {
  border-bottom: 0;
}

.community-comment-avatar {
  width: 42px;
  height: 42px;

  flex: 0 0 auto;

  object-fit: cover;

  border-radius: 50%;

  background: #131c30;
}

.community-comment-body {
  flex: 1;

  min-width: 0;
}

.community-comment-meta {
  display: flex;
  align-items: center;

  gap: 8px;

  margin-bottom: 4px;
}

.community-comment-meta strong {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #f4f7ff;

  font-size: 14px;
  font-weight: 700;
}

.community-comment-meta span {
  flex: 0 0 auto;

  padding: 3px 7px;

  border-radius: 999px;

  background: rgba(47, 114, 255, 0.15);

  color: #73a6ff;

  font-size: 11px;
  font-weight: 700;
}

.community-comment-body p {
  margin: 0 0 7px;
  
  color: #d2d8e5;
  
  font-size: 14px;
  line-height: 1.45;
  
  white-space: normal;
  overflow-wrap: anywhere;
}

.community-comment-body time {
  color: #707c92;

  font-size: 11px;
}


/* =========================
   FORMULÁRIO
========================= */

.comment-form {
  flex: 0 0 auto;

  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px 10px;

  padding:
    12px
    14px
    calc(12px + env(safe-area-inset-bottom));

  background: #0d1424;

  border-top:
    1px solid rgba(255, 255, 255, 0.08);
}

#commentText {
  grid-column: 1;
  
  width: 100%;
  min-width: 0;
  
  min-height: 44px;
  max-height: 120px;
  
  resize: none;
  
  padding: 11px 14px;
  
  border:
    1px solid rgba(255, 255, 255, 0.1);
  
  border-radius: 18px;
  
  outline: none;
  
  background: #151f34;
  
  color: #eef3ff;
  
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}

#commentSubmit {
  grid-column: 2;
  
  align-self: end;
  
  width: 44px;
  height: 44px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  border: 0;
  border-radius: 50%;
  
  background: #3478f6;
  
  color: #fff;
  
  font-size: 16px;
}

#commentText::placeholder {
  color: #78849a;
}

#commentText:focus {
  border-color: #3478f6;
}


#commentSubmit:active {
  transform: scale(0.9);
}

#commentSubmit:disabled {
  opacity: 0.5;
}


/* =========================
   ESTADOS
========================= */

.comments-loading,
.comments-error,
.empty-comments {
  min-height: 180px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 8px;

  padding: 30px 20px;

  text-align: center;

  color: #8490a6;
}

.empty-comments i {
  margin-bottom: 4px;

  font-size: 28px;

  color: #5e6b82;
}

.empty-comments strong {
  color: #dfe6f5;

  font-size: 15px;
}

.empty-comments span {
  font-size: 13px;
}

.community-comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  
  gap: 12px;
  
  margin-bottom: 5px;
}

.community-comment-top time {
  flex: 0 0 auto;
  
  color: #707c92;
  
  font-size: 11px;
}

.community-comment-body p {
  margin: 0 0 7px;
}

.community-comment-actions {
  display: flex;
  align-items: center;
  
  gap: 16px;
}

.community-comment-actions button {
  padding: 0;
  
  border: 0;
  background: none;
  
  color: #7f8ba1;
  
  font-size: 12px;
  font-weight: 600;
  
  cursor: pointer;
}

.community-comment-actions button:active {
  color: #4f8cff;
}

.community-comment-thread {
  border-bottom:
    1px solid rgba(255, 255, 255, 0.06);
}

.community-comment-thread
.community-comment {
  border-bottom: 0;
}


.community-comment-replies {
  margin-left: 52px;

  padding-bottom: 12px;
}


.community-comment-reply {
  padding-top: 6px;
  padding-bottom: 8px;
}


.community-comment-reply
.community-comment-avatar {
  width: 34px;
  height: 34px;
}


.comment-more-replies {
  margin-top: 4px;

  padding: 5px 0;

  border: 0;

  background: transparent;

  color: #6f9eff;

  font-size: 12px;
  font-weight: 600;

  cursor: pointer;
}

.community-comment-reply {
  animation:
    replyEnter 0.22s ease both;
}

.community-comment-reply.reply-leaving {
  animation:
    replyLeave 0.18s ease both;
}

@keyframes replyEnter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes replyLeave {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.replying-to-badge {
  grid-column: 1 / -1;
  
  width: fit-content;
  max-width: 100%;
  
  display: inline-flex;
  align-items: center;
  gap: 6px;
  
  padding: 5px 8px;
  
  border-radius: 10px;
  
  background:
    rgba(52, 120, 246, 0.12);
  
  color: #6fa3ff;
  
  font-size: 12px;
  font-weight: 700;
}

.replying-to-badge[hidden] {
  display: none !important;
}

#replyingToName {
  max-width: 220px;
  
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#cancelReply {
  width: 18px;
  height: 18px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  padding: 0;
  
  border: 0;
  border-radius: 50%;
  
  background:
    rgba(255, 255, 255, 0.08);
  
  color: #9eabc0;
  
  font-size: 10px;
  
  cursor: pointer;
}

#cancelReply:active {
  transform: scale(0.9);
}

.comment-reply-mention {
  display: inline;
  
  margin-right: 4px;
  
  color: #6fa3ff;
  
  font-size: 13px;
  font-weight: 700;
  
  line-height: 1.4;
}
.community-comment-replies {
  margin-left: 39px;
  padding-bottom: 8px;
}

.community-comment-reply {
  padding-top: 4px;
  padding-bottom: 5px;
}

.community-comment-reply .community-comment-body p {
  margin-bottom: 4px;
}

.community-comment-reply .community-comment-top {
  margin-bottom: 3px;
}

.community-comment-reply .community-comment-actions {
  margin-top: 2px;
}

.comment-text-content {
  display: inline;
}

.community-comment-side {
  flex: 0 0 auto;
  
  display: flex;
  align-items: center;
  gap: 8px;
}


.comment-menu-wrapper {
  position: relative;
}


.comment-menu-btn {
  width: 26px;
  height: 26px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  padding: 0;
  
  border: 0;
  border-radius: 8px;
  
  background: transparent;
  
  color: #707c92;
  
  font-size: 13px;
  
  cursor: pointer;
}


.comment-menu-btn:active {
  background:
    rgba(255, 255, 255, 0.06);
}


.comment-menu {
  position: absolute;
  
  top: 30px;
  right: 0;
  
  z-index: 20;
  
  min-width: 130px;
  
  padding: 5px;
  
  border:
    1px solid rgba(255, 255, 255, 0.08);
  
  border-radius: 12px;
  
  background: #151d2e;
  
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.28);
}


.comment-menu button {
  width: 100%;
  
  display: flex;
  align-items: center;
  gap: 9px;
  
  padding: 9px 10px;
  
  border: 0;
  border-radius: 8px;
  
  background: transparent;
  
  color: #d5dceb;
  
  font-size: 12px;
  
  text-align: left;
  
  cursor: pointer;
}


.comment-menu button:active {
  background:
    rgba(255, 255, 255, 0.06);
}


.comment-delete-btn {
  color: #ff6b78 !important;
}


.comment-edit-textarea {
  width: 100%;
  min-height: 54px;
  
  margin-bottom: 7px;
  padding: 9px 10px;
  
  resize: none;
  
  border:
    1px solid #3478f6;
  
  border-radius: 11px;
  
  outline: none;
  
  background: #151f34;
  
  color: #eef3ff;
  
  font: inherit;
  font-size: 14px;
}


.comment-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  
  gap: 8px;
}


.comment-edit-actions button {
  padding: 6px 10px;
  
  border: 0;
  border-radius: 8px;
  
  font-size: 11px;
  font-weight: 700;
}


.comment-edit-cancel {
  background:
    rgba(255, 255, 255, 0.06);
  
  color: #9aa6ba;
}


.comment-edit-save {
  background: #3478f6;
  
  color: #fff;
}