/**
 * WSForum - Frontend Styles
 *
 * Theme-agnostic CSS for the WSForum WordPress plugin.
 * Inherits fonts, base colors, and typography from the active theme.
 * Use CSS custom properties to override defaults in your theme.
 *
 * Prefix: wsforum-
 */

/* ==========================================================================
   CSS Custom Properties (override in your theme stylesheet)
   ========================================================================== */

:root {
  --wsforum-primary: currentColor;
  --wsforum-border: #ddd;
  --wsforum-bg-pinned: #f0f7ff;
  --wsforum-bg-pending: #fffbea;
  --wsforum-text-muted: #767676;
  --wsforum-badge-bg: #e8e8e8;
  --wsforum-badge-text: #333;
  --wsforum-hover-bg: rgba(0, 0, 0, 0.03);
  --wsforum-radius: 4px;
  --wsforum-btn-bg: #0073aa;
  --wsforum-btn-text: #fff;
  --wsforum-btn-bg-hover: #005f8a;
}

/* ==========================================================================
   Breadcrumb Navigation
   ========================================================================== */

.wsforum-breadcrumb {
  margin: 0 0 1rem;
  font-size: 0.875em;
  color: var(--wsforum-text-muted);
  line-height: 1.4;
}

.wsforum-breadcrumb a {
  color: var(--wsforum-btn-bg);
  text-decoration: none;
}

.wsforum-breadcrumb a:hover {
  text-decoration: underline;
}

.wsforum-breadcrumb-sep {
  margin: 0 0.4em;
  color: var(--wsforum-text-muted);
}

.wsforum-breadcrumb-current {
  color: inherit;
  font-weight: 600;
}

/* ==========================================================================
   Forum List (e.g. /community page)
   ========================================================================== */

.wsforum-forum-list {
  margin: 1.5rem 0;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  overflow: hidden;
}

.wsforum-forum-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--wsforum-border);
  transition: background-color 0.15s ease;
}

.wsforum-forum-item:last-child {
  border-bottom: none;
}

.wsforum-forum-item:hover {
  background-color: var(--wsforum-hover-bg);
}

.wsforum-forum-info {
  flex: 1 1 auto;
  min-width: 0;
}

.wsforum-forum-title {
  margin: 0 0 0.25rem;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1.3;
}

.wsforum-forum-title a {
  color: inherit;
  text-decoration: none;
}

.wsforum-forum-title a:hover,
.wsforum-forum-title a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

.wsforum-forum-description {
  margin: 0;
  font-size: 0.9em;
  color: var(--wsforum-text-muted);
  line-height: 1.5;
}

.wsforum-forum-recent-topics {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.85em;
}

.wsforum-forum-recent-topics li {
  padding: 0.15em 0;
}

.wsforum-forum-recent-topics li::before {
  content: "\2192\00a0";
  color: var(--wsforum-text-muted);
}

.wsforum-forum-recent-topics a {
  color: inherit;
  text-decoration: none;
}

.wsforum-forum-recent-topics a:hover,
.wsforum-forum-recent-topics a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

.wsforum-forum-stats {
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.85em;
  color: var(--wsforum-text-muted);
  white-space: nowrap;
}

.wsforum-forum-topic-count {
  display: block;
  font-weight: 600;
  color: inherit;
  margin-bottom: 0.25rem;
}

.wsforum-forum-last-activity {
  display: block;
  font-size: 0.9em;
  color: var(--wsforum-text-muted);
}

/* ==========================================================================
   Create Forum Form (admin only, on root page)
   ========================================================================== */

.wsforum-create-forum-wrap {
  margin: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.wsforum-create-forum-form {
  width: 100%;
  margin-top: 1rem;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  padding: 1.25rem;
  background: #fafafa;
}

.wsforum-create-forum-form-inner .wsforum-form-field {
  margin-bottom: 1rem;
}

.wsforum-create-forum-form-inner label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9em;
}

.wsforum-create-forum-form-inner input[type="text"],
.wsforum-create-forum-form-inner textarea {
  width: 100%;
  padding: 0.5em 0.65em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font: inherit;
  font-size: 0.95em;
  box-sizing: border-box;
}

.wsforum-create-forum-form-inner input[type="checkbox"] {
  margin-right: 0.35em;
}

.wsforum-form-fieldset {
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  padding: 0.75rem 1rem 1rem;
}

.wsforum-form-fieldset legend {
  font-weight: 600;
  font-size: 0.9em;
  padding: 0 0.35em;
}

.wsforum-form-fieldset .description {
  font-size: 0.8em;
  color: var(--wsforum-text-muted);
  margin: 0 0 0.5rem;
}

.wsforum-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.wsforum-checkbox-grid label {
  font-weight: normal;
  font-size: 0.9em;
  white-space: nowrap;
}

/* ==========================================================================
   Topic List (individual forum page)
   ========================================================================== */

.wsforum-topic-list {
  margin: 1.5rem 0;
}

/* New Topic Button + Form */

.wsforum-topic-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.wsforum-new-topic-btn {
  display: inline-block;
  padding: 0.55em 1.2em;
  background-color: var(--wsforum-btn-bg);
  color: var(--wsforum-btn-text);
  border: none;
  border-radius: var(--wsforum-radius);
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.wsforum-new-topic-btn:hover,
.wsforum-new-topic-btn:focus {
  background-color: var(--wsforum-btn-bg-hover);
  color: var(--wsforum-btn-text);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  outline-offset: 2px;
}

.wsforum-new-topic-form {
  display: none; /* shown via JS when New Topic is clicked */
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  background-color: var(--wsforum-hover-bg);
}

.wsforum-new-topic-form.is-open {
  display: block;
}

/* Topic item rows */

.wsforum-topic-list-inner {
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  overflow: hidden;
}

.wsforum-topic-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--wsforum-border);
  transition: background-color 0.15s ease;
}

.wsforum-topic-item:last-child {
  border-bottom: none;
}

.wsforum-topic-item:hover {
  background-color: var(--wsforum-hover-bg);
}

/* Modifiers */

.wsforum-topic-pinned {
  background-color: var(--wsforum-bg-pinned);
}

.wsforum-topic-pinned:hover {
  background-color: var(--wsforum-bg-pinned);
  filter: brightness(0.97);
}

.wsforum-topic-pending {
  background-color: var(--wsforum-bg-pending);
  opacity: 0.9;
}

.wsforum-topic-pending:hover {
  background-color: var(--wsforum-bg-pending);
  filter: brightness(0.97);
}

.wsforum-topic-locked {
  opacity: 0.8;
}

/* Topic info */

.wsforum-topic-info {
  flex: 1 1 auto;
  min-width: 0;
}

.wsforum-topic-title {
  margin: 0 0 0.3rem;
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4em;
}

.wsforum-topic-title a {
  color: inherit;
  text-decoration: none;
}

.wsforum-topic-title a:hover,
.wsforum-topic-title a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

/* Pin icon */

.wsforum-pin-icon {
  display: inline-block;
  font-style: normal;
  line-height: 1;
  flex-shrink: 0;
}

.wsforum-pin-icon::before {
  content: "📌";
  font-size: 0.85em;
}

/* Lock icon */

.wsforum-lock-icon {
  display: inline-block;
  font-style: normal;
  line-height: 1;
  flex-shrink: 0;
}

.wsforum-lock-icon::before {
  content: "🔒";
  font-size: 0.85em;
}

/* Topic meta */

.wsforum-topic-meta {
  font-size: 0.82em;
  color: var(--wsforum-text-muted);
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em 0.6em;
}

.wsforum-author-link {
  color: var(--wsforum-text-muted);
  text-decoration: none;
  font-weight: 500;
}

.wsforum-author-link:hover,
.wsforum-author-link:focus {
  text-decoration: underline;
}

.wsforum-reply-count {
  white-space: nowrap;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.wsforum-badge {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 3px;
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
  background-color: var(--wsforum-badge-bg);
  color: var(--wsforum-badge-text);
}

.wsforum-edited-badge {
  display: inline-block;
  padding: 0.12em 0.5em;
  border-radius: 3px;
  font-size: 0.72em;
  font-weight: 500;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
  background-color: var(--wsforum-badge-bg);
  color: var(--wsforum-text-muted);
}

.wsforum-pending-badge {
  display: inline-block;
  padding: 0.12em 0.5em;
  border-radius: 3px;
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
  background-color: #fef3c7;
  color: #92400e;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.wsforum-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1.5rem 0;
  font-size: 0.9em;
}

.wsforum-pagination a,
.wsforum-pagination .current,
.wsforum-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2em;
  padding: 0.35em 0.6em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  text-decoration: none;
  color: inherit;
  line-height: 1.3;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.wsforum-pagination a:hover,
.wsforum-pagination a:focus {
  background-color: var(--wsforum-hover-bg);
  border-color: #aaa;
  text-decoration: none;
}

.wsforum-pagination .current {
  background-color: var(--wsforum-btn-bg);
  border-color: var(--wsforum-btn-bg);
  color: var(--wsforum-btn-text);
  font-weight: 600;
  cursor: default;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.wsforum-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--wsforum-text-muted);
  border: 1px dashed var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font-size: 0.95em;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.wsforum-notice {
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  border: 1px solid var(--wsforum-border);
  border-left-width: 4px;
  border-radius: var(--wsforum-radius);
  font-size: 0.95em;
}

.wsforum-notice-error {
  background: #fcebea;
  border-color: #d63638;
  color: #8a1f1f;
}

/* ==========================================================================
   General Utilities
   ========================================================================== */

.wsforum-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.82em;
}

/* ==========================================================================
   Future / Upcoming Elements
   (Stubs for phases not yet implemented)
   ========================================================================== */

/* Generic topic / reply form */
.wsforum-topic-form,
.wsforum-reply-form {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
}

.wsforum-topic-form label,
.wsforum-reply-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35em;
  font-size: 0.9em;
}

.wsforum-topic-form input[type="text"],
.wsforum-topic-form textarea,
.wsforum-reply-form input[type="text"],
.wsforum-reply-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
  padding: 0.5em 0.75em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font: inherit;
}

/* Moderation action bar */
.wsforum-moderation-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0;
  font-size: 0.85em;
  border-top: 1px solid var(--wsforum-border);
  margin-top: 0.75rem;
}

/* Search form */
.wsforum-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.wsforum-search-form input[type="search"],
.wsforum-search-form input[type="text"] {
  flex: 1 1 auto;
  padding: 0.5em 0.75em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font: inherit;
}

.wsforum-search-form button {
  padding: 0.5em 1em;
  background-color: var(--wsforum-btn-bg);
  color: var(--wsforum-btn-text);
  border: none;
  border-radius: var(--wsforum-radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.wsforum-search-form button:hover,
.wsforum-search-form button:focus {
  background-color: var(--wsforum-btn-bg-hover);
}

/* Search results */
.wsforum-search-results {
  margin: 1.5rem 0;
}

.wsforum-search-results .wsforum-topic-item {
  border-left: 3px solid var(--wsforum-btn-bg);
}

.wsforum-search-section-heading {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.05em;
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--wsforum-border);
}

.wsforum-search-section-heading:first-child {
  margin-top: 0;
}

.wsforum-search-result {
  padding: 1rem 1.25rem;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  margin-bottom: 0.75rem;
  transition: background-color 0.12s ease;
}

.wsforum-search-result:last-of-type {
  margin-bottom: 0;
}

.wsforum-search-result:hover {
  background-color: var(--wsforum-hover-bg);
}

.wsforum-search-result-title {
  margin: 0 0 0.35rem;
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
}

.wsforum-search-result-title a {
  color: inherit;
  text-decoration: none;
}

.wsforum-search-result-title a:hover,
.wsforum-search-result-title a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

.wsforum-search-result-excerpt {
  margin: 0 0 0.4rem;
  font-size: 0.9em;
  line-height: 1.6;
  color: #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wsforum-search-result-excerpt mark {
  background-color: #fff3cd;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
  font-style: normal;
}

.wsforum-search-result-meta {
  font-size: 0.8em;
  color: var(--wsforum-text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2em 0.4em;
  line-height: 1.5;
}

.wsforum-search-result-meta a {
  color: var(--wsforum-text-muted);
  text-decoration: none;
}

.wsforum-search-result-meta a:hover,
.wsforum-search-result-meta a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

.wsforum-search-empty {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--wsforum-text-muted);
  border: 1px dashed var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font-size: 0.95em;
  margin: 1.25rem 0;
}

/* Subscribe button */
.wsforum-subscribe-wrap {
  display: flex;
  justify-content: flex-end;
  margin: 1rem 0;
}

.wsforum-subscribe-btn {
  display: inline-block;
  padding: 0.4em 0.9em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font-size: 0.85em;
  font-weight: 500;
  color: inherit;
  background-color: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.wsforum-subscribe-btn:hover,
.wsforum-subscribe-btn:focus {
  background-color: var(--wsforum-hover-bg);
  border-color: #aaa;
  text-decoration: none;
}

.wsforum-subscribe-btn.is-subscribed,
.wsforum-subscribe-btn--subscribed {
  background-color: var(--wsforum-badge-bg);
  border-color: transparent;
}

.wsforum-subscribe-btn--subscribed:hover,
.wsforum-subscribe-btn--subscribed:focus {
  background-color: #d8d8d8;
  border-color: #bbb;
}

.wsforum-subscribe-btn:disabled,
.wsforum-subscribe-btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

/* ==========================================================================
   @mention Autocomplete Dropdown — Phase 5
   ========================================================================== */

/*
 * The dropdown is positioned absolutely inside the (relatively-positioned)
 * parent of the textarea.  JS sets `width` to match the textarea width.
 */
.wsforum-mention-dropdown {
  position: absolute;
  z-index: 9999;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background-color: #fff;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.9em;
  line-height: 1.4;
}

/* Individual suggestion row */
.wsforum-mention-item {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.45em 0.85em;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s ease;
}

.wsforum-mention-item:hover,
.wsforum-mention-item.is-highlighted {
  background-color: var(--wsforum-hover-bg);
}

/* When highlighted via keyboard, give a stronger visual cue */
.wsforum-mention-item.is-highlighted {
  background-color: #e8f0fe;
  outline: none;
}

/* Display name — primary label */
.wsforum-mention-display-name {
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* @username — secondary label */
.wsforum-mention-username {
  font-size: 0.85em;
  color: var(--wsforum-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Responsive — stack on small screens
   ========================================================================== */

@media (max-width: 600px) {
  .wsforum-forum-item {
    flex-direction: column;
    gap: 0.75rem;
  }

  .wsforum-forum-stats {
    text-align: left;
    display: flex;
    gap: 1rem;
  }

  .wsforum-forum-topic-count,
  .wsforum-forum-last-activity {
    display: inline;
  }

  .wsforum-topic-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .wsforum-topic-actions {
    justify-content: flex-start;
  }

  .wsforum-pagination {
    gap: 0.25rem;
  }

  .wsforum-search-form {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==========================================================================
   Topic Single Page
   ========================================================================== */

.wsforum-topic-single {
  max-width: 100%;
  margin: 1.5rem 0;
}

/* Breadcrumb */

.wsforum-breadcrumb {
  margin-bottom: 1.25rem;
  font-size: 0.88em;
}

.wsforum-breadcrumb-link {
  color: var(--wsforum-text-muted);
  text-decoration: none;
}

.wsforum-breadcrumb-link:hover,
.wsforum-breadcrumb-link:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

/* Topic header */

.wsforum-topic-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--wsforum-border);
}

.wsforum-topic-title-single {
  margin: 0 0 0.5rem;
  font-size: 1.6em;
  line-height: 1.3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em;
}

/* Topic content */

.wsforum-topic-content {
  margin-bottom: 2rem;
  line-height: 1.7;
}

.wsforum-topic-content p:first-child {
  margin-top: 0;
}

/* ==========================================================================
   Replies Section
   ========================================================================== */

.wsforum-replies {
  margin-top: 2rem;
}

.wsforum-replies-heading {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--wsforum-border);
}

.wsforum-reply-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Individual reply */

.wsforum-reply {
  margin-bottom: 1px;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  background: #fff;
  transition: background-color 0.12s ease;
}

.wsforum-reply + .wsforum-reply {
  margin-top: 0.75rem;
}

/* Nested / threaded replies */

.wsforum-reply--nested,
.wsforum-reply .children .wsforum-reply {
  margin-left: 2rem;
  margin-top: 0.6rem;
  border-left: 3px solid var(--wsforum-border);
}

.wsforum-reply .children {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

/* Reply meta (author, date, badges) */

.wsforum-reply-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3em 0.6em;
  margin-bottom: 0.6rem;
  font-size: 0.83em;
  color: var(--wsforum-text-muted);
}

.wsforum-reply-date {
  color: var(--wsforum-text-muted);
}

/* Reply content */

.wsforum-reply-content {
  line-height: 1.65;
  font-size: 0.97em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

.wsforum-reply-content a {
  color: var(--wsforum-btn-bg);
  word-break: break-all;
}

.wsforum-reply-content a:hover,
.wsforum-reply-content a:focus {
  text-decoration: underline;
}

/* @mention links */

.wsforum-mention {
  color: var(--wsforum-btn-bg);
  font-weight: 500;
  text-decoration: none;
}

.wsforum-mention:hover,
.wsforum-mention:focus {
  text-decoration: underline;
}

/* Reply action buttons */

.wsforum-reply-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  font-size: 0.82em;
}

.wsforum-edit-reply-btn,
.wsforum-cancel-edit-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--wsforum-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s ease;
}

.wsforum-edit-reply-btn:hover,
.wsforum-edit-reply-btn:focus,
.wsforum-cancel-edit-btn:hover,
.wsforum-cancel-edit-btn:focus {
  color: var(--wsforum-btn-bg);
}

/* comment-reply-link (WordPress core reply link) */

.wsforum-reply-actions .comment-reply-link {
  color: var(--wsforum-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s ease;
}

.wsforum-reply-actions .comment-reply-link:hover,
.wsforum-reply-actions .comment-reply-link:focus {
  color: var(--wsforum-btn-bg);
  text-decoration: underline;
}

/* ==========================================================================
   Inline Edit Form
   ========================================================================== */

.wsforum-edit-reply-form {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background-color: var(--wsforum-hover-bg);
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
}

.wsforum-edit-reply-form textarea.wsforum-edit-reply-textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.65rem;
  padding: 0.5em 0.75em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font: inherit;
  resize: vertical;
  min-height: 80px;
}

.wsforum-reply-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9em;
}

/* ==========================================================================
   Reply Form
   ========================================================================== */

.wsforum-reply-form {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--wsforum-border);
}

.wsforum-reply-form-title {
  margin: 0 0 1rem;
  font-size: 1.05em;
  font-weight: 600;
}

.wsforum-reply-form-inner .wsforum-form-field {
  margin-bottom: 1rem;
}

.wsforum-reply-form-inner label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35em;
  font-size: 0.9em;
}

.wsforum-reply-form-inner textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5em 0.75em;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font: inherit;
  resize: vertical;
  min-height: 100px;
}

/* ==========================================================================
   Locked Notice & Login Prompt
   ========================================================================== */

.wsforum-locked-notice {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 1.5rem;
  padding: 0.85rem 1.1rem;
  background-color: var(--wsforum-bg-pending);
  border: 1px solid #e5c97d;
  border-radius: var(--wsforum-radius);
  font-size: 0.93em;
  color: #7a5c00;
}

.wsforum-login-to-reply,
.wsforum-no-reply-permission {
  margin-top: 1.5rem;
  padding: 0.85rem 1.1rem;
  background-color: var(--wsforum-hover-bg);
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font-size: 0.93em;
  color: var(--wsforum-text-muted);
}

.wsforum-login-to-reply a {
  color: var(--wsforum-btn-bg);
}

.wsforum-login-to-reply a:hover,
.wsforum-login-to-reply a:focus {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive — topic single
   ========================================================================== */

@media (max-width: 600px) {
  .wsforum-reply {
    padding: 0.85rem 1rem;
  }

  .wsforum-reply--nested,
  .wsforum-reply .children .wsforum-reply {
    margin-left: 0.85rem;
  }

  .wsforum-topic-title-single {
    font-size: 1.25em;
  }
}

/* ==========================================================================
   Moderation — Phase 4
   ========================================================================== */

/* --------------------------------------------------------------------------
   Moderator action bar
   -------------------------------------------------------------------------- */

.wsforum-mod-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  background-color: #f9f9f9;
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  font-size: 0.8em;
}

.wsforum-mod-actions--reply {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
}

/* --------------------------------------------------------------------------
   Individual mod buttons
   -------------------------------------------------------------------------- */

.wsforum-mod-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25em 0.65em;
  border: 1px solid transparent;
  border-radius: 3px;
  background-color: #e8e8e8;
  color: #333;
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.wsforum-mod-btn:hover,
.wsforum-mod-btn:focus {
  background-color: #d8d8d8;
  border-color: #bbb;
  color: #111;
  text-decoration: none;
  outline-offset: 2px;
}

/* Approve — green tint */
.wsforum-mod-btn--approve {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.wsforum-mod-btn--approve:hover,
.wsforum-mod-btn--approve:focus {
  background-color: #a7f3d0;
  border-color: #6ee7b7;
  color: #064e3b;
}

/* Edit — blue tint */
.wsforum-mod-btn--edit {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.wsforum-mod-btn--edit:hover,
.wsforum-mod-btn--edit:focus {
  background-color: #bfdbfe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

/* Delete — red tint */
.wsforum-mod-btn--delete {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.wsforum-mod-btn--delete:hover,
.wsforum-mod-btn--delete:focus {
  background-color: #fecaca;
  border-color: #fca5a5;
  color: #7f1d1d;
}

/* Lock / unlock — amber tint */
.wsforum-mod-btn--lock {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.wsforum-mod-btn--lock:hover,
.wsforum-mod-btn--lock:focus {
  background-color: #fde68a;
  border-color: #fcd34d;
  color: #78350f;
}

/* Pin / unpin — purple tint */
.wsforum-mod-btn--pin {
  background-color: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.wsforum-mod-btn--pin:hover,
.wsforum-mod-btn--pin:focus {
  background-color: #ddd6fe;
  border-color: #c4b5fd;
  color: #4c1d95;
}

/* Ban / unban — slate tint */
.wsforum-mod-btn--ban {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.wsforum-mod-btn--ban:hover,
.wsforum-mod-btn--ban:focus {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
}

/* View-original button */
.wsforum-mod-btn--original {
  background-color: #f0f9ff;
  color: #0c4a6e;
  border-color: #bae6fd;
}

.wsforum-mod-btn--original:hover,
.wsforum-mod-btn--original:focus {
  background-color: #bae6fd;
  border-color: #7dd3fc;
  color: #082f49;
}

/* Disabled state for any mod button during async operations */
.wsforum-mod-btn:disabled,
.wsforum-mod-btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Pending-content banner
   -------------------------------------------------------------------------- */

.wsforum-pending-banner {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: var(--wsforum-radius);
  font-size: 0.9em;
  color: #78350f;
  line-height: 1.5;
}

.wsforum-pending-banner::before {
  content: "⏳";
  flex-shrink: 0;
  font-size: 1em;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Original-content reveal panel
   -------------------------------------------------------------------------- */

.wsforum-original-content {
  margin-top: 0.6rem;
  padding: 0.75rem 1rem;
  background-color: #f8fafc;
  border: 1px solid var(--wsforum-border);
  border-left: 3px solid #94a3b8;
  border-radius: var(--wsforum-radius);
  font-size: 0.9em;
  line-height: 1.6;
  color: #334155;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wsforum-original-content-label {
  display: block;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 0.4em;
}

/* --------------------------------------------------------------------------
   Responsive — mod actions
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .wsforum-mod-actions {
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
  }

  .wsforum-mod-btn {
    padding: 0.3em 0.55em;
    font-size: 0.75em;
  }
}

/* ==========================================================================
   Link Previews — Phase 7
   ========================================================================== */

.wsforum-link-previews {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wsforum-link-previews figure.wp-block-embed {
  margin: 0;
}

.wsforum-link-preview {
  border: 1px solid var(--wsforum-border);
  border-radius: var(--wsforum-radius);
  padding: 0.85rem 1rem;
  max-width: 600px;
  margin: 0;
  background: #fff;
}

.wsforum-link-preview-inner {
  display: flex;
  flex-direction: row;
  gap: 0.85rem;
  align-items: flex-start;
}

.wsforum-link-preview-img {
  flex: 0 0 auto;
}

.wsforum-link-preview img {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: var(--wsforum-radius);
  display: block;
}

.wsforum-link-preview-body {
  flex: 1 1 auto;
  min-width: 0;
}

.wsforum-link-preview-site {
  margin: 0 0 0.2em;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wsforum-text-muted);
}

.wsforum-link-preview-title {
  margin: 0 0 0.25em;
  font-weight: 600;
  font-size: 0.95em;
  line-height: 1.4;
}

.wsforum-link-preview-title a {
  color: inherit;
  text-decoration: none;
}

.wsforum-link-preview-title a:hover,
.wsforum-link-preview-title a:focus {
  text-decoration: underline;
  color: var(--wsforum-btn-bg);
}

.wsforum-link-preview-description {
  margin: 0;
  font-size: 0.875em;
  color: var(--wsforum-text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Forum Settings form — reuses Create Forum classes; extra selector for specificity */
.wsforum-forum-settings-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 0;
}

/* Stack on small screens */
@media (max-width: 600px) {
  .wsforum-link-preview-inner {
    flex-direction: column;
  }

  .wsforum-link-preview img {
    max-width: 100%;
    max-height: 200px;
    width: 100%;
    object-fit: cover;
  }
}

/* ==========================================================================
   Live Unfurl — composer preview cards (v1.6.0)
   ========================================================================== */

.wsforum-unfurl-previews {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wsforum-unfurl-card {
  position: relative;
  border: 1px solid var(--wp--preset--color--accent-3, #ddd);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--wp--preset--color--base, #fafafa);
  font-size: 0.9em;
}

.wsforum-unfurl-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
}

.wsforum-unfurl-host {
  font-weight: 600;
}

.wsforum-unfurl-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ddd;
  border-top-color: #666;
  border-radius: 50%;
  animation: wsforum-spin 0.7s linear infinite;
}

@keyframes wsforum-spin {
  to { transform: rotate(360deg); }
}

.wsforum-unfurl-failed {
  color: #888;
  font-size: 0.85em;
}

.wsforum-unfurl-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}

.wsforum-unfurl-dismiss:hover {
  color: #333;
}

.wsforum-unfurl-reason {
  color: #b00;
  font-family: monospace;
  font-size: 0.85em;
}
.wsforum-unfurl-trace {
  margin-top: 4px;
  font-size: 0.8em;
}
.wsforum-unfurl-trace pre {
  background: #f5f5f5;
  padding: 6px 8px;
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ======================================================================
 * Forum tags (wsforum_tag taxonomy)
 * ====================================================================== */

.wsforum-topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  margin: 0.4em 0;
}

.wsforum-topic-tags-single {
  align-items: center;
  margin: 1em 0;
  padding: 0.5em 0;
  border-top: 1px solid #eee;
}

.wsforum-tags-label {
  font-weight: 600;
  color: #555;
  margin-right: 0.3em;
}

.wsforum-tag-chip {
  display: inline-block;
  padding: 0.15em 0.6em;
  background: #eef3f8;
  color: #24528a;
  border-radius: 999px;
  font-size: 0.82em;
  text-decoration: none;
  line-height: 1.5;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.wsforum-tag-chip:hover,
.wsforum-tag-chip:focus {
  background: #dce6f3;
  border-color: #b5c6df;
  text-decoration: none;
}

.wsforum-tag-filter-banner {
  display: flex;
  align-items: center;
  gap: 0.75em;
  padding: 0.6em 0.85em;
  margin: 0 0 1em 0;
  background: #fff8e1;
  border: 1px solid #f2d98b;
  border-radius: 4px;
  font-size: 0.9em;
}

.wsforum-tag-filter-clear {
  margin-left: auto;
  font-size: 0.85em;
}

/* Tag input field + autocomplete */

.wsforum-tags-field {
  position: relative;
}

.wsforum-tags-input {
  width: 100%;
}

.wsforum-field-hint {
  font-size: 0.82em;
  color: #777;
  margin: 0.25em 0 0 0;
}

.wsforum-tag-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.08 );
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25em 0;
  display: flex;
  flex-direction: column;
}

.wsforum-tag-suggestions[hidden] {
  display: none;
}

.wsforum-tag-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0.4em 0.75em;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.wsforum-tag-suggestion:hover,
.wsforum-tag-suggestion.is-highlighted {
  background: #eef3f8;
}

.wsforum-tag-suggestion-count {
  color: #999;
  font-size: 0.85em;
}

/* ==========================================================================
   Firehose
   ========================================================================== */

/* Forum-list row for the Firehose pseudo-forum */
.wsforum-forum-firehose {
  background-color: #f5f0ff;
  border-left: 3px solid #7c4dff;
}

/* Filter bar: sort select + active-tag chips */
.wsforum-firehose-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 1em;
  margin: 0 0 1rem;
}

/* Active tag chip with × remove link */
.wsforum-firehose-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.15em 0.55em;
  border-radius: 3px;
  font-size: 0.82em;
  background-color: var(--wsforum-badge-bg);
  color: var(--wsforum-badge-text);
}

.wsforum-firehose-active-tag a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
}

.wsforum-firehose-active-tag a:hover {
  text-decoration: underline;
}

/* "in <Forum>" source label on topic rows */
.wsforum-firehose-source {
  font-size: 0.8em;
  color: var(--wsforum-text-muted);
  margin-bottom: 0.2em;
}

.wsforum-firehose-source a {
  color: var(--wsforum-text-muted);
  text-decoration: none;
}

.wsforum-firehose-source a:hover {
  text-decoration: underline;
}

/* Firehose tag-filter autocomplete */
.wsforum-firehose-tag-filter {
  position: relative;
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.wsforum-firehose-tag-input {
  width: 220px;
  padding: 0.3em 0.55em;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
  font-size: 0.9em;
}

.wsforum-firehose-tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.08 );
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25em 0;
  display: flex;
  flex-direction: column;
}

.wsforum-firehose-tag-suggestions[hidden] {
  display: none;
}
