/* ============================================================
   community.css — Reddit-style community feed
   ============================================================ */

/* ── Layout ── */
.community-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-6);
    padding: var(--space-8) 0 var(--space-24);
    align-items: start;
}

/* ── Page header ── */
.community-header {
    padding: var(--space-10) 0 var(--space-6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.community-header-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.community-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ── Sort tabs ── */
.sort-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
}

.sort-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sort-tab:hover { color: var(--text); background: var(--surface-2); }
.sort-tab.active { background: var(--surface-3); color: var(--text); }

/* ── Channel filter bar ── */
.channel-bar {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.channel-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.channel-pill:hover { border-color: var(--border-hover); color: var(--text); }
.channel-pill.active { border-color: var(--accent-orange); color: var(--accent-orange); background: rgba(255,92,53,0.08); }

/* ── Post card ── */
.post-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.post-card {
    display: flex;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.post-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Vote column */
.post-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-4) var(--space-3);
    background: var(--surface-2);
    min-width: 52px;
    border-right: 1px solid var(--border);
}

.vote-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
    line-height: 1;
}

.vote-btn:hover { background: var(--surface-3); color: var(--text); }
.vote-btn.up.active   { color: var(--accent-orange); }
.vote-btn.down.active { color: var(--accent-purple); }

.vote-score {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    min-width: 24px;
    text-align: center;
}

.vote-score.positive { color: var(--accent-orange); }
.vote-score.negative { color: var(--accent-purple); }

/* Post body */
.post-body {
    flex: 1;
    padding: var(--space-4) var(--space-5);
    min-width: 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-faint);
}

.post-channel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: var(--text-xs);
    color: var(--accent-orange);
    text-decoration: none;
}

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

.post-author { color: var(--text-muted); }
.post-author a { color: var(--text-muted); }
.post-author a:hover { color: var(--text); }
.post-time { color: var(--text-faint); }

.post-title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: var(--space-2);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

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

.post-type-flair {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-right: 6px;
    vertical-align: middle;
}

.flair-prompt     { background: rgba(255,92,53,0.12);  color: var(--accent-orange); }
.flair-discussion { background: rgba(0,212,255,0.12);  color: var(--accent-cyan); }
.flair-question   { background: rgba(0,229,122,0.12);  color: var(--accent-green); }
.flair-showcase   { background: rgba(168,85,247,0.12); color: var(--accent-purple); }

.post-excerpt {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.post-prompt-preview {
    background: var(--surface-2);
    border-left: 3px solid var(--accent-orange);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: monospace;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.post-footer {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.post-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-xs);
    color: var(--text-faint);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 5px;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.post-action:hover { background: var(--surface-2); color: var(--text-muted); }

/* ── Submit bar ── */
.submit-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.submit-bar:hover { border-color: var(--border-hover); }

.submit-bar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.submit-bar-input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-family: var(--font-body);
    cursor: pointer;
}

/* ── Sidebar ── */
.community-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 16px);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.sidebar-card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--text);
}

.sidebar-card-body {
    padding: var(--space-4) var(--space-5);
}

.sidebar-channel-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-channel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.sidebar-channel-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-channel-item.active { background: var(--surface-2); color: var(--text); font-weight: 600; border-left: 2px solid var(--accent-orange); padding-left: 8px; }

.sidebar-channel-name { display: flex; align-items: center; gap: 7px; }
.sidebar-channel-count { font-size: var(--text-xs); color: var(--text-faint); }

.top-poster {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.top-poster:last-child { border-bottom: none; padding-bottom: 0; }
.top-poster:first-child { padding-top: 0; }

.top-poster-rank {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-faint);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.top-poster-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.top-poster-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.top-poster-karma {
    font-size: var(--text-xs);
    color: var(--accent-orange);
    font-weight: 600;
}

/* ── Single post page ── */
.post-full {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.post-full-vote {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-5) 0;
}

.post-full-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
}

.post-full-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: var(--space-3);
}

.post-full-body {
    padding: 0 var(--space-5) var(--space-5);
    color: var(--text-muted);
    font-size: var(--text-base);
    line-height: 1.8;
}

.post-full-body p { margin-bottom: var(--space-4); }

.post-prompt-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-orange);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: var(--space-5) var(--space-6);
    margin: var(--space-5) var(--space-5);
    font-family: monospace;
    font-size: var(--text-sm);
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
}

.prompt-copy-btn {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.prompt-copy-btn:hover { background: var(--surface); color: var(--text); }
.prompt-copy-btn.copied { color: var(--accent-green); border-color: var(--accent-green); }

/* ── Comments ── */
.comments-section { }

.comments-header {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.comment-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.comment-textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.comment-textarea:focus { border-color: rgba(255,92,53,0.5); }

.comment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.comment {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

.comment-thread-line {
    width: 2px;
    background: var(--border);
    border-radius: 1px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background var(--transition-fast);
    margin: 4px 0;
}

.comment-thread-line:hover { background: var(--accent-orange); }

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

.comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
}

.comment-author {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.comment-author:hover { color: var(--accent-orange); }

.comment-author.op {
    background: rgba(255,92,53,0.1);
    color: var(--accent-orange);
    padding: 1px 6px;
    border-radius: 4px;
}

.comment-time { color: var(--text-faint); }

.comment-score {
    font-weight: 600;
    color: var(--text-muted);
}

.comment-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-2);
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.comment-vote-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-vote-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.comment-vote-btn:hover { color: var(--text); background: var(--surface-2); }
.comment-vote-btn.up.active   { color: var(--accent-orange); }
.comment-vote-btn.down.active { color: var(--accent-purple); }

.comment-score-display {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
    text-align: center;
}

.reply-link {
    font-size: var(--text-xs);
    color: var(--text-faint);
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.reply-link:hover { background: var(--surface-2); color: var(--text-muted); }

.comment-replies {
    margin-top: var(--space-3);
    padding-left: var(--space-5);
    border-left: 2px solid var(--border);
}

/* ── Submit post page ── */
.submit-post-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-8) 0 var(--space-24);
}

.submit-type-tabs {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.submit-type-tab {
    flex: 1;
    padding: var(--space-4);
    text-align: center;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.submit-type-tab:last-child { border-right: none; }
.submit-type-tab:hover { background: var(--surface-2); color: var(--text); }
.submit-type-tab.active { background: var(--surface-2); color: var(--text); border-bottom: 2px solid var(--accent-orange); }

.submit-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-state h3 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-3); color: var(--text); }
.empty-state p { max-width: 360px; margin: 0 auto var(--space-6); line-height: 1.6; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .community-layout { grid-template-columns: 1fr; }
    .community-sidebar { position: static; }
}

@media (max-width: 600px) {
    .post-card { flex-direction: column; }
    .post-vote { flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-4); min-width: auto; }
    .sort-tabs { overflow-x: auto; }
    .submit-form-card { padding: var(--space-5); }
}
