.forums-container {
  max-width: 800px;
  margin: 0 auto;
}

.forums-back {
  display: inline-block;
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.forums-back:hover {
  color: var(--text);
}

/* --- Section Header + Content --- */

.forums-section {
  padding: 1rem 0;
}

.forums-section h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 0 0.5rem 0;
  border-bottom: 1px solid var(--brand-color-lighter);
}

.forums-section-content {
  padding: 0.5em 0;
}

.forums-actions {
  margin-top: 0.5rem;
}

.forums-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.forums-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

/* --- Topic List --- */

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.topic-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  color: var(--text);
  background: var(--brand-color-darker);
  border: 1px solid var(--brand-color-lighter);
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.topic-item:hover {
  border-color: var(--brand-color-mid);
  background: var(--brand-color-dark);
  transform: translateY(-1px);
}

.topic-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.topic-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topic-item:hover .topic-title {
  color: var(--text-soft);
}

.topic-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.topic-item-stats {
  font-size: 0.8rem;
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

.forums-empty {
  color: var(--text-soft);
  text-align: center;
  padding: 1rem;
}

/* --- Posts --- */

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.post-item {
  padding: 1rem;
  display: flex;
  gap: 1rem;
  border-radius: 0.75rem;
}

.post-item + .post-item {
  margin-top: 0;
}

.post-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  max-width: 70px;
}

.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.post-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-color-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.post-username {
  font-size: 0.75rem;
  color: var(--text-soft);
  text-align: center;
  margin-top: 0.25rem;
  word-break: break-all;
}

.post-username:hover {
  color: var(--text);
}

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

.post-content {
  font-size: 0.95rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.post-content p {
  margin: 0 0 0.5rem 0;
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-time {
  display: block;
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 0.5rem;
}

/* --- Forms (edit-post form etc, unrelated to reply composer) --- */

.forums-section-content input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.forums-section-content .form-group {
  margin-bottom: 1rem;
}

.forums-section-content .form-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 0.25rem;
}

/* --- Media Attachments (posted content) --- */

.post-media {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.post-media-item img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 0.5rem;
  object-fit: cover;
}

.lightbox-trigger {
  cursor: pointer;
}

.post-media-item video {
  max-width: 400px;
  max-height: 300px;
  border-radius: 0.5rem;
}

.post-media-file {
  font-size: 0.85rem;
}

/* --- Lightbox --- */

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.is-visible {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 0.5rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
}

.lightbox-close:hover {
  color: #ccc;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  padding: 0 0.4rem;
  z-index: 1;
  user-select: none;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(0, 0, 0, 0.7);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.25em 0.75em;
  border-radius: 1rem;
}

/* =========================================================
   forum-style reply composer
   ========================================================= */

.forum-reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Attachment preview strip, shown above the input bar when files are staged */
.forum-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0;
}

.forum-attachment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 88px;
}

.forum-attachment-preview {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 0.6rem;
  overflow: hidden;
  background: var(--brand-color-mid, #2b2d31);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}

.forum-attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.forum-attachment-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.3rem;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.forum-attachment-card:hover .forum-attachment-hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.45);
}

.forum-attachment-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.forum-attachment-action:hover {
  background: rgba(0, 0, 0, 0.85);
}

.forum-attachment-remove:hover {
  background: #da373c;
}

.forum-attachment-name {
  font-size: 0.7rem;
  color: var(--text-soft);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pill-shaped message bar */
.forum-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--brand-color-mid, #383a40);
  border-radius: 1.5rem;
  padding: 0.5rem 0.75rem;
}

.forum-attach-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-color, #4a4d55);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.forum-attach-btn:hover {
  background: var(--brand-color-lighter, #5a5d66);
}

.forum-input-bar textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  min-height: 20px;
  max-height: 200px;
  padding: 0.4rem 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;
  overflow-y: auto;
  display: block;
}

.forum-input-bar textarea::placeholder {
  color: var(--text-soft);
}

.forum-send-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.forum-send-btn svg {
  min-width: 18px;
}

.forum-send-btn:hover {
  background: var(--brand-color, #4a4d55);
  color: var(--text);
}

/* =========================================================
   Post edit / delete action buttons
   ========================================================= */

.post-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.post-edit-btn,
.post-delete-btn,
.post-edit-save,
.post-edit-cancel {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: 1rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--brand-color-mid, #383a40);
  color: var(--text-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.post-edit-btn:hover,
.post-edit-cancel:hover {
  background: var(--brand-color, #4a4d55);
  color: var(--text);
}

.post-edit-save {
  background: var(--brand-color, #4a4d55);
  color: var(--text);
}

.post-edit-save:hover {
  background: var(--brand-color-lighter, #5a5d66);
}

.post-delete-btn:hover {
  background: #da373c;
  color: #fff;
}

.post-edit-form {
  display: none;
  margin-top: 0.5rem;
}

.post-edit-form textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
  border: none;
  border-radius: 0.75rem;
  background: var(--brand-color-mid, #383a40);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.6rem 0.85rem;
  outline: none;
  margin-bottom: 0.5rem;
}

.post-edit-form textarea::placeholder {
  color: var(--text-soft);
}

.post-edit-form-actions {
  display: flex;
  gap: 0.5rem;
}

/* --- Mentions --- */

.mention {
  display: inline;
  padding: 0 0.1em;
  border-radius: 0.25em;
  font-weight: 500;
  text-decoration: none;
}

.mention--user {
  color: #6eb5ff;
  background: rgba(88, 101, 242, 0.15);
}

.mention--user:hover {
  background: rgba(88, 101, 242, 0.3);
  text-decoration: underline;
}

.mention--topic {
  color: #6ee7b7;
  background: rgba(87, 242, 135, 0.15);
}

.mention--topic:hover {
  background: rgba(87, 242, 135, 0.3);
  text-decoration: underline;
}

/* --- Mention Autocomplete Dropdown --- */

.mention-dropdown {
  background: var(--brand-color, #1e1f22);
  border: 1px solid var(--brand-color-lighter, #3f4147);
  border-radius: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.mention-dropdown-item {
  padding: 0.5em 0.75em;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.mention-dropdown-item:hover,
.mention-dropdown-item.is-active {
  background: var(--brand-color-mid, #383a40);
}