/* Forum-only additions on top of the main site's site.css tokens/components. */

.forum-shell {
  padding: 40px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.account-link,
.account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* The forum's own logout item is a real <button type="submit"> inside a
   <form> (for CSRF), so it needs its own reset to match the <a> items
   that site.css already styles for .account-dropdown. */
.account-dropdown form {
  margin: 0;
}

.account-dropdown button[role="menuitem"] {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.account-dropdown button[role="menuitem"]:hover {
  background: rgba(255, 255, 255, 0.08);
}

.inline-form {
  display: inline;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 14px;
}

.flash-error {
  border-color: var(--accent-dark);
  background: rgba(255, 49, 111, 0.1);
  color: var(--accent-bright);
}

.flash-success {
  border-color: var(--success);
  background: rgba(119, 217, 150, 0.1);
  color: var(--success);
}

.forum-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.forum-header h1 {
  font-family: var(--display);
  letter-spacing: 0.02em;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0;
}

.forum-crumbs {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.forum-crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.forum-crumbs a:hover {
  color: var(--text);
}

.category-list,
.thread-list,
.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-card,
.thread-row,
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.category-card:hover,
.thread-row:hover {
  border-color: var(--line-strong);
}

.category-card a,
.thread-row a {
  text-decoration: none;
  color: inherit;
}

.category-card h3,
.thread-row h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.category-card p,
.thread-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.category-stats,
.thread-stats {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.thread-row.pinned {
  border-color: var(--accent-dark);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

.badge-pinned { background: rgba(255, 49, 111, 0.16); color: var(--accent-bright); }
.badge-locked { background: rgba(241, 197, 108, 0.16); color: var(--warning); }
.badge-role  { background: rgba(119, 227, 255, 0.16); color: var(--cyan); }

.member-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-section + .member-section {
  margin-top: 8px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.member-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.member-card:hover {
  border-color: var(--line-strong);
}

.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

/* Now that usernames can contain spaces (and just generally can run
   long), names wrap onto a second line instead of being clipped with an
   ellipsis — nothing about who someone is should get cut off on the
   member list. overflow-wrap so one unbroken long word still can't push
   the card wider than its grid column. */
.member-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.post-author {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.post-author img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.post-author strong {
  font-size: 14px;
}

.post-body {
  font-size: 15px;
  line-height: 1.65;
  word-wrap: break-word;
}

.post-body a {
  color: var(--cyan);
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.post-actions {
  display: flex;
  gap: 10px;
}

.post-actions button,
.post-actions a {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

.post-actions button:hover,
.post-actions a:hover {
  color: var(--accent-bright);
}

.form-card {
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
}

.form-card.form-wide {
  max-width: 100%;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.form-field input,
.form-field textarea,
.form-field select {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
}

.form-field textarea {
  min-height: 140px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.form-errors {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-dark);
  background: rgba(255, 49, 111, 0.1);
  color: var(--accent-bright);
  font-size: 14px;
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.button-discord {
  background: #5865f2;
  color: #fff;
  border: none;
}

.button-discord:hover {
  background: #4752c4;
}

.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
}

.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-row {
  flex-wrap: wrap;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .post-card {
    grid-template-columns: 1fr;
  }
  .post-author {
    flex-direction: row;
    align-items: center;
  }
}

/* ---- Admin Users tab: search box, Admins&Mods/Members grouping, and a
   per-user dropdown (click the player's name) for the bank-adjustment
   form — see templates/admin_users.php. Role/ban stay as plain buttons
   next to the dropdown, not inside it. */
.user-search input[type="search"] {
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.user-search input[type="search"]:focus {
  outline: none;
  border-color: var(--line-strong);
}

.user-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-group-title {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.user-group-title .count {
  font-weight: 400;
}

/* The user-search script above toggles the [hidden] attribute on
   .user-group/.user-entry to filter the list — without this, their own
   `display: flex` below (same specificity as the browser's default
   [hidden] rule, but an author stylesheet always wins that tie) would
   keep them visually showing even while "hidden". */
.user-group[hidden],
.user-entry[hidden] {
  display: none !important;
}

.user-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.user-entry .user-details {
  flex: 1 1 260px;
  min-width: 0;
}

.user-entry .admin-actions {
  flex: 0 0 auto;
}

.user-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.user-summary::-webkit-details-marker {
  display: none;
}

.user-summary-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.user-rename-panel {
  margin-top: 14px;
}

.user-rename-panel input[type="text"] {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.user-bank-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
