/* ===============================
   Container Geral
=============================== */
#gs-comment-container {
  border-radius: 5px;
  padding: 20px;
  margin-top: 30px;
  color: #eee;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ===============================
   Cabeçalho: Título e Meta
=============================== */
#gs-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#gs-comment-title {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
}

#gs-comment-meta {
  display: flex;
  align-items: center;
}

#gs-comment-count {
  font-size: 16px;
  color: #bbb;
  margin-right: 15px;
}

/* ===============================
   Linha Divisória
=============================== */
.gs-divider {
  border: none;
  border-top: 1px solid #555;
  margin: 15px 0;
}

/* ===============================
   Caixa "Iniciar Comentário" + Filtros alinhados
=============================== */
#gs-comment-form {
  display: block;
  position: relative;
}

#gs-start-comment-input {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  flex: 1;
  background: #2c2c2c;
  border: 1px solid #444;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  overflow-y: hidden;
  min-height: 80px;
  max-height: 300px;
  margin-right: 0;
}

/* Filtros de Comentários (Ordenação) estilo YouTube canal */
#gs-comment-filters {
  display: flex;
  gap: 0;
  margin: 0 0 10px 0;
  font-family: "Montserrat", Arial, sans-serif;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  position: static;
  top: 0;
  background: transparent;
}

.gs-filter-btn {
  background: none;
  border: none;
  color: #bbb;
  font-size: 15px;
  font-family: "Montserrat", Arial, sans-serif;
  padding: 10px 22px 8px 22px;
  cursor: pointer;
  position: relative;
  outline: none;
  transition: color 0.18s, background 0.18s;
  border-radius: 20px 20px 0 0;
  margin: 0 2px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.gs-filter-btn.active,
.gs-filter-btn:hover {
  color: #fff;
}

.gs-filter-btn.active::after {
  content: "";
  display: block;
  height: 3px;
  background: rgb(117 0 0 / 87%);
  border-radius: 2px 2px 0 0;
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  transition: background 0.18s;
}

.gs-filter-btn:not(.active):hover::after {
  content: "";
  display: block;
  height: 3px;
  background: #444;
  border-radius: 2px 2px 0 0;
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  opacity: 0.7;
}

@media (max-width: 600px) {
  #gs-comment-container {
    padding: 8px;
    max-width: 100vw;
  }
  .gs-comment-card {
    padding: 10px;
    margin-bottom: 10px;
  }
  .gs-comment-header {
    flex-direction: row;
    gap: 6px;
    font-size: 13px;
  }
  .gs-comment-avatar {
    width: 32px;
    height: 32px;
    margin-right: 8px;
  }
  .gs-comment-author {
    font-size: 13px;
  }
  .gs-comment-date {
    font-size: 11px;
  }
  .gs-comment-actions {
    gap: 4px;
    flex-wrap: wrap;
  }
  .gs-button,
  .gs-button-primary,
  .gs-button-vote,
  .gs-button-reply {
    font-size: 12px;
    padding: 7px 8px;
    border-radius: 4px;
  }
  .gs-button-delete {
    font-size: 9px;
    padding: 4px 7px;
    top: 6px;
    right: 6px;
  }
  .gs-button-edit {
    font-size: 11px;
    margin-left: 4px;
    padding: 0 3px;
  }
  .gs-reply-list {
    margin-left: 16px;
    padding-left: 8px;
  }
  .gs-reply-input {
    min-height: 60px;
    max-height: 180px;
    padding: 10px;
    font-size: 13px;
    margin: 10px 0;
  }
  #gs-start-comment-input {
    min-height: 60px;
    max-height: 180px;
    font-size: 13px;
    padding: 8px;
  }
  #gs-comment-filters {
    /* manter os filtros em linha no mobile e centralizados
       usar fit-content para que o grupo seja centralizado a partir do meio */
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 8px 0 8px 0;
    width: -moz-fit-content;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
  }
  .gs-filter-btn {
    /* reduzir horizontais para caber 3 botões lado-a-lado e manter padding simétrico */
    padding: 7px 10px 5px 10px;
    font-size: 13px;
    margin: 0 4px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* garantir que as extremidades do grupo fiquem equilibradas: todos os botões com mesma largura */
  .gs-filter-btn { min-width: 84px; }
}

/* ===============================
   Cartões de Comentário
=============================== */
.gs-comment-card {
  /* Card base atualizado conforme pedido */
  background: #101010;
  border: 1px solid #555;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  position: relative;
  /* manter sombra discreta sem movimento */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Remover movimento/transform no hover */
.gs-comment-card:hover {
  transform: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Novo: imagem de perfil redonda */
.gs-comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
  border: 2px solid #fff;
  background: #222;
  flex-shrink: 0;
}

/* Header do comentário: avatar + nick lado a lado */
.gs-comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #bbb;
  /* justify-content removido para alinhar à esquerda */
}

/* Bloco nick + data ao lado do avatar */
.gs-comment-meta-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.gs-comment-author {
  font-weight: bold;
  color: #fff;
  font-size: 15px;
  line-height: 1.1;
  margin-bottom: 2px;
}

.gs-comment-date {
  font-size: 12px;
  color: #888;
  font-weight: normal;
  margin: 0;
  line-height: 1.1;
  margin-bottom: 0;
  margin-top: 0;
}

/* ===============================
   Ações de Comentário
=============================== */
.gs-comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-start;
}

/* Botões: sem preenchimento, apenas borda branca */
.gs-button,
.gs-button-primary {
  background: transparent !important;
  color: #fff;
  box-shadow: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.gs-button:hover,
.gs-button:focus,
.gs-button-primary:hover,
.gs-button-primary:focus,
.gs-button-vote:hover,
.gs-button-vote:focus,
.gs-button-reply:hover,
.gs-button-reply:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff;
  border-color: #3a3a3a;
}

.gs-button-primary {
  font-weight: bold;
}

/* Botão de lixeira (minimal, mesmo padrão dos outros) */
.gs-button-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: transparent !important;
  border: none !important;
  color: #cfcfcf;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  height: 32px;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.gs-button-delete i {
  font-size: 13px;
  color: inherit;
}

.gs-button-delete:hover,
.gs-button-delete:focus {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #fff;
}

/* Botão de like/dislike: só borda branca, sem preenchimento */
.gs-button-vote.gs-like,
.gs-button-vote.gs-dislike {
  /* Compact icon + count button (minimal visual like print) */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  min-width: 36px;
  height: auto;
  border-radius: 6px;
  background: transparent !important;
  color: #dcdcdc;
  border: none;
  font-size: 13px;
}

.gs-button-vote .gs-like-count,
.gs-button-vote .gs-dislike-count {
  display: inline-block;
  min-width: 16px;
  text-align: center;
  background: transparent;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #cfcfcf;
}

.gs-button-vote.gs-like.liked,
.gs-button-vote.gs-dislike.disliked {
  /* Estado ativo: remover fundo no botão (aplicaremos cor apenas ao ícone) */
  background: transparent !important;
  color: inherit !important;
  border-color: transparent !important;
}

/* Apenas o ícone deve ficar com a cor das setas quando ativo */
.gs-button-vote.gs-like.liked i,
.gs-button-vote.gs-dislike.disliked i {
  color: rgb(117 0 0 / 87%) !important;
}

/* Opcional: manter o número discreto ao lado, sem fundo */
.gs-button-vote.gs-like.liked .gs-like-count,
.gs-button-vote.gs-dislike.disliked .gs-dislike-count {
  background: transparent;
  color: #dcdcdc;
}

/* Transições suaves */
.gs-button-vote,
.gs-button-reply,
.gs-send-btn,
.gs-reply-send {
  transition: background-color 0.12s ease, color 0.12s ease,
    border-color 0.12s ease;
}

.gs-button-vote.gs-like:not(.liked),
.gs-button-vote.gs-dislike:not(.disliked) {
  border-color: rgba(255, 255, 255, 0.06);
  color: #fff;
  background: transparent !important;
}

/* ===============================
   Resposta (thread)
=============================== */
.gs-reply-list {
  margin-left: 40px;
  margin-top: 10px;
  border-left: 2px solid #444;
  padding-left: 15px;
}

/* Caixa de resposta: mesma altura da caixa de novo comentário */
.gs-reply-input {
  min-height: 80px;
  max-height: 300px;
  /* reduzir margem para evitar deslocamento excessivo quando houver respostas */
  margin: 8px 0;
  /* opcional: para ocupar toda a largura do container de resposta */
  width: 100%;
  resize: vertical;
  background: #2c2c2c00;
  border: 1px solid #444;
  color: #fff;
  padding: 20px;
  border-radius: 6px;
  font-size: 14px;
  overflow-y: hidden;
  box-sizing: border-box;
}

/* Quando o form de resposta estiver presente, destaque a borda da área de escrita */
.gs-reply-form .gs-reply-input,
.gs-reply-input:focus {
  border-color: rgb(117 0 0 / 87%) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(117, 0, 0, 0.08);
}

/* Se houver replies aninhadas (respostas de respostas), neutralize o recuo adicional
   para que todas as respostas exibam o mesmo nível de indentação visual. */
.gs-reply-list .gs-reply-list {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  margin-top: 10px;
}

.gs-button-reply {
  /* Botão responder: estilo discreto com ícone + texto (como no print) */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  border-radius: 6px;
  border: none;
  background: transparent !important;
  color: #dcdcdc;
  font-size: 13px;
  line-height: 1;
  min-height: 20px;
}

.gs-button-reply:hover,
.gs-button-reply:focus {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.18);
}

/* Wrapper e botão de envio dentro do campo de comentário */
.gs-input-wrap {
  position: relative;
}

#gs-start-comment-input {
  padding-right: 60px; /* espaço para o botão enviar */
}

.gs-send-btn {
  position: absolute;
  right: 10px;
  bottom: 12px;
  width: 44px;
  height: 38px;
  border-radius: 10px;
  background: rgb(117 0 0 / 87%);
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(117, 0, 0, 0.25);
  cursor: pointer;
}

.gs-send-btn i {
  font-size: 14px;
}

/* Reply wrap e botão (caso JS não insira styles inline) */
.gs-reply-wrap {
  position: relative;
}
.gs-reply-wrap .gs-reply-input {
  padding-right: 56px;
}
.gs-reply-send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 38px;
  height: 34px;
  border-radius: 8px;
  background: rgb(117 0 0 / 87%);
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.gs-reply-send i {
  font-size: 13px;
}

/* Botão editar ao lado do responder */
.gs-button-edit {
  background: none !important;
  border: none !important;
  color: #e74c3c;
  font-size: 12px;
  margin-left: 8px;
  padding: 0 6px;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
  transition: color 0.2s;
}

.gs-button-edit:hover,
.gs-button-edit:focus {
  color: #ff3b3b;
  text-decoration: underline;
}

/* Override hover for minimal action buttons */
.gs-button-vote:hover,
.gs-button-reply:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02) !important;
}

.gs-button-reply i {
  font-size: 14px;
  color: #cfcfcf;
}
.gs-button-vote i {
  font-size: 14px;
  color: #cfcfcf;
}

/* ===============================
   Reações do capítulo
   Renderiza botões compactos com ícone + contador
================================ */
/* Reações: avatar preenchendo todo o espaço do item
   - Desktop: os itens se distribuem igualmente na linha (flex) e o avatar ocupa 100% da largura do item
   - Mobile: grid 3x2, cada coluna preenche seu espaço e o avatar ocupa 100% da célula
*/

#gs-reactions {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 6px 0 22px 0;
  justify-content: center;
  padding: 10px 0;
  flex-wrap: nowrap; /* manter uma linha no desktop */
  overflow-x: hidden; /* esconder barra horizontal */
  width: 100%;
  max-width: 700px; /* manter alinhamento com o container principal */
  margin-left: auto;
  margin-right: auto;
}

.gs-reaction-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 6px;
  text-align: center;
  /* permitir que cada item cresça igualmente e preencha o espaço disponível */
  flex: 1 1 0;
  min-width: 0;
}

.gs-reaction-avatar {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  max-width: 140px; /* limite razoável para telas muito largas */
}

.gs-reaction-item.active .gs-reaction-avatar {
  border-color: rgb(117 0 0 / 87%);
  box-shadow: 0 4px 12px rgba(117, 0, 0, 0.12);
}

.gs-reaction-label {
  color: #d6d6d6;
  font-size: 12px;
  margin-top: 2px;
}

.gs-reaction-count {
  color: #f3f3f3;
  font-weight: 600;
  font-size: 14px;
}

.gs-reaction-item:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Desktop largo: limitar o tamanho máximo do avatar para evitar que fiquem enormes */
@media (min-width: 900px) {
  .gs-reaction-avatar {
    max-width: 120px;
  }
}

/* Mobile: grid 3x2 (deitado) — cada célula preenche seu espaço */
@media (max-width: 899px) {
  #gs-reactions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
    justify-items: center;
    align-items: center;
    padding: 8px 0;
    overflow-x: hidden;
  }
  .gs-reaction-avatar {
    max-width: none;
    width: 100%;
    height: auto;
  }
  .gs-reaction-item {
    padding: 6px 2px;
  }
}
