/* =============================================
   Forum — feed.css
   Post cards, actions, comments, hashtags
   ============================================= */

/* ── Post Card ── */
.post-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur);
  position: relative;
}
.post-card:hover { background: rgba(255,255,255,0.03); }

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

/* ── Post Header ── */
.post-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  overflow: visible;  /* must be visible so the dropdown menu isn't clipped */
  position: relative; /* stacking context for the absolute-positioned context menu */
}

.post-display-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 180px;
}
.post-display-name:hover { text-decoration: underline; }

.post-handle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-time {
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.post-time::before { content: '·'; margin-right: 0.25rem; }

/* Business badge */
.business-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,212,0,0.12);
  color: var(--warning);
  border: 1px solid rgba(255,212,0,0.25);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
}

/* ── Post Content ── */
.post-content {
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

.post-content .hashtag {
  color: var(--accent);
  cursor: pointer;
  font-weight: 400;
}
.post-content .hashtag:hover { text-decoration: underline; }

.post-content .mention {
  color: var(--accent);
  cursor: pointer;
}
.post-content .mention:hover { text-decoration: underline; }

/* ── Post Image ── */
.post-image {
  margin-top: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: 400px;
  width: 100%;
  object-fit: cover;
}

/* ── Post Actions ── */
.post-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.75rem;
  margin-left: -0.5rem;
  justify-content: space-between;
  max-width: 420px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur), background var(--dur);
  border: none;
  background: none;
}

.action-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Reply / Comment — blue */
.action-btn.comment:hover {
  color: var(--accent);
  background: var(--accent-light);
}

/* Like — pink */
.action-btn.like:hover { color: #f91880; background: rgba(249,24,128,0.1); }
.action-btn.like.active { color: #f91880; }
.action-btn.like.active svg { fill: #f91880; stroke: #f91880; }

/* Repost — green */
.action-btn.repost:hover { color: var(--success); background: rgba(0,186,124,0.1); }
.action-btn.repost.active { color: var(--success); }

/* Share — blue */
.action-btn.share:hover { color: var(--accent); background: var(--accent-light); }

/* Bookmark — blue */
.action-btn.bookmark:hover { color: var(--accent); background: var(--accent-light); }
.action-btn.bookmark.active { color: var(--accent); }
.action-btn.bookmark.active svg { fill: var(--accent); }

/* Post context menu (three-dot) */
.post-context-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 100;
  min-width: 160px;
  overflow: hidden;
}

.post-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--dur);
}
.post-menu-item:hover { background: rgba(255,255,255,0.05); }
.post-menu-item.danger { color: var(--danger); }
.post-menu-item.danger:hover { background: rgba(244,67,54,0.1); }

/* Views — read-only stat displayed at far right of actions */
.action-views {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
  user-select: none;
  pointer-events: none;
}

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

.comment-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
.comment-card:hover { background: rgba(255,255,255,0.03); }

.comment-card .comment-main { flex: 1; }

.comment-content {
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-top: 0.2rem;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

/* Comment composer */
.comment-composer {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.comment-input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  border-bottom: 1.5px solid var(--border);
  padding: 0.35rem 0 0.5rem;
  transition: border-color var(--dur);
}
.comment-input-wrap:focus-within { border-color: var(--accent); }

.comment-input-wrap textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}
.comment-input-wrap textarea::placeholder { color: var(--text-muted); }

/* ── Hashtag pill ── */
.hashtag-pill {
  display: inline-flex;
  align-items: center;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  cursor: pointer;
  transition: background var(--dur);
}
.hashtag-pill:hover { background: rgba(29,155,240,0.2); }

/* ── Trending item ── */
.trending-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background var(--dur);
}
.trending-item:hover { background: rgba(255,255,255,0.03); }

.trending-item .tag-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}
.trending-item .tag-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ── Poll Widget ── */
.poll-widget {
  margin: 0.75rem 0 0.25rem;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Votable button */
.poll-option.vote {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur), color var(--dur);
  width: 100%;
}
.poll-option.vote:hover {
  background: var(--accent-light);
}

/* Result bar */
.poll-option.result {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.poll-option.result.chosen {
  border-color: var(--accent);
  color: var(--accent);
}
.poll-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(29,155,240,0.12);
  transition: width 0.4s ease;
  z-index: 0;
  border-radius: var(--radius-full);
}
.poll-option.result.chosen .poll-bar { background: rgba(29,155,240,0.2); }
.poll-label { position: relative; z-index: 1; flex: 1; }
.poll-pct   { position: relative; z-index: 1; font-weight: 700; font-size: 0.85rem; margin-left: auto; }

.poll-footer {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Composer poll section */
.poll-composer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--bg-3);
}
.poll-composer-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.poll-option-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.poll-option-input input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  outline: none;
}
.poll-option-input input:focus { border-color: var(--accent); }

/* ── Who to follow ── */
.follow-suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  transition: background var(--dur);
  cursor: pointer;
}
.follow-suggestion:hover { background: rgba(255,255,255,0.03); }

.follow-suggestion .user-info { flex: 1; overflow: hidden; }
.follow-suggestion .display-name { font-weight: 700; font-size: 0.9375rem; line-height: 1.2; }
.follow-suggestion .handle { font-size: 0.875rem; color: var(--text-muted); }

/* ── Ro-nation pill (on post cards) ── */
.nation-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(29,155,240,0.08);
  color: var(--accent);
  border: 1px solid rgba(29,155,240,0.2);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  transition: background var(--dur);
  white-space: nowrap;
}
.nation-pill:hover { background: rgba(29,155,240,0.16); }

.nation-filter-item.active { background: rgba(29,155,240,0.08); }
.nation-filter-item.active .tag-name { color: var(--accent); }

/* ── Empty state ── */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.empty-state svg  { width: 48px; height: 48px; opacity: 0.3; }
.empty-state h3   { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.empty-state p    { font-size: 0.9375rem; max-width: 280px; }

/* ── Mobile feed adjustments ── */
@media (max-width: 599px) {
  .post-card     { padding: 0.75rem 0.875rem; }
  .comment-card  { padding: 0.75rem 0.875rem; }
  .comment-composer { padding: 0.75rem 0.875rem; }
  .composer      { padding: 0.65rem 0.875rem 0; }

  /* Allow post-actions to spread fully across narrow screens */
  .post-actions  { max-width: 100%; }

  /* Tighten name widths so handle/time still fit */
  .post-display-name { max-width: 120px; font-size: 0.875rem; }
  .post-handle,
  .post-time,
  .post-content  { font-size: 0.875rem; }

  /* Action buttons — slightly smaller tap targets are fine */
  .action-btn    { padding: 0.35rem 0.45rem; font-size: 0.75rem; }
  .action-btn svg { width: 16px; height: 16px; }

  /* Polls */
  .poll-option.vote,
  .poll-option.result { font-size: 0.85rem; padding: 0.45rem 0.85rem; }

  /* Empty state tighter */
  .empty-state { padding: 2rem 1rem; }

  /* Feed tabs — scrollable on small screens */
  .feed-tabs { overflow-x: auto; scrollbar-width: none; }
  .feed-tabs::-webkit-scrollbar { display: none; }
  .feed-tab  { flex-shrink: 0; padding: 0.85rem 1rem; font-size: 0.875rem; }
}

/* ── Post media grid ── */
.media-grid {
  display: grid;
  gap: 2px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
}
.media-grid.count-1 { grid-template-columns: 1fr; }
.media-grid.count-2 { grid-template-columns: 1fr 1fr; }
.media-grid.count-3 { grid-template-columns: 1fr 1fr; }
.media-grid.count-3 .media-item:first-child { grid-row: span 2; }
.media-grid.count-4 { grid-template-columns: 1fr 1fr; }

.media-item {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.media-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}
