/*
  forum.css
  Usa as MESMAS variáveis de cor/fonte do resto do site (definidas em
  styles.css / login.css: --bg, --surface, --text, --muted, --border,
  --accent, --accent-2, --danger, --font-display, --font-body).
  Os valores depois da vírgula em var(--x, valor) são só um fallback pra
  bater com o mockup enquanto os dois arquivos não estão nas minhas mãos —
  se os nomes de variável no seu styles.css forem diferentes, é só eu trocar
  aqui depois, o layout não muda.
*/

.forum {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.forum.hidden {
  display: none;
}

.forum__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.forum__header h1 {
  font-family: var(--font-display, "Poppins", sans-serif);
  color: var(--text, #f5f5f7);
  margin: 0.2rem 0 0;
  font-size: 1.9rem;
}

.forum__new-btn {
  white-space: nowrap;
}

.forum__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border, #2a2b38);
}

/* .filter-btn já existe no styles.css (usado em projects.html) — aqui só
   garantimos que fica coerente caso a página seja carregada sozinha. */
.forum__filters .filter-btn {
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  border: 1px solid var(--border, #2a2b38);
  background: transparent;
  color: var(--muted, #9a9ab0);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.forum__filters .filter-btn:hover {
  border-color: var(--accent, #6c63ff);
  color: var(--text, #f5f5f7);
}

.forum__filters .filter-btn.active {
  background: var(--accent, #6c63ff);
  border-color: var(--accent, #6c63ff);
  color: #fff;
}

.forum__empty {
  color: var(--muted, #9a9ab0);
  padding: 2rem 0;
  text-align: center;
}

/* ---------- Lista de tópicos ---------- */
.forum__list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.forum__topic-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface, #1a1b24);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
  text-align: left;
  width: 100%;
}

.forum__topic-row:hover {
  border-color: var(--accent, #6c63ff);
}

.forum__avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--surface-2, #14151c) center/cover no-repeat;
  border: 1px solid var(--border, #2a2b38);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #9a9ab0);
  font-size: 0.65rem;
  overflow: hidden;
}

.forum__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.forum__topic-title {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--accent-2, #8f7bff);
}

.forum__topic-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted, #9a9ab0);
}

.forum__topic-replies {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--muted, #9a9ab0);
}

.forum__topic-delete {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--danger, #e5484d);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.forum__topic-delete:hover {
  background: rgba(229, 72, 77, 0.15);
}

/* ---------- Paginação ---------- */
.forum__pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.forum__pager:empty {
  margin: 0;
}

.forum__pager-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border, #2a2b38);
  background: transparent;
  color: var(--muted, #9a9ab0);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.forum__pager-btn:hover:not(:disabled) {
  border-color: var(--accent, #6c63ff);
  color: var(--text, #f5f5f7);
}

.forum__pager-btn.active {
  background: var(--accent, #6c63ff);
  border-color: var(--accent, #6c63ff);
  color: #fff;
}

.forum__pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- Tags/badges ---------- */
.forum__tag {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent, #6c63ff);
}

.forum__tag--atualizacoes { background: var(--danger, #e5484d); }
.forum__tag--duvidas { background: var(--accent, #6c63ff); }
.forum__tag--offtopic { background: #4a4b58; }
.forum__tag--reporte-erro { background: #d97706; }
.forum__tag--sugestao-jogos { background: #16a34a; }

.forum__role {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border, #2a2b38);
  color: var(--muted, #9a9ab0);
}

.forum__role--admin { color: var(--danger, #e5484d); border-color: var(--danger, #e5484d); }
.forum__role--mod { color: var(--accent, #6c63ff); border-color: var(--accent, #6c63ff); }

/* ---------- Detalhe do tópico ---------- */
.forum__back {
  background: transparent;
  border: 1px solid var(--border, #2a2b38);
  color: var(--muted, #9a9ab0);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}

.forum__back:hover {
  color: var(--text, #f5f5f7);
  border-color: var(--accent, #6c63ff);
}

.forum__topic-card,
.forum__reply-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface, #1a1b24);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 14px;
  margin-bottom: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.forum__reply-card--highlight {
  border-color: var(--accent, #6c63ff);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.35);
}

.forum__author-col {
  flex-shrink: 0;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.forum__author-col .forum__avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
}

.forum__author-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #f5f5f7);
  word-break: break-word;
}

.forum__body-col {
  flex: 1;
  min-width: 0;
}

.forum__topic-card .forum__body-col h2 {
  margin: 0 0 0.3rem;
  font-size: 1.3rem;
  color: var(--text, #f5f5f7);
}

.forum__post-date {
  font-size: 0.8rem;
  color: var(--accent-2, #8f7bff);
  margin-bottom: 0.75rem;
}

.forum__prose {
  color: var(--text, #f5f5f7);
  line-height: 1.6;
  font-size: 0.95rem;
}

.forum__prose p { margin: 0 0 0.75rem; }
.forum__prose p:last-child { margin-bottom: 0; }
.forum__prose img {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 0.5rem;
  display: block;
}
.forum__prose a { color: var(--accent-2, #8f7bff); }
.forum__prose code {
  background: var(--surface-2, #14151c);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.forum__replies {
  margin-bottom: 1.5rem;
}

.forum__tag--game {
  background: rgba(244, 114, 182, 0.14);
  border: 1px solid #f472b6;
  color: #f472b6;
  font-weight: 700;
}

.forum__tag--closed {
  background: #3a3b48;
  color: var(--muted, #9a9ab0);
  vertical-align: middle;
  margin-left: 0.5rem;
  font-size: 0.65rem;
}

.forum__tag--closed-list {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #b91c1c;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ---------- Botão "Responder" em cada post/resposta ---------- */
.forum__reply-trigger {
  background: transparent;
  border: none;
  color: var(--muted, #9a9ab0);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin-top: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.forum__reply-trigger:hover {
  color: var(--accent-2, #8f7bff);
}

.forum__reply-target {
  font-size: 0.82rem;
  color: #5eead4;
  margin: 0 0 0.35rem;
}

.forum__reply-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.forum__reply-actions .forum__reply-trigger {
  margin-top: 0;
}

.forum__delete-trigger {
  background: transparent;
  border: none;
  color: var(--danger, #e5484d);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.forum__delete-trigger:hover {
  filter: brightness(1.3);
}

.forum__deleted-notice {
  color: var(--muted, #9a9ab0);
  font-style: italic;
  font-size: 0.9rem;
  margin: 0;
}

/* ---------- Composer (resposta / nova postagem) ---------- */
.forum__reply-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-2, #14151c);
  border: 1px solid var(--accent, #6c63ff);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--text, #f5f5f7);
}

.forum__reply-context.hidden {
  display: none;
}

#forumReplyContextCancel {
  background: transparent;
  border: none;
  color: var(--muted, #9a9ab0);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

#forumReplyContextCancel:hover {
  color: var(--danger, #e5484d);
}

.forum__toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.forum__tool-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, #14151c);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 8px;
  color: var(--text, #f5f5f7);
  cursor: pointer;
  font-size: 0.85rem;
}

.forum__tool-btn:hover {
  border-color: var(--accent, #6c63ff);
}

.forum__tool-upload {
  position: relative;
}

.forum__tool-status {
  font-size: 0.78rem;
  color: var(--muted, #9a9ab0);
}

.forum__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.forum__attachments.hidden {
  display: none;
}

.forum__attachment-chip {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, #2a2b38);
  background: var(--surface-2, #14151c);
}

.forum__attachment-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.forum__attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.forum__attachment-remove:hover {
  background: var(--danger, #e5484d);
}

.forum__textarea {
  width: 100%;
  resize: vertical;
  background: var(--surface, #1a1b24);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 10px;
  color: var(--text, #f5f5f7);
  font-family: var(--font-body, inherit);
  font-size: 0.92rem;
  padding: 0.85rem;
  box-sizing: border-box;
}

.forum__textarea:focus {
  outline: none;
  border-color: var(--accent, #6c63ff);
}

.forum__composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.forum__hint {
  font-size: 0.78rem;
  color: var(--muted, #9a9ab0);
}

.forum__login-hint {
  color: var(--muted, #9a9ab0);
  font-size: 0.9rem;
  padding: 0.9rem;
  border: 1px dashed var(--border, #2a2b38);
  border-radius: 10px;
  text-align: center;
}

/* ---------- Modal: nova postagem ---------- */
.forum-modal.hidden { display: none; }

.forum-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.forum-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 10, 0.72);
}

.forum-modal__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface, #1a1b24);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 16px;
  padding: 1.5rem;
  box-sizing: border-box;
}

.forum-modal__panel--small {
  max-width: 380px;
}

.forum__confirm-message {
  color: var(--text, #f5f5f7);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.forum-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.forum-modal__header h2 {
  margin: 0;
  font-family: var(--font-display, "Poppins", sans-serif);
  color: var(--text, #f5f5f7);
  font-size: 1.2rem;
}

.forum-modal__close {
  background: transparent;
  border: none;
  color: var(--muted, #9a9ab0);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.forum-modal__close:hover { color: var(--text, #f5f5f7); }

.forum-field {
  margin-bottom: 1.1rem;
}

.forum-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted, #9a9ab0);
  margin-bottom: 0.4rem;
}

.forum-field input[type="text"] {
  width: 100%;
  background: var(--surface-2, #14151c);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 10px;
  color: var(--text, #f5f5f7);
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  box-sizing: border-box;
}

.forum-field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent, #6c63ff);
}

.forum__tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.forum__tag-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text, #f5f5f7);
  background: var(--surface-2, #14151c);
  border: 1px solid var(--border, #2a2b38);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.forum__form-error {
  color: var(--danger, #e5484d);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.forum-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.forum__btn-secondary {
  background: transparent;
  border: 1px solid var(--border, #2a2b38);
  color: var(--muted, #9a9ab0);
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.forum__btn-close,
.forum__btn-reopen {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.forum__btn-close {
  background: var(--danger, #e5484d);
}

.forum__btn-close:hover {
  filter: brightness(1.1);
}

.forum__btn-reopen {
  background: #3b82f6;
}

.forum__btn-reopen:hover {
  filter: brightness(1.1);
}

.forum__btn-secondary:hover {
  color: var(--text, #f5f5f7);
  border-color: var(--accent, #6c63ff);
}

@media (max-width: 560px) {
  .forum__header {
    flex-direction: column;
  }
  .forum__topic-row {
    flex-wrap: wrap;
  }
  .forum__topic-replies {
    width: 100%;
    text-align: right;
  }
}