:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-color-focus: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.discuss-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Filters - Horizontal & Sleek */
.filters-container {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filter-btn {
    position: relative;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* Composer Area */
.composer-wrapper {
    margin-bottom: 40px;
}

/* Collapsed State - The "Fake Input" */
.composer-trigger {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: text;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.composer-trigger:hover {
    border-color: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

.user-avatar-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-body);
    box-shadow: 0 0 0 2px var(--border-color);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 0 2px var(--border-color);
}

.trigger-text {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 500;
    flex: 1;
}

.trigger-icons {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Expanded State - The Editor */
.composer-editor {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-glow);
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.editor-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.editor-title-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    font-weight: 700;
    padding: 8px 0;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}
.editor-title-input:focus {
    border-bottom-color: var(--border-color-focus);
}
.editor-title-input::placeholder { color: #64748b; }

/* Markdown Editor Container */
.markdown-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.markdown-container:focus-within {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.5);
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.editor-textarea {
    width: 100%;
    min-height: 250px;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 20px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}
.editor-textarea::placeholder { color: #475569; }

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s;
}
.btn-ghost:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }

.btn-primary-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 32px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-primary-action:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}
.btn-primary-action:disabled { opacity: 0.7; cursor: wait; transform: none; }

/* Post List */
.list-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.list-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}
.list-count {
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Post Card Refinements */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s ease;
}
.post-card:hover {
    border-color: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

/* Load More */
.load-more-btn {
    display: block;
    margin: 48px auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 14px 40px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.load-more-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    background: var(--bg-card-hover);
}

@media (max-width: 640px) {
    .page-header { flex-direction: column; align-items: flex-start; gap: 20px; }
    .filters-container { width: 100%; display: flex; overflow-x: auto; padding: 4px; }
    .filter-btn { flex: 1; text-align: center; white-space: nowrap; }
}

/* =========================================
   Comment System Styles
   ========================================= */

.comments-container {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.comment {
    margin-bottom: 20px;
    position: relative;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
}

.comment-date {
    font-size: 12px;
    color: var(--text-muted);
}

.comment-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    background: none;
    border: none;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
}

.btn-edit:hover { color: var(--primary); }
.btn-delete:hover { color: #ef4444; }

.comment-content {
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
    padding-left: 40px; /* Align with text start (28px avatar + 12px gap) */
}

/* Markdown Content Styling within Comments */
.comment-content p { margin-bottom: 8px; }
.comment-content p:last-child { margin-bottom: 0; }
.comment-content code { 
    background: rgba(0,0,0,0.3); 
    padding: 2px 4px; 
    border-radius: 4px; 
    font-family: monospace;
    font-size: 0.9em;
}
.comment-content pre {
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.comment-footer {
    padding-left: 40px;
}

.btn-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.btn-reply:hover {
    color: var(--text-main);
}

.btn-reply::before {
    content: "↩";
    display: inline-block;
}

/* Reddit-style Nested Comments */
.replies-section {
    margin-top: 12px;
    /* Position the line to the left of the content */
    margin-left: -26px; /* (28px/2 = 14px center of avatar). Footer pad is 40px. 40-26 = 14px. Perfect alignment with avatar center. */
    padding-left: 26px; /* Push content back to align */
    border-left: 2px solid var(--border-color);
    position: relative;
}

.replies-section:hover {
    border-left-color: var(--border-color-focus);
}

/* Reply Form */
.reply-form-container {
    margin-top: 12px;
    margin-bottom: 20px;
}

.reply-editor {
    min-height: 100px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
}
