/* ============================================================
   Haporium Community — community.css
   Twitter + Reddit + Discord inspired dark-first design
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  --community-accent: #6c63ff;
  --community-accent-hover: #5a52d9;
  --community-accent-light: rgba(108, 99, 255, 0.15);
  --community-accent-glow: rgba(108, 99, 255, 0.4);
  --community-success: #00d4aa;
  --community-danger: #ff4757;
  --community-warning: #ffa502;
  --community-bg: var(--bg-primary, #1a1a2e);
  --community-card: var(--bg-card, #2a2a3e);
  --community-card-rgb: 42, 42, 62;
  --community-text: var(--text-primary, #ffffff);
  --community-text-secondary: var(--text-secondary, #a0a0a0);
  --community-text-muted: var(--text-muted, #6c757d);
  --community-border: var(--border-color, rgba(255,255,255,0.1));
  --community-border-light: var(--border-light, rgba(255,255,255,0.05));
  --community-radius: 16px;
  --community-radius-sm: 10px;
  --community-radius-xs: 6px;
  --community-shadow: 0 4px 24px rgba(0,0,0,0.2);
  --community-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --community-sidebar-w: 280px;
  --community-right-w: 320px;
  --community-feed-max: 640px;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes communityFadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes communityPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@keyframes communityShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes communityPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes communityConfetti {
  0%   { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.3) rotate(180deg); }
}
@keyframes communitySpin {
  to { transform: rotate(360deg); }
}

/* ── Page Layout ──────────────────────────────────────────── */
.community-page {
  display: grid;
  grid-template-columns: var(--community-sidebar-w) minmax(0, 1fr) var(--community-right-w);
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
  padding: 24px 16px;
}

/* ── Sidebar (Left) ───────────────────────────────────────── */
.community-sidebar {
  position: sticky;
  top: 90px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(108,99,255,0.3) transparent;
}

.community-sidebar::-webkit-scrollbar { width: 4px; }
.community-sidebar::-webkit-scrollbar-thumb { background: rgba(108,99,255,0.3); border-radius: 4px; }

.community-sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.community-sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--community-radius-sm);
  color: var(--community-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all var(--community-transition);
}

.community-sidebar-nav li a:hover,
.community-sidebar-nav li a.active {
  background: var(--community-accent-light);
  color: var(--community-accent);
}

.community-sidebar-nav li a.active {
  font-weight: 700;
}

.community-sidebar-nav li a i {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.sidebar-compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--community-transition);
  box-shadow: 0 4px 16px var(--community-accent-glow);
  margin-bottom: 24px;
}

.sidebar-compose-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--community-accent-glow);
  filter: brightness(1.08);
}


/* ── Sidebar User Profile ────────────────────────────────── */
.sidebar-user-profile {
  padding: 16px;
  border-bottom: 1px solid var(--community-border-light);
  margin-bottom: 12px;
}

.sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 8px;
  border-radius: var(--community-radius);
  transition: background var(--community-transition);
}

.sidebar-user-link:hover {
  background: rgba(var(--community-accent-rgb), 0.1);
}

.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--community-accent);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--community-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-handle {
  font-size: 13px;
  color: var(--community-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sidebar Guest CTA ───────────────────────────────────── */
.sidebar-guest-cta {
  padding: 20px 16px;
  text-align: center;
  border-bottom: 1px solid var(--community-border-light);
  margin-bottom: 12px;
}

.sidebar-guest-cta p {
  font-size: 14px;
  color: var(--community-text-secondary);
  margin-bottom: 12px;
}

.sidebar-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  transition: all var(--community-transition);
}

.sidebar-signin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--community-accent-glow);
  filter: brightness(1.1);
}

.sidebar-signin-btn i {
  font-size: 14px;
}

/* Light theme support for sidebar user/guest sections */
.light-theme .sidebar-user-name,
body:not(.dark-theme) .sidebar-user-name {
  color: #1a1a2e;
}

.light-theme .sidebar-guest-cta p,
body:not(.dark-theme) .sidebar-guest-cta p {
  color: #666;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--community-text-muted);
  margin-bottom: 12px;
  padding: 0 16px;
}

.sidebar-topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-topic-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--community-radius-xs);
  color: var(--community-text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all var(--community-transition);
}

.sidebar-topic-list li a:hover {
  background: var(--community-accent-light);
  color: var(--community-accent);
}

.sidebar-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 16px;
  background: rgba(var(--community-card-rgb), 0.5);
  border-radius: var(--community-radius-sm);
  border: 1px solid var(--community-border-light);
}

.sidebar-stat {
  text-align: center;
}

.sidebar-stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--community-text);
}

.sidebar-stat-label {
  font-size: 11px;
  color: var(--community-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Feed (Center) ────────────────────────────────────────── */
.community-feed-wrapper {
  max-width: var(--community-feed-max);
  margin: 0 auto;
  width: 100%;
}

.community-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Feed Tabs ────────────────────────────────────────────── */
.community-feed-tabs {
  display: flex;
  border-bottom: 1px solid var(--community-border);
  margin-bottom: 2px;
  background: rgba(var(--community-card-rgb), 0.5);
  backdrop-filter: blur(10px);
  border-radius: var(--community-radius) var(--community-radius) 0 0;
  overflow: hidden;
  position: sticky;
  top: 70px;
  z-index: 10;
}

.community-feed-tab {
  flex: 1;
  padding: 16px 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--community-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: all var(--community-transition);
}

.community-feed-tab:hover {
  background: rgba(108, 99, 255, 0.06);
  color: var(--community-text);
}

.community-feed-tab.active {
  color: var(--community-accent);
  font-weight: 700;
}

.community-feed-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: var(--community-accent);
}

/* ── Post Card ────────────────────────────────────────────── */
.community-post-card {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-bottom: 1px solid var(--community-border);
  transition: background var(--community-transition);
  animation: communityFadeInUp 0.35s ease both;
  cursor: pointer;
}

.community-post-card:first-child {
  border-radius: var(--community-radius) var(--community-radius) 0 0;
}

.community-post-card:last-child {
  border-radius: 0 0 var(--community-radius) var(--community-radius);
}

.community-post-card:only-child {
  border-radius: var(--community-radius);
}

.community-post-card:hover {
  background: rgba(var(--community-card-rgb), 0.9);
}

.post-avatar {
  flex-shrink: 0;
}

.post-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--community-border-light);
  transition: border-color var(--community-transition);
}

.community-post-card:hover .post-avatar img {
  border-color: var(--community-accent);
}

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

.post-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.post-author {
  font-weight: 700;
  font-size: 15px;
  color: var(--community-text);
}

.post-handle {
  font-size: 14px;
  color: var(--community-text-muted);
}

.post-dot {
  color: var(--community-text-muted);
  font-size: 14px;
}

.post-time {
  font-size: 14px;
  color: var(--community-text-muted);
}

.post-time:hover {
  text-decoration: underline;
}

.post-menu {
  margin-left: auto;
  position: relative;
}

.post-menu-btn {
  background: none;
  border: none;
  color: var(--community-text-muted);
  padding: 4px 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--community-transition);
  font-size: 16px;
}

.post-menu-btn:hover {
  background: var(--community-accent-light);
  color: var(--community-accent);
}

.post-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--community-card);
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius-sm);
  box-shadow: var(--community-shadow);
  z-index: 100;
  overflow: hidden;
}

.post-menu-dropdown.show { display: block; }

.post-menu-dropdown a,
.post-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--community-text);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--community-transition);
  text-decoration: none;
  text-align: left;
}

.post-menu-dropdown a:hover,
.post-menu-dropdown button:hover {
  background: var(--community-accent-light);
}

.post-menu-dropdown .danger { color: var(--community-danger); }

/* Post Content */
.post-content {
  font-size: 15px;
  line-height: 1.55;
  color: var(--community-text);
  margin-bottom: 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content a {
  color: var(--community-accent);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content .mention {
  color: var(--community-accent);
  font-weight: 600;
  cursor: pointer;
}

.post-content .hashtag {
  color: var(--community-accent);
  cursor: pointer;
  font-weight: 500;
}

.post-content .hashtag:hover {
  text-decoration: underline;
}

/* Post Visibility Badge */
.post-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--community-text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  margin-left: 6px;
}

/* ── Media Grid ───────────────────────────────────────────── */
.post-media-grid {
  display: grid;
  gap: 4px;
  border-radius: var(--community-radius);
  overflow: hidden;
  margin-bottom: 10px;
  max-height: 400px;
}

.post-media-grid.media-1 { grid-template-columns: 1fr; }
.post-media-grid.media-2 { grid-template-columns: 1fr 1fr; }
.post-media-grid.media-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.post-media-grid.media-3 .media-item:first-child {
  grid-row: 1 / 3;
}
.post-media-grid.media-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.media-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.media-item:hover img {
  transform: scale(1.03);
}

/* ── Hashtag Pills ────────────────────────────────────────── */
.post-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.hashtag-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--community-accent-light);
  color: var(--community-accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--community-transition);
  cursor: pointer;
}

.hashtag-pill:hover {
  background: var(--community-accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Reactions ────────────────────────────────────────────── */
.post-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.community-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;  /* Improved touch target */
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  background: rgba(var(--community-card-rgb), 0.5);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--community-transition);
  user-select: none;
}

.community-reaction:hover {
  border-color: var(--community-accent);
  background: var(--community-accent-light);
  transform: scale(1.05);
}

.community-reaction.active {
  border-color: var(--community-accent);
  background: var(--community-accent-light);
}

.community-reaction.pop {
  animation: communityPop 0.4s ease;
}

.community-reaction .reaction-emoji {
  font-size: 16px;
  line-height: 1;
}

.community-reaction .reaction-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--community-text-secondary);
  min-width: 8px;
}

.community-reaction.active .reaction-count {
  color: var(--community-accent);
}

/* Reaction picker (on hover of heart) */
.reaction-picker-wrapper {
  position: relative;
  display: inline-flex;
}

.reaction-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--community-card);
  border: 1px solid var(--community-border);
  border-radius: 999px;
  padding: 6px 10px;
  gap: 4px;
  box-shadow: var(--community-shadow);
  z-index: 50;
  white-space: nowrap;
}

.reaction-picker.show {
  display: flex;
}

.reaction-picker-emoji {
  font-size: 22px;
  cursor: pointer;
  padding: 8px 10px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  transition: all 0.15s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reaction-picker-emoji:hover {
  transform: scale(1.3);
  background: var(--community-accent-light);
}

/* Confetti particles */
.reaction-confetti {
  position: absolute;
  pointer-events: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: communityConfetti 0.6s ease-out forwards;
}

/* ── Action Bar ───────────────────────────────────────────── */
.post-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 -8px;
}

.post-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;  /* Touch target accessibility */
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--community-text-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--community-radius-xs);
  transition: all var(--community-transition);
  flex: 1;
  justify-content: center;
}

.post-actions button:hover {
  color: var(--community-accent);
  background: var(--community-accent-light);
}

.post-actions button i { font-size: 16px; }
.post-actions button span { font-size: 13px; font-weight: 500; }

.action-comment:hover { color: var(--community-accent) !important; }
.action-repost:hover { color: var(--community-success) !important; }
.action-repost.active { color: var(--community-success); }
.action-react:hover { color: #ff6b8a !important; }
.action-react.active { color: #ff6b8a; }
.action-react.active i { font-weight: 900; }
.action-bookmark:hover { color: var(--community-warning) !important; }
.action-bookmark.active { color: var(--community-warning); }
.action-bookmark.active i { font-weight: 900; }
.action-share:hover { color: var(--community-accent) !important; }

/* ── Compose ──────────────────────────────────────────────── */
.community-compose {
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  padding: 16px 20px;
  margin-bottom: 2px;
}

.community-compose-inner {
  display: flex;
  gap: 12px;
}

.compose-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.compose-form {
  flex: 1;
  min-width: 0;
}

.compose-textarea {
  width: 100%;
  min-height: 60px;
  max-height: 300px;
  border: none;
  background: transparent;
  color: var(--community-text);
  font-size: 18px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  padding: 8px 0;
  font-family: inherit;
  outline: none;
}

.compose-textarea::placeholder {
  color: var(--community-text-muted);
}

.compose-divider {
  height: 1px;
  background: var(--community-border);
  margin: 8px 0 12px;
}

.compose-options {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.compose-option-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--community-accent);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--community-transition);
}

.compose-option-btn:hover {
  background: var(--community-accent-light);
}

.compose-visibility {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--community-accent);
  color: var(--community-accent);
  font-size: 13px;
  font-weight: 600;
  background: none;
  cursor: pointer;
  transition: all var(--community-transition);
}

.compose-visibility:hover {
  background: var(--community-accent-light);
}

.compose-char-counter {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--community-text-muted);
  transition: color var(--community-transition);
}

.compose-char-counter.warning { color: var(--community-warning); }
.compose-char-counter.danger  { color: var(--community-danger); }

.compose-submit-btn {
  padding: 8px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--community-transition);
  margin-left: auto;
}

.compose-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--community-accent-glow);
  filter: brightness(1.1);
}

.compose-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.compose-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Topic selector pills in compose */
.compose-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.compose-topic-pill {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  background: none;
  color: var(--community-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--community-transition);
}

.compose-topic-pill:hover,
.compose-topic-pill.selected {
  border-color: var(--community-accent);
  background: var(--community-accent-light);
  color: var(--community-accent);
}

/* Compose Modal Overlay */
.compose-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1050;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.compose-modal-overlay.show {
  display: flex;
}

.compose-modal {
  width: 100%;
  max-width: 600px;
  background: var(--community-card);
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius);
  box-shadow: var(--community-shadow);
  animation: communityFadeInUp 0.25s ease;
}

.compose-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--community-border-light);
}

.compose-modal-close {
  background: none;
  border: none;
  color: var(--community-text);
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--community-transition);
}

.compose-modal-close:hover {
  background: var(--community-accent-light);
}

.compose-modal-body {
  padding: 16px;
}

/* ── Right Panel ──────────────────────────────────────────── */
.community-right-panel {
  position: sticky;
  top: 90px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-left: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(108,99,255,0.3) transparent;
}

.community-right-panel::-webkit-scrollbar { width: 4px; }
.community-right-panel::-webkit-scrollbar-thumb { background: rgba(108,99,255,0.3); border-radius: 4px; }

.right-panel-card {
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  padding: 20px;
  margin-bottom: 16px;
}

.right-panel-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--community-text);
  margin-bottom: 16px;
}

/* Trending Hashtags */
.trending-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--community-border-light);
  text-decoration: none;
  transition: background var(--community-transition);
}

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

.trending-item:hover .trending-name {
  color: var(--community-accent);
}

.trending-category {
  font-size: 12px;
  color: var(--community-text-muted);
}

.trending-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--community-text);
  transition: color var(--community-transition);
}

.trending-count {
  font-size: 13px;
  color: var(--community-text-muted);
}

/* User Suggestion Card */
.community-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--community-border-light);
}

.community-user-card:last-child { border-bottom: none; }

.community-user-card .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.community-user-card .user-info {
  flex: 1;
  min-width: 0;
}

.community-user-card .user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--community-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-user-card .user-handle {
  font-size: 13px;
  color: var(--community-text-muted);
}

.community-user-card .user-bio {
  font-size: 13px;
  color: var(--community-text-secondary);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Follow Button ────────────────────────────────────────── */
.community-follow-btn {
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--community-accent);
  background: var(--community-accent);
  color: #fff;
  transition: all var(--community-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.community-follow-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
}

.community-follow-btn.following {
  background: transparent;
  color: var(--community-text);
  border-color: var(--community-border);
}

.community-follow-btn.following:hover {
  border-color: var(--community-danger);
  color: var(--community-danger);
  background: rgba(255, 71, 87, 0.1);
}

/* Active topics */
.active-topic-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--community-text);
  transition: color var(--community-transition);
}

.active-topic-item:hover { color: var(--community-accent); }

.active-topic-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--community-radius-xs);
  background: var(--community-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--community-accent);
  font-size: 14px;
}

.active-topic-name {
  font-size: 14px;
  font-weight: 600;
}

/* ── Thread View ──────────────────────────────────────────── */
.community-thread {
  position: relative;
}

.community-thread .community-post-card {
  position: relative;
}

.thread-line {
  position: absolute;
  left: 38px;
  top: 60px;
  bottom: 0;
  width: 2px;
  background: var(--community-border);
}

.thread-connector {
  position: absolute;
  left: 38px;
  top: 0;
  height: 16px;
  width: 2px;
  background: var(--community-border);
}

/* ── Comment Section ──────────────────────────────────────── */
.community-comment-section {
  border-top: 1px solid var(--community-border);
}

.community-comment {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--community-border-light);
  animation: communityFadeInUp 0.3s ease both;
}

.community-comment.nested-1 { padding-left: 56px; }
.community-comment.nested-2 { padding-left: 92px; }
.community-comment.nested-3 { padding-left: 128px; }

.comment-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

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

.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.comment-author {
  font-weight: 700;
  font-size: 14px;
  color: var(--community-text);
}

.comment-handle {
  font-size: 13px;
  color: var(--community-text-muted);
}

.comment-time {
  font-size: 13px;
  color: var(--community-text-muted);
}

.comment-content {
  font-size: 14px;
  line-height: 1.45;
  color: var(--community-text);
  margin-bottom: 6px;
}

.comment-actions {
  display: flex;
  gap: 16px;
}

.comment-actions button {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--community-text-muted);
  cursor: pointer;
  padding: 2px 0;
  transition: color var(--community-transition);
}

.comment-actions button:hover {
  color: var(--community-accent);
}

/* Mini compose for replies */
.comment-reply-form {
  display: none;
  padding: 10px 20px 10px 56px;
  border-bottom: 1px solid var(--community-border-light);
}

.comment-reply-form.show { display: flex; gap: 10px; }

.comment-reply-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--community-border);
  border-radius: 999px;
  background: rgba(var(--community-card-rgb), 0.5);
  color: var(--community-text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--community-transition);
}

.comment-reply-input:focus {
  border-color: var(--community-accent);
}

.comment-reply-submit {
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: var(--community-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--community-transition);
}

.comment-reply-submit:hover { filter: brightness(1.15); }

/* ── Topic Header ─────────────────────────────────────────── */
.community-topic-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  margin-bottom: 16px;
}

.topic-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--community-radius-sm);
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  flex-shrink: 0;
}

.topic-info { flex: 1; }
.topic-name { font-size: 24px; font-weight: 800; color: var(--community-text); margin-bottom: 4px; }
.topic-description { font-size: 14px; color: var(--community-text-secondary); margin-bottom: 8px; }
.topic-meta { display: flex; gap: 16px; font-size: 13px; color: var(--community-text-muted); }
.topic-meta strong { color: var(--community-text); font-weight: 700; }

/* ── Hashtag Header ───────────────────────────────────────── */
.community-hashtag-header {
  padding: 24px;
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  margin-bottom: 16px;
}

.hashtag-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--community-accent);
  margin-bottom: 4px;
}

.hashtag-stats {
  font-size: 14px;
  color: var(--community-text-muted);
}

.hashtag-stats strong {
  color: var(--community-text);
}

/* ── Notification Item ────────────────────────────────────── */
.community-notification {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--community-border-light);
  transition: background var(--community-transition);
}

.community-notification:hover {
  background: rgba(var(--community-card-rgb), 0.5);
}

.community-notification.unread {
  background: rgba(108, 99, 255, 0.05);
  border-left: 3px solid var(--community-accent);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.notification-icon.type-reaction  { background: rgba(255,107,138,0.15); color: #ff6b8a; }
.notification-icon.type-comment   { background: var(--community-accent-light); color: var(--community-accent); }
.notification-icon.type-follow    { background: rgba(0,212,170,0.15); color: var(--community-success); }
.notification-icon.type-repost    { background: rgba(0,212,170,0.15); color: var(--community-success); }
.notification-icon.type-mention   { background: rgba(255,165,2,0.15); color: var(--community-warning); }

.notification-body { flex: 1; }
.notification-text { font-size: 14px; color: var(--community-text); line-height: 1.4; }
.notification-text strong { font-weight: 700; }
.notification-time { font-size: 12px; color: var(--community-text-muted); margin-top: 2px; }

/* ── Skeleton Loading ─────────────────────────────────────── */
.community-skeleton {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(var(--community-card-rgb), 0.7);
  border: 1px solid var(--community-border-light);
  border-bottom: 1px solid var(--community-border);
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 400px 100%;
  animation: communityShimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-body { flex: 1; }

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 400px 100%;
  animation: communityShimmer 1.5s infinite;
  margin-bottom: 10px;
}

.skeleton-line.short  { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long   { width: 100%; }

.skeleton-actions {
  display: flex;
  gap: 30px;
  margin-top: 12px;
}

.skeleton-action {
  width: 50px;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 400px 100%;
  animation: communityShimmer 1.5s infinite;
}

/* ── Empty State ──────────────────────────────────────────── */
.community-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.community-empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.community-empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--community-text);
  margin-bottom: 8px;
}

.community-empty-text {
  font-size: 15px;
  color: var(--community-text-muted);
  margin-bottom: 20px;
  max-width: 360px;
}

.community-empty-cta {
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--community-transition);
}

.community-empty-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--community-accent-glow);
}

/* ── Toast Notification ───────────────────────────────────── */
.community-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--community-card);
  color: var(--community-text);
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  box-shadow: var(--community-shadow);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.community-toast.show {
  transform: translateX(-50%) translateY(0);
}

.community-toast.success { border-color: var(--community-success); }
.community-toast.error   { border-color: var(--community-danger); }

/* ── Loading Spinner ──────────────────────────────────────── */
.community-spinner {
  display: flex;
  justify-content: center;
  padding: 30px;
}

.community-spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--community-border);
  border-top-color: var(--community-accent);
  border-radius: 50%;
  animation: communitySpin 0.7s linear infinite;
}

/* ── Explore page ─────────────────────────────────────────── */
.explore-topics-bar {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.explore-topics-bar::-webkit-scrollbar { display: none; }

.explore-topic-chip {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  background: rgba(var(--community-card-rgb), 0.5);
  color: var(--community-text-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--community-transition);
  text-decoration: none;
}

.explore-topic-chip:hover,
.explore-topic-chip.active {
  border-color: var(--community-accent);
  background: var(--community-accent-light);
  color: var(--community-accent);
}

/* ── Mobile Bottom Nav ────────────────────────────────────── */
.community-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--community-card);
  border-top: 1px solid var(--community-border);
  z-index: 1000;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.community-mobile-nav-inner {
  display: flex;
  align-items: stretch;
}

.community-mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;  /* Touch target ≥44px */
  padding: 10px 0;
  text-decoration: none;
  color: var(--community-text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: color var(--community-transition);
  position: relative;
}

.community-mobile-nav a.active {
  color: var(--community-accent);
}

.community-mobile-nav a i {
  font-size: 20px;
}

.community-mobile-nav .mobile-nav-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  transform: translateX(12px);
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--community-danger);
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Mobile FAB compose */
.community-mobile-fab {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--community-accent-glow);
  z-index: 999;
  transition: all var(--community-transition);
  align-items: center;
  justify-content: center;
}

.community-mobile-fab:hover {
  transform: scale(1.1);
}

/* Mention autocomplete dropdown */
.mention-dropdown {
  position: absolute;
  background: var(--community-card);
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius-sm);
  box-shadow: var(--community-shadow);
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  min-width: 240px;
}

.mention-dropdown.show { display: block; }

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--community-transition);
}

.mention-item:hover,
.mention-item.active {
  background: var(--community-accent-light);
}

.mention-item img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.mention-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--community-text);
}

.mention-item-handle {
  font-size: 12px;
  color: var(--community-text-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .community-page {
    grid-template-columns: var(--community-sidebar-w) minmax(0, 1fr);
  }
  .community-right-panel { display: none; }
}

@media (max-width: 768px) {
  .community-page {
    grid-template-columns: 1fr;
    padding: 0;
    padding-bottom: 60px;
    gap: 0;
  }

  .community-sidebar { display: none; }
  .community-right-panel { display: none; }
  .community-mobile-nav { display: block; }
  .community-mobile-fab { display: flex; }

  .community-feed-wrapper { max-width: 100%; }

  .community-post-card {
    border-radius: 0;
    padding: 14px 16px;
  }

  .community-post-card:first-child,
  .community-post-card:last-child,
  .community-post-card:only-child {
    border-radius: 0;
  }

  .community-feed-tabs {
    border-radius: 0;
    position: sticky;
    top: 56px;
  }

  .community-compose {
    border-radius: 0;
    margin-bottom: 0;
  }

  .community-topic-header {
    border-radius: 0;
    flex-direction: column;
    text-align: center;
  }

  .topic-meta { justify-content: center; }

  .compose-modal {
    max-width: 100%;
    border-radius: var(--community-radius) var(--community-radius) 0 0;
    margin-top: auto;
  }

  .compose-modal-overlay {
    align-items: flex-end;
    padding-top: 0;
  }

  .post-actions button {
    padding: 10px 8px;
    min-height: 44px;
  }
}

@media (max-width: 400px) {
  .community-post-card { padding: 12px; gap: 10px; }
  .post-avatar img { width: 38px; height: 38px; }
  .post-content { font-size: 14px; }
  .compose-textarea { font-size: 16px; }
}

/* ── Light theme overrides ────────────────────────────────── */
.light-theme .community-post-card {
  --community-card-rgb: 255, 255, 255;
}

.light-theme .community-skeleton .skeleton-avatar,
.light-theme .community-skeleton .skeleton-line,
.light-theme .community-skeleton .skeleton-action {
  background: linear-gradient(90deg, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.05) 75%);
  background-size: 400px 100%;
  animation: communityShimmer 1.5s infinite;
}

.light-theme .community-post-card {
  border-color: rgba(0,0,0,0.08);
}

.light-theme .community-post-card:hover {
  background: rgba(0,0,0,0.02);
}

/* ── Inline Composer (index.php) ─────────────────────────── */
.community-composer {
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  padding: 16px 20px;
  margin-bottom: 2px;
}

.community-composer textarea {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  border: none;
  background: transparent;
  color: var(--community-text);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  padding: 8px 0;
  font-family: inherit;
  outline: none;
}

.community-composer textarea::placeholder {
  color: var(--community-text-muted);
}

.community-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--community-border-light);
}

.community-composer-actions select {
  background: transparent;
  border: 1px solid var(--community-border-light);
  color: var(--community-text-muted);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
}

.community-composer-actions .btn-primary {
  background: var(--primary-color, crimson);
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}

.community-composer-actions .btn-primary:hover {
  filter: brightness(1.1);
}

/* ── Guest CTA polish ─────────────────────────────────────── */
.community-guest-cta {
  animation: communityFadeInUp 0.35s ease both;
}

/* ── Compose modal enter animation ────────────────────────── */
.community-modal-overlay {
  animation: communityFadeIn 0.2s ease;
}

@keyframes communityFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.community-modal-overlay .community-modal {
  animation: communitySlideUp 0.25s ease;
}

@keyframes communitySlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Char counter states ──────────────────────────────────── */
.compose-char-counter.warning { color: #ffc107; }
.compose-char-counter.danger { color: #dc3545; }

/* ============================================================
   Community Improvements — Link Preview, Board Embed, 
   Media Upload, Moderation, Mobile Polish
   ============================================================ */

/* ── Link Preview Card ────────────────────────────────────── */
.link-preview-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius);
  overflow: hidden;
  margin: 10px 0;
  text-decoration: none;
  color: inherit;
  transition: all var(--community-transition);
  background: rgba(var(--community-card-rgb), 0.4);
}

.link-preview-card:hover {
  border-color: var(--community-accent);
  background: rgba(var(--community-card-rgb), 0.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.link-preview-image {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
}

.link-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.link-preview-card:hover .link-preview-image img {
  transform: scale(1.02);
}

.link-preview-body {
  padding: 12px 16px;
}

.link-preview-domain {
  font-size: 12px;
  color: var(--community-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.link-preview-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--community-text);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-desc {
  font-size: 13px;
  color: var(--community-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Board Embed Card ─────────────────────────────────────── */
.board-embed-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius);
  overflow: hidden;
  margin: 10px 0;
  text-decoration: none;
  color: inherit;
  transition: all var(--community-transition);
  background: linear-gradient(135deg, rgba(108,99,255,0.08), rgba(155,89,182,0.08));
  border-color: rgba(108,99,255,0.3);
}

.board-embed-card:hover {
  border-color: var(--community-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--community-accent-glow);
}

.board-embed-cover {
  width: 100%;
  max-height: 180px;
  overflow: hidden;
}

.board-embed-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.board-embed-card:hover .board-embed-cover img {
  transform: scale(1.02);
}

.board-embed-body {
  padding: 12px 16px;
}

.board-embed-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--community-accent);
  margin-bottom: 6px;
}

.board-embed-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--community-text);
  line-height: 1.3;
}

/* ── Compose Media Grid ───────────────────────────────────── */
.compose-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.compose-media-item {
  position: relative;
  border-radius: var(--community-radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--community-border);
}

.compose-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compose-media-item.uploading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
}

.media-upload-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.media-upload-spinner .spinner-ring {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: communitySpin 0.7s linear infinite;
}

.media-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--community-transition);
  z-index: 3;
}

.media-remove-btn:hover {
  background: var(--community-danger);
  transform: scale(1.1);
}

/* ── Compose Action Toolbar ───────────────────────────────── */
.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--community-border-light);
  margin-top: 8px;
}

.compose-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--community-accent);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--community-transition);
}

.compose-toolbar-btn:hover {
  background: var(--community-accent-light);
  transform: scale(1.1);
}

.compose-toolbar-btn.active {
  background: var(--community-accent-light);
  color: var(--community-accent);
}

/* ── Board Search in Picker ───────────────────────────────── */
.board-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--community-radius-sm);
  cursor: pointer;
  transition: background var(--community-transition);
}

.board-search-item:hover {
  background: var(--community-accent-light);
}

.board-search-cover {
  width: 64px;
  height: 48px;
  border-radius: var(--community-radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}

.board-search-cover-placeholder {
  width: 64px;
  height: 48px;
  border-radius: var(--community-radius-xs);
  background: var(--community-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--community-accent);
  font-size: 20px;
  flex-shrink: 0;
}

.board-search-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--community-text);
}

/* ── Moderation Panel ─────────────────────────────────────── */
.moderation-tabs {
  display: flex;
  border-bottom: 1px solid var(--community-border);
  overflow-x: auto;
}

.mod-tab {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--community-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: all var(--community-transition);
  white-space: nowrap;
}

.mod-tab:hover {
  background: rgba(108,99,255,0.06);
  color: var(--community-text);
}

.mod-tab.active {
  color: var(--community-accent);
}

.mod-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  border-radius: 3px;
  background: var(--community-accent);
}

.mod-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--community-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.report-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--community-border-light);
  animation: communityFadeInUp 0.3s ease both;
}

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

.report-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.report-reason {
  font-size: 14px;
  font-weight: 700;
  color: var(--community-text);
}

.report-meta {
  font-size: 12px;
  color: var(--community-text-muted);
}

.report-post-preview {
  font-size: 14px;
  color: var(--community-text-secondary);
  line-height: 1.4;
  padding: 10px 14px;
  background: rgba(var(--community-card-rgb), 0.4);
  border-radius: var(--community-radius-sm);
  border-left: 3px solid var(--community-border);
  margin-bottom: 10px;
}

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

.mod-action-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--community-border);
  background: none;
  color: var(--community-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--community-transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mod-action-btn:hover {
  transform: translateY(-1px);
}

.mod-action-btn.resolve:hover {
  border-color: var(--community-success);
  color: var(--community-success);
  background: rgba(0,212,170,0.1);
}

.mod-action-btn.delete:hover {
  border-color: var(--community-danger);
  color: var(--community-danger);
  background: rgba(255,71,87,0.1);
}

.mod-action-btn.dismiss:hover {
  border-color: var(--community-warning);
  color: var(--community-warning);
  background: rgba(255,165,2,0.1);
}

/* ── Guest CTA ────────────────────────────────────────────── */
.community-guest-cta {
  text-align: center;
  padding: 32px 20px;
  background: rgba(var(--community-card-rgb), 0.5);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  margin-bottom: 2px;
}

.community-guest-cta p {
  color: var(--community-text-secondary);
  font-size: 15px;
  margin-bottom: 16px;
}

.community-guest-cta .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--community-accent), #9b59b6);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  transition: all var(--community-transition);
}

.community-guest-cta .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--community-accent-glow);
}

/* ── Notification Badge Polish ────────────────────────────── */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--community-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  position: absolute;
  top: 4px;
  right: 4px;
  animation: communityPulse 2s ease-in-out infinite;
}

/* ── Improved Mobile Experience ───────────────────────────── */
@media (max-width: 768px) {
  /* Fix dialog overlaps */
  .compose-modal-overlay.show {
    padding-top: 0;
    align-items: flex-end;
  }

  .compose-modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
  }

  /* Mobile nav spacing */
  .community-mobile-nav {
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  /* Better touch targets */
  .post-actions button {
    min-height: 44px;
    padding: 10px 8px;
  }

  .community-reaction {
    padding: 6px 12px;
    min-height: 36px;
  }

  .reaction-picker {
    padding: 8px 12px;
    gap: 2px;
  }

  .reaction-picker-emoji {
    font-size: 26px;
    padding: 6px 8px;
  }

  /* Link preview on mobile */
  .link-preview-card {
    margin: 8px 0;
  }

  .link-preview-image {
    max-height: 150px;
  }

  /* Board embed on mobile */
  .board-embed-cover {
    max-height: 120px;
  }

  /* Compose media grid on mobile */
  .compose-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  /* Toast above mobile nav */
  .community-toast {
    bottom: 80px;
  }

  /* Report modal mobile */
  .report-modal {
    max-height: 70vh;
  }

  .report-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .report-reason-btn {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--community-border);
    border-radius: var(--community-radius-sm);
    background: none;
    color: var(--community-text);
    font-size: 15px;
    cursor: pointer;
    transition: all var(--community-transition);
    text-align: left;
  }

  .report-reason-btn:hover,
  .report-reason-btn:active {
    background: var(--community-accent-light);
    border-color: var(--community-accent);
  }

  /* Better hashtag scrolling on mobile */
  .post-hashtags {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .post-hashtags::-webkit-scrollbar { display: none; }

  /* Profile header mobile fix */
  .community-profile-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 20px 16px;
  }
}

@media (max-width: 400px) {
  .post-header {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .post-handle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
  }

  .post-author {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
}

/* ── Smooth scroll-to-top when tab switch ─────────────────── */
.community-feed-wrapper {
  scroll-behavior: smooth;
}

/* ── Profile Header polish ────────────────────────────────── */
.community-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: rgba(var(--community-card-rgb), 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius);
  margin-bottom: 16px;
}

.profile-avatar-big img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--community-accent);
}

.profile-handle {
  font-size: 14px;
  color: var(--community-text-muted);
}

/* ── Sidebar Moderation Link ──────────────────────────────── */
.sidebar-mod-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: var(--community-radius-sm);
  background: rgba(255,71,87,0.05);
  color: var(--community-danger);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--community-transition);
  margin-top: 16px;
}

.sidebar-mod-btn:hover {
  background: rgba(255,71,87,0.15);
  transform: translateY(-1px);
}

/* ── Spinner Ring utility ─────────────────────────────────── */
.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid var(--community-border);
  border-top-color: var(--community-accent);
  border-radius: 50%;
  animation: communitySpin 0.7s linear infinite;
}

.spinner-ring.small {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* ── Community link/hashtag inline styles ─────────────────── */
.community-hashtag {
  color: var(--community-accent);
  text-decoration: none;
  font-weight: 500;
}

.community-hashtag:hover { text-decoration: underline; }

.community-mention {
  color: var(--community-accent);
  text-decoration: none;
  font-weight: 600;
}

.community-mention:hover { text-decoration: underline; }

.community-mention-unknown {
  color: var(--community-text-muted);
}

.community-link {
  color: var(--community-accent);
  text-decoration: none;
  word-break: break-all;
}

.community-link:hover { text-decoration: underline; }

/* ── Smooth transitions for page ──────────────────────────── */
.community-post-card {
  animation: communityFadeInUp 0.35s ease both;
}

/* Stagger animation delay via inline style from JS */

/* ── Report reasons desktop ───────────────────────────────── */
.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-reason-btn {
  padding: 12px 20px;
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius-sm);
  background: none;
  color: var(--community-text);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: all var(--community-transition);
}

.report-reason-btn:hover {
  background: var(--community-accent-light);
  border-color: var(--community-accent);
  transform: translateX(4px);
}

/* ============================================================
   Forum Features — Categories, Threads, Sorting, Moderation
   ============================================================ */

/* ── Breadcrumbs ──────────────────────────────────────────── */
.community-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 14px;
  color: var(--community-text-muted);
  background: rgba(var(--community-card-rgb), 0.5);
  border-bottom: 1px solid var(--community-border-light);
  border-radius: var(--community-radius) var(--community-radius) 0 0;
  flex-wrap: wrap;
}

.community-breadcrumb a {
  color: var(--community-text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: color var(--community-transition);
}

.community-breadcrumb a:hover {
  color: var(--community-accent);
}

.breadcrumb-sep {
  font-size: 10px;
  color: var(--community-text-muted);
  opacity: 0.5;
}

.breadcrumb-current {
  color: var(--community-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* ── Sort Controls ────────────────────────────────────────── */
.community-sort-controls {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  background: rgba(var(--community-card-rgb), 0.5);
  border-bottom: 1px solid var(--community-border-light);
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;  /* Touch target accessibility */
  padding: 8px 16px;
  border: 1px solid var(--community-border);
  border-radius: 999px;
  background: none;
  color: var(--community-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--community-transition);
}

.sort-btn:hover {
  border-color: var(--community-accent);
  color: var(--community-accent);
  background: var(--community-accent-light);
}

.sort-btn.active {
  border-color: var(--community-accent);
  background: var(--community-accent);
  color: #fff;
}

.sort-btn i {
  font-size: 12px;
}

/* ── Post Title ───────────────────────────────────────────── */
.post-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--community-text);
  margin-bottom: 6px;
  cursor: pointer;
  line-height: 1.3;
  transition: color var(--community-transition);
}

.post-title:hover {
  color: var(--community-accent);
}

/* ── Post Badges (pinned/sticky/locked) ───────────────────── */
.post-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.post-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-badge.pinned {
  background: rgba(108, 99, 255, 0.15);
  color: var(--community-accent);
  border: 1px solid rgba(108, 99, 255, 0.3);
}

.post-badge.sticky {
  background: rgba(255, 165, 2, 0.15);
  color: var(--community-warning);
  border: 1px solid rgba(255, 165, 2, 0.3);
}

.post-badge.locked {
  background: rgba(255, 71, 87, 0.15);
  color: var(--community-danger);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

/* ── Thread Status Bar ────────────────────────────────────── */
.thread-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  flex-wrap: wrap;
}

.thread-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.thread-badge.pinned {
  background: var(--community-accent-light);
  color: var(--community-accent);
}

.thread-badge.sticky {
  background: rgba(255, 165, 2, 0.15);
  color: var(--community-warning);
}

.thread-badge.locked {
  background: rgba(255, 71, 87, 0.1);
  color: var(--community-danger);
}

.thread-mod-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.thread-mod-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--community-border);
  background: none;
  color: var(--community-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all var(--community-transition);
}

.thread-mod-btn:hover {
  border-color: var(--community-accent);
  color: var(--community-accent);
  background: var(--community-accent-light);
}

/* ── Thread Title Header ──────────────────────────────────── */
.thread-title-header {
  padding: 16px 20px 4px;
}

.thread-title-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--community-text);
  margin: 0;
  line-height: 1.3;
}

/* ── Thread OP Styling ────────────────────────────────────── */
.thread-op .community-post-card {
  border-radius: var(--community-radius);
  border-left: 3px solid var(--community-accent);
}

.thread-op .post-content {
  font-size: 16px;
  line-height: 1.65;
}

/* ── Thread Locked Notice ─────────────────────────────────── */
.thread-locked-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  margin: 16px 0;
  background: rgba(255, 71, 87, 0.08);
  border: 1px solid rgba(255, 71, 87, 0.2);
  border-radius: var(--community-radius-sm);
  color: var(--community-danger);
  font-size: 14px;
  font-weight: 600;
}

.thread-locked-notice i {
  font-size: 20px;
}

/* ── Topic Banner ─────────────────────────────────────────── */
.community-topic-banner {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  border-radius: var(--community-radius) var(--community-radius) 0 0;
  margin-bottom: -8px;
}

.community-topic-banner img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* ── Topic Rules ──────────────────────────────────────────── */
.community-topic-rules {
  background: rgba(var(--community-card-rgb), 0.5);
  border: 1px solid var(--community-border-light);
  border-radius: var(--community-radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.topic-rules-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--community-text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--community-transition);
}

.topic-rules-toggle:hover {
  color: var(--community-text);
  background: rgba(var(--community-card-rgb), 0.3);
}

.topic-rules-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
}

.community-topic-rules.expanded .topic-rules-arrow {
  transform: rotate(180deg);
}

.topic-rules-content {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 14px;
  color: var(--community-text-secondary);
  line-height: 1.6;
}

.community-topic-rules.expanded .topic-rules-content {
  max-height: 500px;
  padding: 0 16px 16px;
}

/* ── Topic Moderators Bar ─────────────────────────────────── */
.topic-mods-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(var(--community-card-rgb), 0.3);
  border-radius: var(--community-radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--community-text-secondary);
  flex-wrap: wrap;
}

.topic-mods-label {
  font-weight: 700;
  color: var(--community-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topic-mod-name {
  color: var(--community-accent);
  text-decoration: none;
  font-weight: 600;
}

.topic-mod-name:hover {
  text-decoration: underline;
}

/* ── Forum Categories View ────────────────────────────────── */
.forum-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.forum-category-card {
  display: grid;
  grid-template-columns: 56px 1fr 120px 140px;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: rgba(var(--community-card-rgb), 0.7);
  border: 1px solid var(--community-border-light);
  text-decoration: none;
  color: inherit;
  transition: all var(--community-transition);
  animation: communityFadeInUp 0.35s ease both;
}

.forum-category-card:first-child {
  border-radius: var(--community-radius) var(--community-radius) 0 0;
}

.forum-category-card:last-child {
  border-radius: 0 0 var(--community-radius) var(--community-radius);
}

.forum-category-card:only-child {
  border-radius: var(--community-radius);
}

.forum-category-card:hover {
  background: rgba(var(--community-card-rgb), 0.95);
  border-color: var(--community-accent);
  transform: translateX(2px);
}

.forum-cat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--community-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.forum-cat-info {
  min-width: 0;
}

.forum-cat-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--community-text);
  margin-bottom: 2px;
}

.forum-cat-desc {
  font-size: 13px;
  color: var(--community-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-cat-stats {
  display: flex;
  gap: 16px;
  text-align: center;
}

.forum-cat-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.forum-cat-stat strong {
  font-size: 16px;
  font-weight: 800;
  color: var(--community-text);
}

.forum-cat-stat span {
  font-size: 11px;
  color: var(--community-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forum-cat-last {
  text-align: right;
  min-width: 0;
}

.forum-cat-last-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--community-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-cat-last-author {
  font-size: 12px;
  color: var(--community-text-muted);
}

.forum-cat-last-time {
  font-size: 11px;
  color: var(--community-text-muted);
}

.cat-mods {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.cat-mod-badge {
  font-size: 11px;
  color: var(--community-accent);
  font-weight: 600;
}

/* ── Compose Title Input ──────────────────────────────────── */
.compose-title-input {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--community-border-light);
  background: transparent;
  color: var(--community-text);
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  margin-bottom: 8px;
}

.compose-title-input::placeholder {
  color: var(--community-text-muted);
  font-weight: 400;
}

.compose-title-input:focus {
  border-bottom-color: var(--community-accent);
}

/* ── Responsive: Categories ───────────────────────────────── */
@media (max-width: 768px) {
  .forum-category-card {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }

  .forum-cat-stats,
  .forum-cat-last {
    display: none;
  }

  .forum-cat-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .community-breadcrumb {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 0;
  }

  .community-sort-controls {
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .community-sort-controls::-webkit-scrollbar {
    display: none;
  }

  .thread-title-header h1 {
    font-size: 20px;
  }

  .community-topic-banner {
    border-radius: 0;
  }

  .community-topic-banner img {
    height: 140px;
  }
}

@media (max-width: 400px) {
  .sort-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ── Extra mobile fixes (375px) ───────────────────────────── */
@media (max-width: 768px) {
  .community-page {
    display: flex !important;
    flex-direction: column;
    padding: 0;
    padding-bottom: 60px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .community-sidebar,
  .community-right-panel {
    display: none !important;
  }

  .community-feed-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0;
  }

  .community-post-card {
    max-width: 100vw;
    overflow-x: hidden;
    word-break: break-word;
  }

  .post-body {
    min-width: 0;
    overflow: hidden;
  }

  .post-content {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .post-media-grid {
    max-width: 100%;
  }

  .post-header {
    overflow: hidden;
  }

  .post-actions {
    flex-wrap: nowrap;
  }

  .community-compose,
  .community-composer {
    max-width: 100vw;
  }
}

@media (max-width: 375px) {
  .community-post-card {
    padding: 10px;
    gap: 8px;
  }

  .post-avatar img {
    width: 34px;
    height: 34px;
  }

  .post-content {
    font-size: 14px;
  }

  .post-actions button {
    padding: 8px 4px;
    font-size: 12px;
  }

  .post-actions button span {
    font-size: 11px;
  }

  .community-feed-tabs {
    font-size: 13px;
  }

  .community-feed-tab {
    padding: 12px 4px;
    font-size: 13px;
  }

  .compose-textarea {
    font-size: 15px;
    min-height: 44px;
  }
}


/* ── Blockquote styling ──────────────────────────────── */
.community-blockquote {
    border-left: 3px solid var(--primary-color, #6c63ff);
    background: var(--community-bg-secondary, rgba(108, 99, 255, 0.06));
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 0 8px 8px 0;
    color: var(--community-text-muted, #8899a6);
    font-style: italic;
    font-size: 14px;
    line-height: 1.5;
}
.community-blockquote a {
    color: var(--primary-color, #6c63ff);
}

/* ── Sidebar categories link ─────────────────────────── */
.community-sidebar-cat-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--community-text, #e1e8ed);
    text-decoration: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
    margin: 4px 0;
}
.community-sidebar-cat-link:hover {
    background: var(--community-hover, rgba(255,255,255,0.08));
}
.community-sidebar-cat-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* ========================================
   Rich Text Formatting Toolbar
   ======================================== */
.compose-format-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--community-bg-secondary, #f5f5f5);
    border: 1px solid var(--community-border, #e0e0e0);
    border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
}

.format-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--community-text, #333);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.format-btn:hover {
    background: var(--community-bg-hover, #e8e8e8);
    border-color: var(--community-border, #d0d0d0);
}

.format-btn:active {
    background: var(--community-bg-active, #d8d8d8);
    transform: scale(0.95);
}

.format-btn i {
    pointer-events: none;
}

.format-divider {
    width: 1px;
    height: 24px;
    background: var(--community-border, #e0e0e0);
    margin: 0 4px;
}

/* Update textarea to match toolbar */
.compose-textarea {
    border-radius: 0 0 8px 8px !important;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .compose-format-toolbar {
        background: var(--community-bg-secondary, #2a2a2a);
        border-color: var(--community-border, #444);
    }
    
    .format-btn {
        color: var(--community-text, #e0e0e0);
    }
    
    .format-btn:hover {
        background: var(--community-bg-hover, #3a3a3a);
        border-color: var(--community-border, #555);
    }
    
    .format-btn:active {
        background: var(--community-bg-active, #4a4a4a);
    }
    
    .format-divider {
        background: var(--community-border, #444);
    }
}

/* ──────────────────────────────────────────────────────────────────────
   Mobile Swipe Gestures
   ────────────────────────────────────────────────────────────────────── */

@media (max-width: 375px) {
    .community-post-card {
        position: relative;
        transition: transform 0.2s ease, background 0.2s ease;
    }

    .community-post-card.swiping {
        touch-action: none;
        user-select: none;
    }

    .swipe-feedback {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: var(--community-primary);
        color: white;
        padding: 12px 24px;
        border-radius: 24px;
        font-weight: 600;
        font-size: 16px;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        animation: swipeFeedbackPop 0.3s ease;
        pointer-events: none;
    }

    .swipe-feedback.fade-out {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    @keyframes swipeFeedbackPop {
        0% {
            transform: translate(-50%, -50%) scale(0.8);
            opacity: 0;
        }
        50% {
            transform: translate(-50%, -50%) scale(1.1);
        }
        100% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }
    }
}

.swipe-action-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--community-bg, white);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.swipe-action-menu.active {
    transform: translateY(0);
}

.swipe-menu-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--community-text);
}

.swipe-action-menu button {
    width: 100%;
    padding: 16px;
    margin-bottom: 8px;
    border: none;
    background: var(--community-card-bg, #f8f9fa);
    color: var(--community-text);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.swipe-action-menu button:active {
    transform: scale(0.98);
}

.swipe-action-menu button:hover {
    background: var(--community-hover, #e9ecef);
}

.swipe-action-menu button.danger {
    color: #ef4444;
}

.swipe-action-menu button.cancel {
    background: transparent;
    color: var(--community-muted);
    margin-top: 8px;
}

.swipe-action-menu button i {
    width: 24px;
    text-align: center;
}

/* ============================================================
   COMPREHENSIVE LIGHT MODE - Community Page
   Clean whites, crimson accents, professional design
   ============================================================ */

/* ── Light Theme CSS Variables Override ──────────────────── */
.light-theme,
body:not(.dark-theme) {
  /* Primary Crimson Brand */
  --community-accent: #dc143c;
  --community-accent-hover: #b01030;
  --community-accent-light: rgba(220, 20, 60, 0.12);
  --community-accent-glow: rgba(220, 20, 60, 0.25);
  
  /* Status Colors */
  --community-success: #10b981;
  --community-danger: #ef4444;
  --community-warning: #f59e0b;
  
  /* Background Colors - Clean Light */
  --community-bg: #f8f9fa;
  --community-card: #ffffff;
  --community-card-rgb: 255, 255, 255;
  
  /* Text Colors - High Contrast */
  --community-text: #1a1a2e;
  --community-text-secondary: #4a5568;
  --community-text-muted: #718096;
  
  /* Border Colors */
  --community-border: rgba(0, 0, 0, 0.1);
  --community-border-light: rgba(0, 0, 0, 0.06);
  
  /* Shadows for Light */
  --community-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --community-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ── Page Background ──────────────────────────────────────── */
.light-theme .community-page,
body:not(.dark-theme) .community-page {
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

/* ── Post Cards - Clean White Cards ───────────────────────── */
.light-theme .community-post-card,
body:not(.dark-theme) .community-post-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.light-theme .community-post-card:hover,
body:not(.dark-theme) .community-post-card:hover {
  background: #ffffff;
  border-color: rgba(220, 20, 60, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ── Post Content Typography ──────────────────────────────── */
.light-theme .post-author,
body:not(.dark-theme) .post-author {
  color: #1a1a2e;
  font-weight: 600;
}

.light-theme .post-author:hover,
body:not(.dark-theme) .post-author:hover {
  color: #dc143c;
}

.light-theme .post-handle,
.light-theme .post-time,
body:not(.dark-theme) .post-handle,
body:not(.dark-theme) .post-time {
  color: #718096;
}

.light-theme .post-content,
body:not(.dark-theme) .post-content {
  color: #2d3748;
  line-height: 1.6;
}

.light-theme .post-content a,
body:not(.dark-theme) .post-content a {
  color: #dc143c;
}

.light-theme .post-content a:hover,
body:not(.dark-theme) .post-content a:hover {
  color: #b01030;
  text-decoration: underline;
}

/* ── Post Actions - Crimson Highlights ────────────────────── */
.light-theme .post-actions button,
body:not(.dark-theme) .post-actions button {
  color: #718096;
  background: transparent;
}

.light-theme .post-actions button:hover,
body:not(.dark-theme) .post-actions button:hover {
  color: #dc143c;
  background: rgba(220, 20, 60, 0.08);
}

.light-theme .post-actions button.liked,
body:not(.dark-theme) .post-actions button.liked {
  color: #dc143c;
}

.light-theme .post-actions button.liked:hover,
body:not(.dark-theme) .post-actions button.liked:hover {
  background: rgba(220, 20, 60, 0.12);
}

/* ── Sidebar - Light & Clean ──────────────────────────────── */
.light-theme .community-sidebar,
body:not(.dark-theme) .community-sidebar {
  background: transparent;
}

.light-theme .community-sidebar-nav li a,
body:not(.dark-theme) .community-sidebar-nav li a {
  color: #4a5568;
}

.light-theme .community-sidebar-nav li a:hover,
body:not(.dark-theme) .community-sidebar-nav li a:hover {
  background: rgba(220, 20, 60, 0.08);
  color: #dc143c;
}

.light-theme .community-sidebar-nav li a.active,
body:not(.dark-theme) .community-sidebar-nav li a.active {
  background: rgba(220, 20, 60, 0.12);
  color: #dc143c;
  font-weight: 600;
}

.light-theme .community-sidebar-cat-link,
body:not(.dark-theme) .community-sidebar-cat-link {
  color: #4a5568;
}

.light-theme .community-sidebar-cat-link:hover,
body:not(.dark-theme) .community-sidebar-cat-link:hover {
  background: rgba(220, 20, 60, 0.08);
  color: #dc143c;
}

/* ── Profile Card in Sidebar ──────────────────────────────── */
.light-theme .community-profile-card,
body:not(.dark-theme) .community-profile-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.light-theme .community-profile-card .profile-name,
body:not(.dark-theme) .community-profile-card .profile-name {
  color: #1a1a2e;
}

.light-theme .community-profile-card .profile-handle,
body:not(.dark-theme) .community-profile-card .profile-handle {
  color: #718096;
}

/* ── Right Panel - Trending/Suggestions ───────────────────── */
.light-theme .community-right-panel,
body:not(.dark-theme) .community-right-panel {
  background: transparent;
}

.light-theme .community-trends-card,
.light-theme .community-suggestions-card,
body:not(.dark-theme) .community-trends-card,
body:not(.dark-theme) .community-suggestions-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.light-theme .community-trends-card h4,
.light-theme .community-suggestions-card h4,
body:not(.dark-theme) .community-trends-card h4,
body:not(.dark-theme) .community-suggestions-card h4 {
  color: #1a1a2e;
  font-weight: 700;
}

.light-theme .trend-item,
body:not(.dark-theme) .trend-item {
  color: #4a5568;
}

.light-theme .trend-item:hover,
body:not(.dark-theme) .trend-item:hover {
  background: rgba(220, 20, 60, 0.06);
}

.light-theme .trend-category,
body:not(.dark-theme) .trend-category {
  color: #718096;
}

.light-theme .trend-name,
body:not(.dark-theme) .trend-name {
  color: #1a1a2e;
  font-weight: 600;
}

.light-theme .trend-posts,
body:not(.dark-theme) .trend-posts {
  color: #718096;
}

/* ── Feed Tabs ────────────────────────────────────────────── */
.light-theme .community-feed-tabs,
body:not(.dark-theme) .community-feed-tabs {
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .community-feed-tab,
body:not(.dark-theme) .community-feed-tab {
  color: #718096;
}

.light-theme .community-feed-tab:hover,
body:not(.dark-theme) .community-feed-tab:hover {
  color: #dc143c;
  background: rgba(220, 20, 60, 0.06);
}

.light-theme .community-feed-tab.active,
body:not(.dark-theme) .community-feed-tab.active {
  color: #dc143c;
  border-bottom-color: #dc143c;
  font-weight: 600;
}

/* ── Composer - Clean Input ───────────────────────────────── */
.light-theme .community-composer,
body:not(.dark-theme) .community-composer {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.light-theme .community-composer textarea,
body:not(.dark-theme) .community-composer textarea {
  color: #1a1a2e;
  background: transparent;
}

.light-theme .community-composer textarea::placeholder,
body:not(.dark-theme) .community-composer textarea::placeholder {
  color: #a0aec0;
}

.light-theme .community-composer-actions,
body:not(.dark-theme) .community-composer-actions {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.light-theme .community-composer-actions .btn-primary,
body:not(.dark-theme) .community-composer-actions .btn-primary {
  background: linear-gradient(135deg, #dc143c 0%, #b01030 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.light-theme .community-composer-actions .btn-primary:hover,
body:not(.dark-theme) .community-composer-actions .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
  transform: translateY(-1px);
}

/* ── Buttons - Crimson Primary ────────────────────────────── */
.light-theme .community-btn-primary,
.light-theme .btn-community-primary,
body:not(.dark-theme) .community-btn-primary,
body:not(.dark-theme) .btn-community-primary {
  background: linear-gradient(135deg, #dc143c 0%, #b01030 100%);
  color: #ffffff;
  border: none;
}

.light-theme .community-btn-primary:hover,
.light-theme .btn-community-primary:hover,
body:not(.dark-theme) .community-btn-primary:hover,
body:not(.dark-theme) .btn-community-primary:hover {
  box-shadow: 0 4px 12px rgba(220, 20, 60, 0.35);
}

.light-theme .community-btn-outline,
body:not(.dark-theme) .community-btn-outline {
  border: 2px solid #dc143c;
  color: #dc143c;
  background: transparent;
}

.light-theme .community-btn-outline:hover,
body:not(.dark-theme) .community-btn-outline:hover {
  background: #dc143c;
  color: #ffffff;
}

/* ── Links ────────────────────────────────────────────────── */
.light-theme .community-page a,
body:not(.dark-theme) .community-page a {
  color: #dc143c;
}

.light-theme .community-page a:hover,
body:not(.dark-theme) .community-page a:hover {
  color: #b01030;
}

/* ── Comments Section ─────────────────────────────────────── */
.light-theme .community-comment,
body:not(.dark-theme) .community-comment {
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.light-theme .comment-author,
body:not(.dark-theme) .comment-author {
  color: #1a1a2e;
  font-weight: 600;
}

.light-theme .comment-body,
body:not(.dark-theme) .comment-body {
  color: #2d3748;
}

.light-theme .comment-time,
body:not(.dark-theme) .comment-time {
  color: #718096;
}

.light-theme .comment-actions button,
body:not(.dark-theme) .comment-actions button {
  color: #718096;
}

.light-theme .comment-actions button:hover,
body:not(.dark-theme) .comment-actions button:hover {
  color: #dc143c;
}

/* ── Guest CTA Banner ─────────────────────────────────────── */
.light-theme .community-guest-cta,
body:not(.dark-theme) .community-guest-cta {
  background: linear-gradient(135deg, #dc143c 0%, #b01030 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(220, 20, 60, 0.3);
}

.light-theme .community-guest-cta h3,
body:not(.dark-theme) .community-guest-cta h3 {
  color: #ffffff;
}

.light-theme .community-guest-cta p,
body:not(.dark-theme) .community-guest-cta p {
  color: rgba(255, 255, 255, 0.9);
}

.light-theme .community-guest-cta .btn,
body:not(.dark-theme) .community-guest-cta .btn {
  background: #ffffff;
  color: #dc143c;
  font-weight: 600;
}

.light-theme .community-guest-cta .btn:hover,
body:not(.dark-theme) .community-guest-cta .btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

/* ── Media Attachments ────────────────────────────────────── */
.light-theme .post-media-grid,
body:not(.dark-theme) .post-media-grid {
  border-radius: 12px;
  overflow: hidden;
}

.light-theme .post-media-item,
body:not(.dark-theme) .post-media-item {
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Link Preview ─────────────────────────────────────────── */
.light-theme .link-preview,
body:not(.dark-theme) .link-preview {
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .link-preview:hover,
body:not(.dark-theme) .link-preview:hover {
  border-color: rgba(220, 20, 60, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.light-theme .link-preview-title,
body:not(.dark-theme) .link-preview-title {
  color: #1a1a2e;
}

.light-theme .link-preview-description,
body:not(.dark-theme) .link-preview-description {
  color: #4a5568;
}

.light-theme .link-preview-domain,
body:not(.dark-theme) .link-preview-domain {
  color: #718096;
}

/* ── Notifications ────────────────────────────────────────── */
.light-theme .notification-item,
body:not(.dark-theme) .notification-item {
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.light-theme .notification-item:hover,
body:not(.dark-theme) .notification-item:hover {
  background: rgba(220, 20, 60, 0.04);
}

.light-theme .notification-item.unread,
body:not(.dark-theme) .notification-item.unread {
  background: rgba(220, 20, 60, 0.06);
  border-left: 3px solid #dc143c;
}

.light-theme .notification-text,
body:not(.dark-theme) .notification-text {
  color: #2d3748;
}

.light-theme .notification-time,
body:not(.dark-theme) .notification-time {
  color: #718096;
}

.light-theme .notification-icon,
body:not(.dark-theme) .notification-icon {
  color: #dc143c;
}

/* ── Compose Modal ────────────────────────────────────────── */
.light-theme .community-modal-content,
body:not(.dark-theme) .community-modal-content {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.light-theme .compose-modal-header,
body:not(.dark-theme) .compose-modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .compose-modal-header h3,
body:not(.dark-theme) .compose-modal-header h3 {
  color: #1a1a2e;
}

.light-theme .compose-modal-close,
body:not(.dark-theme) .compose-modal-close {
  color: #718096;
}

.light-theme .compose-modal-close:hover,
body:not(.dark-theme) .compose-modal-close:hover {
  color: #dc143c;
  background: rgba(220, 20, 60, 0.08);
}

.light-theme .compose-textarea,
body:not(.dark-theme) .compose-textarea {
  background: #ffffff;
  color: #1a1a2e;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .compose-textarea:focus,
body:not(.dark-theme) .compose-textarea:focus {
  border-color: #dc143c;
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

/* ── Format Toolbar ───────────────────────────────────────── */
.light-theme .compose-format-toolbar,
body:not(.dark-theme) .compose-format-toolbar {
  background: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.08);
}

.light-theme .format-btn,
body:not(.dark-theme) .format-btn {
  color: #4a5568;
}

.light-theme .format-btn:hover,
body:not(.dark-theme) .format-btn:hover {
  background: rgba(220, 20, 60, 0.08);
  color: #dc143c;
}

.light-theme .format-divider,
body:not(.dark-theme) .format-divider {
  background: rgba(0, 0, 0, 0.1);
}

/* ── Skeletons ────────────────────────────────────────────── */
.light-theme .community-skeleton .skeleton-avatar,
.light-theme .community-skeleton .skeleton-line,
.light-theme .community-skeleton .skeleton-action,
body:not(.dark-theme) .community-skeleton .skeleton-avatar,
body:not(.dark-theme) .community-skeleton .skeleton-line,
body:not(.dark-theme) .community-skeleton .skeleton-action {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 400px 100%;
}

/* ── Forum Categories ─────────────────────────────────────── */
.light-theme .forum-category-card,
body:not(.dark-theme) .forum-category-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .forum-category-card:hover,
body:not(.dark-theme) .forum-category-card:hover {
  border-color: rgba(220, 20, 60, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.light-theme .forum-cat-name,
body:not(.dark-theme) .forum-cat-name {
  color: #1a1a2e;
}

.light-theme .forum-cat-desc,
body:not(.dark-theme) .forum-cat-desc {
  color: #718096;
}

.light-theme .forum-cat-stat strong,
body:not(.dark-theme) .forum-cat-stat strong {
  color: #1a1a2e;
}

.light-theme .forum-cat-stat span,
body:not(.dark-theme) .forum-cat-stat span {
  color: #718096;
}

.light-theme .forum-cat-icon,
body:not(.dark-theme) .forum-cat-icon {
  background: rgba(220, 20, 60, 0.1);
  color: #dc143c;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.light-theme .community-breadcrumb,
body:not(.dark-theme) .community-breadcrumb {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .community-breadcrumb a,
body:not(.dark-theme) .community-breadcrumb a {
  color: #dc143c;
}

.light-theme .community-breadcrumb span,
body:not(.dark-theme) .community-breadcrumb span {
  color: #718096;
}

/* ── Sort Controls ────────────────────────────────────────── */
.light-theme .community-sort-controls,
body:not(.dark-theme) .community-sort-controls {
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .sort-btn,
body:not(.dark-theme) .sort-btn {
  color: #4a5568;
  background: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .sort-btn:hover,
body:not(.dark-theme) .sort-btn:hover {
  background: rgba(220, 20, 60, 0.08);
  border-color: rgba(220, 20, 60, 0.2);
  color: #dc143c;
}

.light-theme .sort-btn.active,
body:not(.dark-theme) .sort-btn.active {
  background: #dc143c;
  color: #ffffff;
  border-color: #dc143c;
}

/* ── Blockquote ───────────────────────────────────────────── */
.light-theme .community-blockquote,
body:not(.dark-theme) .community-blockquote {
  border-left-color: #dc143c;
  background: rgba(220, 20, 60, 0.06);
  color: #4a5568;
}

.light-theme .community-blockquote a,
body:not(.dark-theme) .community-blockquote a {
  color: #dc143c;
}

/* ── Scroll and Selection ─────────────────────────────────── */
.light-theme .community-sidebar::-webkit-scrollbar-thumb,
body:not(.dark-theme) .community-sidebar::-webkit-scrollbar-thumb {
  background: rgba(220, 20, 60, 0.3);
}

.light-theme ::selection,
body:not(.dark-theme) ::selection {
  background: rgba(220, 20, 60, 0.2);
  color: #1a1a2e;
}

/* ── Empty States ─────────────────────────────────────────── */
.light-theme .community-empty-state,
body:not(.dark-theme) .community-empty-state {
  color: #718096;
}

.light-theme .community-empty-state i,
body:not(.dark-theme) .community-empty-state i {
  color: rgba(220, 20, 60, 0.4);
}

/* ── Input Fields ─────────────────────────────────────────── */
.light-theme .community-page input[type="text"],
.light-theme .community-page input[type="search"],
.light-theme .community-page textarea,
body:not(.dark-theme) .community-page input[type="text"],
body:not(.dark-theme) .community-page input[type="search"],
body:not(.dark-theme) .community-page textarea {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1a1a2e;
}

.light-theme .community-page input:focus,
.light-theme .community-page textarea:focus,
body:not(.dark-theme) .community-page input:focus,
body:not(.dark-theme) .community-page textarea:focus {
  border-color: #dc143c;
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.12);
  outline: none;
}

.light-theme .community-page input::placeholder,
.light-theme .community-page textarea::placeholder,
body:not(.dark-theme) .community-page input::placeholder,
body:not(.dark-theme) .community-page textarea::placeholder {
  color: #a0aec0;
}

/* ── Dropdown & Select ────────────────────────────────────── */
.light-theme .community-composer-actions select,
body:not(.dark-theme) .community-composer-actions select {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #4a5568;
}

.light-theme .community-composer-actions select:focus,
body:not(.dark-theme) .community-composer-actions select:focus {
  border-color: #dc143c;
}

/* ── Tooltips ─────────────────────────────────────────────── */
.light-theme [data-tooltip]::after,
body:not(.dark-theme) [data-tooltip]::after {
  background: #1a1a2e;
  color: #ffffff;
}

/* ── Badges & Tags ────────────────────────────────────────── */
.light-theme .community-badge,
body:not(.dark-theme) .community-badge {
  background: rgba(220, 20, 60, 0.1);
  color: #dc143c;
}

.light-theme .cat-mod-badge,
body:not(.dark-theme) .cat-mod-badge {
  color: #dc143c;
}

/* ── Thread Title Header ──────────────────────────────────── */
.light-theme .thread-title-header h1,
body:not(.dark-theme) .thread-title-header h1 {
  color: #1a1a2e;
}

/* ── Topic Banner ─────────────────────────────────────────── */
.light-theme .community-topic-banner,
body:not(.dark-theme) .community-topic-banner {
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Swipe Action Menu ────────────────────────────────────── */
.light-theme .swipe-action-menu,
body:not(.dark-theme) .swipe-action-menu {
  background: #ffffff;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.light-theme .swipe-menu-header,
body:not(.dark-theme) .swipe-menu-header {
  color: #1a1a2e;
}

.light-theme .swipe-action-menu button,
body:not(.dark-theme) .swipe-action-menu button {
  background: #f8f9fa;
  color: #2d3748;
}

.light-theme .swipe-action-menu button:hover,
body:not(.dark-theme) .swipe-action-menu button:hover {
  background: rgba(220, 20, 60, 0.08);
}

.light-theme .swipe-action-menu button.danger,
body:not(.dark-theme) .swipe-action-menu button.danger {
  color: #ef4444;
}

/* ── Focus Visible States ─────────────────────────────────── */
.light-theme *:focus-visible,
body:not(.dark-theme) *:focus-visible {
  outline: 2px solid #dc143c;
  outline-offset: 2px;
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  .light-theme .community-page,
  body:not(.dark-theme) .community-page {
    background: #ffffff;
  }
  
  .light-theme .community-post-card,
  body:not(.dark-theme) .community-post-card {
    box-shadow: none;
    border: 1px solid #e0e0e0;
  }
}

/* ============================================================
   FEATURE A: Verified Badge Styles
   ============================================================ */
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1d9bf0;
  font-size: 14px;
  margin-left: 2px;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  min-width: 20px;
  min-height: 20px;
}

.verified-badge:hover {
  transform: scale(1.15);
  color: #1a8cd8;
}

.verified-badge i {
  font-size: 14px;
}

/* Light theme support */
.light-theme .verified-badge,
body:not(.dark-theme) .verified-badge {
  color: #1d9bf0;
}

.light-theme .verified-badge:hover,
body:not(.dark-theme) .verified-badge:hover {
  color: #0a66c2;
}

/* Mobile touch target (≥44px) */
@media (max-width: 768px) {
  .verified-badge {
    min-width: 44px;
    min-height: 44px;
    margin: -12px -8px;
    padding: 12px 8px;
  }
}

/* ============================================================
   FEATURE B: Post Quality Labels (Trending & New)
   ============================================================ */
.post-badge.trending {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.15), rgba(255, 94, 0, 0.15));
  color: #ff9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
  animation: trendingPulse 2s ease-in-out infinite;
}

.post-badge.new-post {
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 184, 148, 0.15));
  color: #00d4aa;
  border: 1px solid rgba(0, 212, 170, 0.3);
}

@keyframes trendingPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(255, 149, 0, 0.2);
  }
}

/* Light theme support for quality labels */
.light-theme .post-badge.trending,
body:not(.dark-theme) .post-badge.trending {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.1), rgba(255, 94, 0, 0.1));
  color: #e67e00;
  border-color: rgba(255, 149, 0, 0.25);
}

.light-theme .post-badge.new-post,
body:not(.dark-theme) .post-badge.new-post {
  background: linear-gradient(135deg, rgba(0, 180, 140, 0.1), rgba(0, 160, 120, 0.1));
  color: #00a88a;
  border-color: rgba(0, 180, 140, 0.25);
}

/* Mobile responsiveness for labels */
@media (max-width: 480px) {
  .post-badge.trending,
  .post-badge.new-post {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ============================================================
   TASK 3: Community Search Box
   ============================================================ */
.community-search-box {
  position: relative;
  margin: 16px 0;
  padding: 0 8px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.community-search-input {
  width: 100%;
  padding: 12px 40px 12px 44px;
  border: 1px solid var(--community-border);
  border-radius: 24px;
  background: var(--community-card);
  color: var(--community-text);
  font-size: 14px;
  transition: all var(--community-transition);
  min-height: 44px;
}

.community-search-input:focus {
  outline: none;
  border-color: var(--community-accent);
  box-shadow: 0 0 0 3px var(--community-accent-light);
}

.community-search-input::placeholder {
  color: var(--community-text-muted);
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--community-text-muted);
  font-size: 14px;
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--community-text-muted);
  cursor: pointer;
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--community-transition);
}

.search-clear-btn:hover {
  color: var(--community-accent);
  background: var(--community-accent-light);
}

.community-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 8px;
  right: 8px;
  background: var(--community-card);
  border: 1px solid var(--community-border);
  border-radius: var(--community-radius);
  box-shadow: var(--community-shadow);
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--community-border-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--community-text-muted);
}

.search-close-btn {
  background: none;
  border: none;
  color: var(--community-text-muted);
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -8px;
  border-radius: 50%;
  transition: all var(--community-transition);
}

.search-close-btn:hover {
  color: var(--community-accent);
  background: var(--community-accent-light);
}

.search-results-list {
  padding: 8px 0;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  transition: background var(--community-transition);
  min-height: 44px;
}

.search-result-item:hover {
  background: var(--community-accent-light);
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--community-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--community-text-muted);
}

.search-result-meta .username {
  color: var(--community-accent);
}

.search-no-results {
  padding: 32px 16px;
  text-align: center;
  color: var(--community-text-muted);
}

.search-no-results i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.5;
}

.search-loading {
  padding: 24px;
  display: flex;
  justify-content: center;
}

.spinner-ring.small {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

/* Light theme search */
.light-theme .community-search-input,
body:not(.dark-theme) .community-search-input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1a1a2e;
}

.light-theme .community-search-input:focus,
body:not(.dark-theme) .community-search-input:focus {
  border-color: #dc143c;
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.light-theme .community-search-results,
body:not(.dark-theme) .community-search-results {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   TASK 4: Mobile Touch Target Polish (44px minimum)
   ============================================================ */

/* Navigation items */
.community-sidebar-nav li a {
  min-height: 44px;
  padding: 10px 16px;
}

/* Sidebar compose button */
.sidebar-compose-btn {
  min-height: 48px;
}

/* Topic list items */
.sidebar-topic-list li a {
  min-height: 44px;
  padding: 10px 12px;
}

/* Action buttons in posts */
.post-action-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
}

/* Reaction buttons */
.reaction-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
}

/* Sort buttons */
.sort-btn {
  min-height: 44px;
  padding: 10px 16px;
}

/* Tab links */
.community-feed-tab {
  min-height: 44px;
  padding: 12px 16px;
}

/* Category link in sidebar */
.community-sidebar-cat-link {
  min-height: 44px;
  padding: 10px 16px;
}

/* Mobile-specific touch target fixes */
@media (max-width: 768px) {
  /* Make all interactive elements at least 44px */
  .community-post-card .post-header-actions button,
  .community-post-card .post-header-actions a {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Post menu button */
  .post-menu-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Hashtag links */
  .community-hashtag {
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* User mentions */
  .community-mention {
    padding: 6px 8px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
  
  /* Follow button */
  .community-follow-btn {
    min-height: 44px;
    padding: 12px 20px;
  }
  
  /* Compose inline button/area */
  .compose-inline-trigger {
    min-height: 48px;
    padding: 14px 16px;
  }
  
  /* Reaction picker buttons */
  .reaction-picker-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    font-size: 20px;
  }
  
  /* Dropdown menu items */
  .post-dropdown-item {
    min-height: 44px;
    padding: 12px 16px;
  }
  
  /* Modal close buttons */
  .compose-modal-close,
  .report-modal-close {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Toolbar buttons */
  .compose-toolbar-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Format buttons */
  .format-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Topic pills */
  .topic-pill {
    min-height: 44px;
    padding: 10px 14px;
  }
  
  /* Media attachment buttons */
  .media-remove-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Comment action buttons */
  .comment-action-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  
  /* Breadcrumb links */
  .community-breadcrumb a {
    min-height: 44px;
    padding: 10px 8px;
    display: inline-flex;
    align-items: center;
  }
  
  /* Mobile FAB */
  .community-mobile-fab {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }
  
  /* Mobile nav items */
  .community-mobile-nav a {
    min-height: 48px;
    padding: 8px 0;
  }
  
  /* Right panel items */
  .trending-item,
  .suggested-user-item {
    min-height: 44px;
    padding: 10px 12px;
  }
  
  /* Sidebar user profile link */
  .sidebar-user-link {
    min-height: 48px;
    padding: 10px;
  }
  
  /* Guest CTA button */
  .sidebar-signin-btn {
    min-height: 44px;
    padding: 12px 20px;
  }
  
  /* Report reason buttons */
  .report-reason-btn {
    min-height: 44px;
    padding: 12px 16px;
  }
  
  /* Visibility button */
  .compose-visibility-btn {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* Ensure focus states are visible for accessibility */
.community-page button:focus-visible,
.community-page a:focus-visible,
.community-page input:focus-visible {
  outline: 2px solid var(--community-accent);
  outline-offset: 2px;
}
