/* Forum module — matches RushMU style.css tokens */

/*
 * Global .big-panel uses overflow:hidden (style.css), which clips reCAPTCHA when the widget
 * expands or shows auxiliary UI — looks like the page flashes “lighter” and the check stalls.
 */
.big-panel.forum-page {
  overflow: visible;
}

/* Search + Rules — strip above forum panels (included on all forum views) */
.forum-toolbar {
  margin-bottom: var(--space-md);
}

.forum-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-panel-header);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

/* Topic page: title left, moderator actions top-right */
.big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header > .forum-topic-header-main {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
}

.big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header > .forum-topic-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  padding-top: 0;
  border-top: none;
  align-self: flex-start;
}

.big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header > .forum-topic-header-actions form {
  margin: 0;
}

@media (max-width: 768px) {
  .big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header {
    flex-direction: column;
    align-items: stretch;
  }

  .big-panel.forum-page.forum-topic-page > .big-panel-header.forum-topic-header > .forum-topic-header-actions {
    width: 100%;
    justify-content: flex-start;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    align-self: stretch;
  }
}

/* big-panel-header defaults to centered title; forum uses a split toolbar layout */
.big-panel.forum-page > .big-panel-header.forum-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  text-align: left;
  min-height: unset;
  padding: var(--space-lg);
}

.big-panel.forum-page > .big-panel-header.forum-page-header > div:first-child {
  flex: 1 1 12rem;
  min-width: 0;
}

.big-panel.forum-page > .big-panel-header.forum-page-header h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}

.big-panel.forum-page > .big-panel-header.forum-page-header > h1:first-child {
  flex: 1 1 auto;
  margin-top: 0;
  align-self: center;
}

.big-panel.forum-page > .big-panel-header.forum-page-header > .forum-header-actions,
.big-panel.forum-page > .big-panel-header.forum-page-header > a.btn {
  flex-shrink: 0;
  align-self: center;
}

.forum-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
}

.forum-header-actions .btn,
.forum-staff-actions .btn {
  min-height: 30px;
}

.forum-intro {
  margin-bottom: var(--space-lg);
}

/* New topic form — same label/input feel as admin news editor */
.forum-editor-form .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.forum-editor-form .form-input {
  margin-bottom: 0;
  border-radius: 4px;
}

.forum-editor-form select.form-input {
  cursor: pointer;
}

.forum-section-fixed {
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-weight: 600;
}

.forum-form-actions {
  margin-top: var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.forum-section-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.forum-section-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.forum-section-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--box-shadow);
}

.forum-section-card-main {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg);
  color: var(--text-primary);
  text-decoration: none;
}

.forum-section-card-main:hover {
  color: var(--text-primary);
}

.forum-section-title {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-size-lg);
}

.forum-section-desc {
  margin: 0 0 var(--space-md);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.forum-section-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Category cards (index) — latest row below section link (separate topic link) */
.forum-section-latest-simple {
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-panel-header) 55%, var(--bg-panel));
}

.forum-section-latest-simple-label {
  color: var(--text-muted);
  margin-right: 0.15rem;
}

a.forum-section-latest-simple-title {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

a.forum-section-latest-simple-title:hover {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.forum-section-latest-simple-by {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.forum-section-latest-simple-time {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.forum-section-chevron {
  align-self: center;
  color: var(--text-muted);
}

.forum-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.forum-filters .btn.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.forum-topic-table {
  font-size: var(--font-size-sm);
}

/* Section / search — thread list cards */
.forum-thread-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.forum-thread-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: linear-gradient(145deg, rgba(46, 32, 28, 0.95) 0%, rgba(30, 25, 26, 0.98) 50%, rgba(22, 18, 20, 1) 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.forum-thread-card-hit {
  position: absolute;
  inset: 0;
  z-index: 0;
  text-indent: -9999px;
  overflow: hidden;
}

/* Hover: only the left accent bar reacts — no full-card border / shadow / lift */
.forum-thread-card-glow {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 1;
  background: linear-gradient(180deg, rgba(160, 82, 45, 0.45), rgba(115, 20, 20, 0.3));
  opacity: 0.75;
  pointer-events: none;
  transition: width 0.2s ease, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.forum-thread-card:hover .forum-thread-card-glow {
  width: 4px;
  opacity: 1;
  filter: brightness(1.25);
  box-shadow: 3px 0 10px rgba(139, 69, 19, 0.22);
}

.forum-thread-card.is-pinned .forum-thread-card-glow {
  background: linear-gradient(180deg, #d4a017, #8b6914);
  opacity: 0.92;
  box-shadow: none;
}

.forum-thread-card.is-pinned:hover .forum-thread-card-glow {
  filter: brightness(1.12);
  box-shadow: 3px 0 12px rgba(212, 160, 23, 0.28);
}

.forum-thread-card.is-locked .forum-thread-card-glow {
  background: linear-gradient(180deg, rgba(122, 46, 46, 0.85), rgba(60, 20, 20, 0.75));
  box-shadow: none;
}

.forum-thread-card.is-locked:hover .forum-thread-card-glow {
  filter: brightness(1.15);
  box-shadow: 3px 0 10px rgba(160, 70, 70, 0.22);
}

.forum-thread-card-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-lg) var(--space-lg) calc(var(--space-lg) + 6px);
  min-width: 0;
  pointer-events: none;
}

.forum-thread-card-inner .forum-thread-section-link {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  color: var(--accent-secondary);
  text-decoration: none;
  font-weight: 600;
}

.forum-thread-card-inner .forum-thread-section-link:hover {
  text-decoration: underline;
  color: var(--text-primary);
}

.forum-thread-card-main {
  flex: 1 1 220px;
  min-width: 0;
}

.forum-thread-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.forum-thread-pin {
  flex-shrink: 0;
  color: #e6c04a;
  font-size: 0.85rem;
  margin-top: 3px;
  filter: drop-shadow(0 0 4px rgba(230, 192, 74, 0.35));
}

.forum-thread-title {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  word-break: break-word;
}

.forum-thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.forum-thread-meta-sep {
  color: var(--border-light);
  user-select: none;
}

.forum-thread-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.forum-thread-meta-item i {
  opacity: 0.75;
  font-size: 0.8rem;
}

.forum-thread-card-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md) var(--space-xl);
  flex: 0 1 auto;
}

.forum-thread-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(49, 31, 24, 0.9);
}

.forum-thread-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.2;
}

.forum-thread-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 2px;
}

.forum-thread-last {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 6.5rem;
}

.forum-thread-last-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.forum-thread-last-time {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.forum-thread-status-pill {
  display: flex;
  align-items: center;
}

.forum-thread-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.forum-thread-badge i {
  font-size: 0.75rem;
  opacity: 0.9;
}

.forum-thread-badge-open {
  background: rgba(40, 167, 69, 0.18);
  color: #5fd07a;
  border: 1px solid rgba(40, 167, 69, 0.35);
}

.forum-thread-badge-locked {
  background: rgba(122, 46, 46, 0.35);
  color: #f0a0a0;
  border: 1px solid rgba(180, 60, 60, 0.45);
}

@media (max-width: 640px) {
  .forum-thread-card-stats {
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-md);
    margin-top: var(--space-xs);
  }

  .forum-thread-last {
    flex: 1 1 auto;
    min-width: 0;
  }

  .forum-thread-status-pill {
    margin-left: auto;
  }
}

.forum-breadcrumb a {
  color: var(--accent-secondary);
}

.forum-post {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.forum-post-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.forum-post-aside {
  flex: 0 0 132px;
  max-width: 132px;
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-panel-header);
  border-right: 1px solid var(--border-color);
  text-align: center;
}

.forum-avatar-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto var(--space-md);
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
}

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

.forum-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.forum-aside-name {
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.3;
}

.forum-aside-meta {
  margin-top: var(--space-xs);
  line-height: 1.35;
}

.forum-aside-staff-details {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.4;
}

.forum-aside-account {
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  margin-bottom: var(--space-sm);
}

.forum-aside-char-sep {
  margin: var(--space-sm) 0;
  border: none;
  border-top: 1px solid var(--border-color);
  opacity: 0.85;
}

.forum-aside-char-block {
  word-break: break-word;
}

.forum-aside-char-stats {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  line-height: 1.35;
}

.forum-aside-char-empty {
  margin-top: 0.25rem;
  font-size: 0.7rem;
}

a.forum-char-profile-link {
  display: block;
  margin: 0 calc(-1 * var(--space-xs));
  padding: var(--space-xs) var(--space-xs);
  border-radius: 6px;
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.25;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

a.forum-char-profile-link:hover {
  color: var(--text-primary);
  background-color: color-mix(in srgb, var(--accent-primary) 22%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-primary) 35%, transparent);
}

a.forum-char-profile-link:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.forum-post-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-lg);
}

.forum-post-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.forum-post-dateline {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 600px) {
  .forum-post-row {
    flex-direction: column;
  }

  .forum-post-aside {
    flex: none;
    max-width: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    text-align: left;
  }

  .forum-avatar-wrap {
    margin: 0;
    flex-shrink: 0;
  }

  .forum-aside-name,
  .forum-aside-meta {
    flex: 1 1 120px;
    min-width: 0;
  }

  .forum-aside-staff-details {
    flex: 1 1 100%;
    width: 100%;
  }

  .forum-post-row--compact {
    flex-direction: row;
    align-items: flex-start;
  }

  .forum-post-row--compact .forum-post-aside--compact {
    flex: 0 0 auto;
    max-width: none;
    width: auto;
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    display: block;
    text-align: center;
    padding: var(--space-sm);
  }

  .forum-post-row--compact .forum-avatar-wrap {
    margin: 0 auto var(--space-xs);
  }

  .forum-profile-popover {
    left: 0;
    right: auto;
  }
}

.forum-post-body {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Rich HTML from Quill — avoid pre-wrap fighting <p> blocks */
.forum-post-body.news-content-html {
  white-space: normal;
}

.forum-post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

/* Uses global .btn-edit / .btn-remove from style.css (market owner-actions pattern) */
.forum-post-actions .btn-edit,
.forum-post-actions .btn-remove {
  margin-left: 0;
  flex-shrink: 0;
}


/* Compact chat row: narrow column + avatar opens profile popover */
.forum-post-row--compact .forum-post-aside--compact {
  flex: 0 0 76px;
  max-width: 76px;
  padding: var(--space-sm) var(--space-xs);
  position: relative;
}

.forum-post-row--compact .forum-avatar-wrap {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--space-xs);
}

.forum-post-row--compact .forum-aside-name {
  font-size: 0.7rem;
  line-height: 1.2;
}

.forum-avatar-pop-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  color: inherit;
  font: inherit;
}

.forum-avatar-pop-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.forum-avatar-pop-btn:hover .forum-avatar-wrap {
  border-color: var(--accent-primary);
}

.forum-profile-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 210px;
  max-width: min(300px, calc(100vw - 2rem));
  background: var(--bg-panel, var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow, 0 10px 28px rgba(0, 0, 0, 0.4));
}

.forum-profile-popover[hidden] {
  display: none !important;
}

.forum-profile-popover-inner {
  padding: var(--space-md);
  text-align: left;
}

.forum-profile-popover-name {
  font-weight: 700;
  font-size: var(--font-size-sm);
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.forum-profile-popover-line {
  line-height: 1.35;
}

.forum-profile-popover-staff {
  font-size: 0.75rem;
  line-height: 1.4;
}

.forum-profile-popover-char {
  margin-top: 0.35rem;
}

.forum-post-row--compact .forum-post-main {
  padding: var(--space-md) var(--space-md);
}

.forum-post-row--compact .forum-post-topbar {
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
}

.forum-topic-composer-below-op {
  flex-shrink: 0;
  margin-top: 0;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.forum-topic-composer-below-op.forum-topic-composer,
.forum-topic-composer.forum-topic-composer-below-op {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.forum-edit-wrap {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.forum-edit-wrap .forum-easymde-input {
  margin-bottom: var(--space-md);
}

.forum-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

/* Quill snow — dark toolbar/editor inside forum */
.forum-page .news-content-editor .ql-toolbar.ql-snow {
  background: var(--bg-tertiary);
  border-color: var(--input-border);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: var(--space-sm);
}

.forum-page .news-content-editor .ql-container.ql-snow {
  border-color: var(--input-border);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  background: var(--input-bg);
  font-family: var(--font-family);
}

.forum-page .ql-snow .ql-stroke {
  stroke: var(--text-secondary);
}

.forum-page .ql-snow .ql-fill {
  fill: var(--text-secondary);
}

.forum-page .ql-snow .ql-picker-label {
  color: var(--text-primary);
  border-color: transparent;
}

.forum-page .ql-snow .ql-picker-label:hover,
.forum-page .ql-snow .ql-picker-item:hover {
  color: var(--text-primary);
}

.forum-page .ql-snow .ql-picker-options {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.forum-page .ql-snow .ql-picker-item {
  color: var(--text-secondary);
}

.forum-page .ql-snow .ql-picker-item.ql-selected,
.forum-page .ql-snow .ql-picker-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.forum-page .ql-snow.ql-toolbar button:hover .ql-stroke,
.forum-page .ql-snow .ql-toolbar button:focus .ql-stroke,
.forum-page .ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent-secondary);
}

.forum-page .ql-snow.ql-toolbar button:hover .ql-fill,
.forum-page .ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent-secondary);
}

.forum-page .news-content-editor .ql-editor {
  min-height: 160px;
  color: var(--text-primary);
}

.forum-page .news-content-editor .ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
}

.forum-reply-box {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-color);
}

.forum-reply-box h3,
.forum-reply-box .h5 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

/* Hidden sync fields (also covered globally by .d-none when present) */
textarea.forum-message-sync-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.forum-hidden-file-input {
  display: none !important;
}

.forum-post-images {
  margin-top: var(--space-lg);
}

.forum-images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.forum-image-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.forum-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.forum-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 1;
  border: none;
  border-radius: 4px;
  background: var(--accent-danger);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.forum-image-remove:hover {
  background: var(--accent-danger-hover);
}

.forum-search-form .forum-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.forum-search-form .form-control {
  flex: 1 1 200px;
  min-width: 160px;
}

.forum-rules-list {
  max-width: 42rem;
}

.forum-rule-item {
  margin-bottom: 1.15rem;
}

.forum-rule-item .forum-rule-en,
.forum-rule-item .forum-rule-bg {
  margin: 0;
}

.forum-rule-item .forum-rule-bg {
  margin-top: 0.35rem;
  font-size: 0.92em;
  line-height: 1.45;
}

.forum-login-hint a {
  color: var(--accent-secondary);
}

.forum-admin-filters .btn {
  margin-right: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.forum-section-sort-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  vertical-align: middle;
}

.forum-section-sort-actions .btn {
  min-width: 32px;
  padding: 4px 8px;
}

/* EasyMDE - dark Discord-like compose block */
.forum-page .forum-easymde-input {
  width: 100%;
}

.forum-page .EasyMDEContainer {
  width: 100%;
  border: 1px solid #3a3d45;
  overflow: hidden;
  background: #313338;
}

.forum-page .EasyMDEContainer .editor-toolbar {
  background: #2b2d31;
  border-bottom: 1px solid #3a3d45;
  border: none;
}

.forum-page .EasyMDEContainer .editor-toolbar button {
  color: #d4d7dc !important;
}

.forum-page .EasyMDEContainer .editor-toolbar button:hover,
.forum-page .EasyMDEContainer .editor-toolbar button.active {
  background: #3a3d45;
  border-color: #4d515c;
}

.forum-page .EasyMDEContainer .CodeMirror,
.forum-page .EasyMDEContainer .editor-preview {
  background: #313338;
  color: #f2f3f5;
  border: 0;
  font-size: 14px;
}

/*
 * Easymde bundles CodeMirror rules: .CodeMirror{height:300px} and .EasyMDEContainer .CodeMirror{height:auto}
 * (auto = grows with content → no inner scroll). forum.js uses cm.setSize() — parent needs a defined height
 * and .CodeMirror-scroll must not use CM’s negative-margin scrollbar hack (hides the bar on some layouts).
 */
.forum-page .EasyMDEContainer .CodeMirror {
  min-height: 36px !important;
  max-height: none !important;
  height: 40px;
  padding: 4px 8px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.forum-page .EasyMDEContainer .CodeMirror-scroll {
  height: 100% !important;
  max-height: 100% !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  margin-bottom: 0 !important;
  margin-right: 0 !important;
  padding-bottom: 0 !important;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  box-sizing: border-box !important;
}

.forum-page .EasyMDEContainer .CodeMirror-sizer {
  border-right-width: 0 !important;
  margin-bottom: 0 !important;
}

.forum-page .EasyMDEContainer .CodeMirror-scroll::-webkit-scrollbar {
  width: 10px;
}

.forum-page .EasyMDEContainer .CodeMirror-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted, #9ea4ad) 55%, transparent);
  border-radius: 6px;
}

.forum-page .EasyMDEContainer .CodeMirror-scroll::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--bg-tertiary, #2b2d31) 80%, transparent);
}

.forum-page .EasyMDEContainer .CodeMirror-placeholder {
  color: #9ea4ad !important;
}

.forum-page .EasyMDEContainer .editor-preview {
  padding: 14px;
}

.forum-page .EasyMDEContainer .CodeMirror-cursor {
  border-left-color: #f2f3f5;
}

.forum-page .EasyMDEContainer.forum-editor-drag-over {
  outline: 2px dashed rgba(88, 101, 242, 0.85);
  outline-offset: 2px;
  background: #3a3d48;
}

.forum-staff-actions form {
  margin-right: var(--space-xs);
  margin-bottom: var(--space-xs);
}

/* Forum index / section footers — stats + SEO-friendly visible copy */
.forum-seo-summary,
.forum-section-seo-summary {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* Index footer: hard-center block (avoids grid/float quirks in #content-container) */
.forum-seo-summary--index {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.forum-seo-summary--index .forum-seo-summary-inner {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.forum-seo-summary-heading,
.forum-section-seo-heading {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.forum-seo-summary--index .forum-seo-summary-heading {
  width: 100%;
  text-align: center;
}

/* Section page footer — center stat chips (grid was full-width / left-heavy) */
.forum-section-seo-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.forum-section-seo-summary .forum-section-seo-heading {
  width: 100%;
  text-align: center;
}

/* Section footer — same inner width + “Latest activity” line as index card simple style */
.forum-seo-summary-inner--section-footer {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.forum-seo-footer-latest-line {
  width: 100%;
  max-width: 36rem;
  margin: 0 0 var(--space-md);
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.forum-seo-footer-latest-title {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.forum-seo-footer-latest-title:hover {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.forum-seo-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.forum-seo-summary-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

/* Forum + section footers: same compact stat row (index + category) */
.forum-seo-stats-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: var(--space-sm);
  width: fit-content;
  max-width: 100%;
  margin: 0 auto var(--space-md);
  align-self: center;
}

.forum-seo-stat {
  text-align: center;
  padding: var(--space-sm);
  background: var(--bg-panel-header);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

/* Small chips — shared by forum index + section overview */
.forum-seo-stat--chip {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 4.25rem;
  max-width: 6.75rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  box-shadow: none;
}

.forum-seo-stat--chip .forum-seo-stat-value {
  font-size: 1.02rem;
}

.forum-seo-stat--chip .forum-seo-stat-label {
  font-size: 0.55rem;
  margin-top: 0.08rem;
  line-height: 1.2;
}

.forum-seo-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.forum-seo-stat-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.forum-seo-latest {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* Recent topics (forum index) — compact list, not thread-card chrome */
.forum-recent-topics--simple {
  width: min(100%, 520px);
  max-width: 520px;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
  align-self: center;
  text-align: center;
}

.forum-recent-topics--simple .forum-recent-topics-title {
  margin: 0 0 var(--space-md);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.forum-recent-topics--simple .forum-recent-topics-list {
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-panel-header);
  overflow: hidden;
}

.forum-recent-topics--simple .forum-recent-topic-item {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  list-style: none;
}

.forum-recent-topics--simple .forum-recent-topic-item:last-child {
  border-bottom: none;
}

.forum-recent-topics--simple .forum-recent-topic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.2rem;
}

.forum-recent-topics--simple .forum-recent-topic-rank {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 1.25rem;
}

.forum-recent-topics--simple .forum-recent-topic-link {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.35;
}

.forum-recent-topics--simple .forum-recent-topic-link:hover {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.forum-recent-topics--simple .forum-recent-flag {
  font-size: 0.65rem;
  opacity: 0.85;
}

.forum-recent-topics--simple .forum-recent-flag--pin {
  color: #e8c97a;
}

.forum-recent-topics--simple .forum-recent-flag--lock {
  color: #e09898;
}

.forum-recent-topics--simple .forum-recent-topic-meta {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.forum-recent-topics--simple .forum-recent-meta-dot {
  margin: 0 0.2rem;
  opacity: 0.55;
}

.forum-recent-topics--simple .forum-recent-section-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.forum-recent-topics--simple .forum-recent-section-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}


/* --- Admin forum moderation (/user/admin/forum) --- */
.forum-admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: var(--space-sm);
}

.forum-admin-stat-card {
  background: var(--bg-panel-header, #2b2d31);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: var(--space-sm) var(--space-md);
  text-align: center;
}

.forum-admin-stat-card--warn {
  border-color: color-mix(in srgb, var(--accent-danger, #e74c3c) 45%, var(--border-color));
}

.forum-admin-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.forum-admin-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.25;
}


.forum-admin-top-posters-list li {
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border-color);
}

.forum-admin-top-posters-list li:last-child {
  border-bottom: 0;
}

.forum-admin-search-form .form-label {
  display: block;
}

.forum-admin-bulk-toolbar {
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border-color);
}

.forum-admin-row-locked td {
  background: color-mix(in srgb, var(--accent-danger, #c0392b) 8%, transparent);
}

a.forum-admin-open-tab {
  text-decoration: none;
  opacity: 0.65;
}

a.forum-admin-open-tab:hover {
  opacity: 1;
  color: var(--accent-primary);
}

.forum-admin-topic-id {
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace;
  white-space: nowrap;
}

/* —— Topic: chat-style scroll + sticky composer + in-thread search —— */
.forum-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.forum-topic-thread-search-row .forum-topic-thread-search {
  max-width: 22rem;
  width: 100%;
}

.forum-topic-thread-search-hint {
  max-width: 28rem;
}


.big-panel-content.forum-topic-chat-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: min(85vh, 900px);
  padding-top: var(--space-md);
  /* Allow sticky reply composer; global .big-panel-content uses overflow:hidden */
  overflow: visible;
}

/* Opening post: outside the reply scroller (stays visible while replies scroll). */
.forum-topic-op-column {
  flex-shrink: 0;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.forum-topic-op-column .forum-post-op-wrap {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/*
 * Replies list: no inner scroll — only the main page scrolls. “Load older” uses the viewport.
 * Avoids nested scrollbars (page + box) that confuse readers.
 */
.forum-topic-scroll {
  flex: 1 1 auto;
  min-height: min(40vh, 480px);
  overflow: visible;
  padding-right: 0;
}

/* Sticky reply composer: stays under the header while you scroll through replies below. */
.forum-topic-page {
  --forum-composer-sticky-top: 4.5rem;
}

.forum-topic-composer.forum-topic-composer-below-op {
  position: sticky;
  top: var(--forum-composer-sticky-top);
  z-index: 6;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

/* Session option: reply composer scrolls away with the page (no overlap with new messages) */
.forum-topic-page.forum-composer-not-sticky .forum-topic-composer.forum-topic-composer-below-op {
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
}

/* Keep jump-to-post / hash scroll from hiding posts under the sticky composer */
.forum-topic-page #forum-replies-container .forum-post {
  scroll-margin-top: calc(var(--forum-composer-sticky-top) + 14rem);
}

.forum-topic-page.forum-composer-not-sticky #forum-replies-container .forum-post {
  scroll-margin-top: 1rem;
}

.forum-load-older-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  padding-bottom: var(--space-md);
}

.forum-post-op-wrap {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.forum-replies-container .forum-post {
  margin-bottom: var(--space-md);
}

.forum-post-search-hidden {
  display: none !important;
}

.forum-topic-composer {
  flex-shrink: 0;
  background: var(--bg-panel, var(--bg-secondary, #2b2d31));
}

.forum-topic-composer-title {
  margin-top: 0;
}

.forum-topic-composer-muted {
  flex-shrink: 0;
  padding-top: var(--space-md);
}


.forum-topic-chunk-nav {
  flex-shrink: 0;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.forum-topic-chunk-nav-link {
  color: var(--accent-primary, #5865f2);
  text-decoration: none;
}

.forum-topic-chunk-nav-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .forum-topic-page {
    --forum-composer-sticky-top: 3.75rem;
  }

  .forum-topic-thread-search-row .forum-topic-thread-search {
    max-width: none;
  }
}

/* Edited post hint (no “by whom”) */
.forum-post-edited-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted, #9ea4ad);
  border: 1px solid color-mix(in srgb, var(--text-muted, #9ea4ad) 35%, transparent);
  border-radius: 4px;
  vertical-align: middle;
}

/* Mobile/tablet: mount point between forum toolbar and main panel */
.forum-follow-dock-slot:empty {
  display: none;
}

.forum-follow-dock-slot:not(:empty) {
  margin-bottom: var(--space-md);
}

/* Followed topics dock */
.forum-follow-dock {
  z-index: 1200;
}

.forum-follow-dock-inner {
  background: linear-gradient(165deg, var(--bg-panel-header) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}

.forum-follow-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent-secondary) 35%, #f5e6d3);
}

.forum-follow-dock-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.forum-follow-dock-unread-total {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-warning) 28%, var(--bg-secondary));
  color: var(--accent-warning);
  border: 1px solid color-mix(in srgb, var(--accent-warning) 45%, transparent);
}

.forum-follow-dock-body {
  max-height: min(42vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.forum-follow-dock-list {
  list-style: none;
  margin: 0;
  padding: var(--space-xs) 0;
}

.forum-follow-dock-item {
  margin: 0;
  padding: 0;
}

.forum-follow-dock-link {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem var(--space-md);
  color: inherit;
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.forum-follow-dock-link:hover {
  background: var(--bg-tertiary);
  border-left-color: var(--accent-primary);
  box-shadow: inset 3px 0 0 0 var(--accent-secondary);
  text-decoration: none;
}

.forum-follow-dock-link.forum-follow-dock-link--unread {
  border-left-color: var(--accent-warning);
  font-weight: 600;
}

.forum-follow-dock-link-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.forum-follow-dock-badge {
  flex: 0 0 auto;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--bg-btn-primary) 0%, var(--accent-secondary) 100%);
  color: #f8f0e8;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
  box-shadow: 0 1px 0 color-mix(in srgb, #fff 12%, transparent), 0 0 0 1px var(--border-light);
}


.forum-follow-dock-empty {
  padding: var(--space-md);
}

/* Desktop: floating column on the right */
@media (min-width: 992px) {
  .forum-follow-dock {
    position: fixed;
    top: 6.5rem;
    right: max(12px, env(safe-area-inset-right));
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100vh - 7.5rem);
  }

  .forum-follow-dock-inner {
    max-height: calc(100vh - 7.5rem);
    display: flex;
    flex-direction: column;
  }

  .forum-follow-dock-body {
    max-height: min(calc(100vh - 11rem), 480px);
    flex: 1 1 auto;
  }

  .forum-follow-dock-slot {
    display: none !important;
  }
}

/* Mobile / tablet: horizontal strip in document flow */
@media (max-width: 991.98px) {
  .forum-follow-dock {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-height: none;
  }

  .forum-follow-dock-inner {
    max-height: none;
  }

  .forum-follow-dock-body {
    max-height: min(36vh, 260px);
  }

  .forum-follow-dock-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .forum-follow-dock-item {
    flex: 0 0 auto;
    max-width: 220px;
  }

  .forum-follow-dock-link {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    border-left-width: 1px;
    min-height: 3.25rem;
  }

  .forum-follow-dock-link:hover {
    box-shadow: inset 0 -2px 0 0 var(--accent-secondary);
  }

  .forum-follow-dock-link.forum-follow-dock-link--unread {
    border-color: color-mix(in srgb, var(--accent-warning) 55%, var(--border-color));
    box-shadow: none;
  }

  .forum-follow-dock-link.forum-follow-dock-link--unread:hover {
    box-shadow: inset 0 -2px 0 0 var(--accent-warning);
  }

  .forum-follow-dock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    min-width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    padding: 0 0.3rem;
    font-size: 0.65rem;
  }

  .forum-follow-dock-link-text {
    -webkit-line-clamp: 2;
    padding-right: 0.5rem;
  }
}


.forum-topic-header-actions .forum-topic-follow-btn {
  vertical-align: middle;
}
