* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8fafc; color: #1e293b; }

/* Header */
.forum-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; background: #1e293b; color: #fff;
    position: sticky; top: 0; z-index: 100;
}
.forum-logo { color: #93c5fd; text-decoration: none; font-weight: 700; font-size: 0.9rem; }
.forum-title { flex: 1; font-weight: 700; font-size: 1.1rem; }
.forum-auth { font-size: 0.85rem; }
.forum-auth a { color: #93c5fd; text-decoration: none; }

/* Tag bar */
.forum-tags {
    padding: 0.5rem 1rem; background: #fff; border-bottom: 1px solid #e2e8f0;
    display: flex; gap: 0.5rem; flex-wrap: wrap; overflow-x: auto;
}
.forum-tag-pill {
    padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
    border: 1px solid #d1d5db; background: #fff; color: #475569; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.forum-tag-pill:hover { border-color: #2e86c1; color: #2e86c1; }
.forum-tag-pill.active { background: #2e86c1; color: #fff; border-color: #2e86c1; }

/* Main */
.forum-main { max-width: 700px; margin: 0 auto; padding: 1rem; }

/* Post card */
.forum-post-card {
    background: #fff; border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer; transition: box-shadow 0.15s;
}
.forum-post-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.forum-post-card-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.25rem; color: #1e293b; }
.forum-post-card-meta { font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.5rem; }
.forum-post-card-preview { font-size: 0.9rem; color: #475569; line-height: 1.4; margin-bottom: 0.5rem; }
.forum-post-card-footer { display: flex; gap: 1rem; font-size: 0.8rem; color: #94a3b8; }
.forum-post-card-tag {
    display: inline-block; padding: 0.1rem 0.5rem; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; background: #eff6ff; color: #2563eb;
    margin-left: 0.5rem;
}
.forum-post-card-locked { color: #f59e0b; }

/* Post detail */
.forum-post-detail { background: #fff; border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.forum-post-detail-title { font-weight: 700; font-size: 1.3rem; margin-bottom: 0.25rem; }
.forum-post-detail-meta { font-size: 0.85rem; color: #94a3b8; margin-bottom: 1rem; }
.forum-post-detail-body { line-height: 1.7; font-size: 0.95rem; }
.forum-post-detail-body p { margin-bottom: 0.75rem; }
.forum-post-detail-body a { color: #2e86c1; }
.forum-post-detail-body code { background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; }
.forum-post-detail-body pre { background: #f1f5f9; padding: 0.75rem; border-radius: 6px; overflow-x: auto; margin-bottom: 0.75rem; }
.forum-post-detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9; }

/* Comment */
.forum-comment {
    background: #fff; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.forum-comment.deleted { opacity: 0.5; }
.forum-comment-meta { font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.4rem; }
.forum-comment-body { font-size: 0.9rem; line-height: 1.6; }
.forum-comment-body p { margin-bottom: 0.5rem; }
.forum-comment-body a { color: #2e86c1; }
.forum-comment-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* Buttons */
.forum-btn {
    padding: 0.4rem 0.85rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 0.3rem;
}
.forum-btn-primary { background: #2e86c1; color: #fff; }
.forum-btn-primary:hover { background: #2471a3; }
.forum-btn-secondary { background: #f1f5f9; color: #475569; }
.forum-btn-secondary:hover { background: #e2e8f0; }
.forum-btn-danger { background: #fef2f2; color: #dc2626; }
.forum-btn-danger:hover { background: #fee2e2; }
.forum-btn-vote { background: none; border: 1px solid #d1d5db; color: #64748b; padding: 0.3rem 0.6rem; }
.forum-btn-vote:hover { border-color: #2e86c1; color: #2e86c1; }
.forum-btn-vote.voted { border-color: #2e86c1; color: #2e86c1; background: #eff6ff; }
.forum-btn:disabled { opacity: 0.5; cursor: default; }

/* FAB */
.forum-fab {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 50;
    padding: 0.75rem 1.25rem; border-radius: 999px; border: none;
    background: #2e86c1; color: #fff; font-weight: 700; font-size: 0.9rem;
    cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: transform 0.15s;
}
.forum-fab:hover { transform: scale(1.05); }

/* Create form */
.forum-create-form { background: #fff; border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.forum-create-form h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }
.forum-input {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; margin-bottom: 0.75rem; box-sizing: border-box;
}
.forum-input:focus { outline: none; border-color: #2e86c1; }
.forum-textarea {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; resize: vertical; min-height: 120px; margin-bottom: 0.75rem; box-sizing: border-box;
}
.forum-textarea:focus { outline: none; border-color: #2e86c1; }
.forum-select {
    padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.85rem; font-family: inherit; background: #fff; margin-bottom: 0.75rem;
}
.forum-char-count { font-size: 0.75rem; color: #94a3b8; text-align: right; margin-top: -0.5rem; margin-bottom: 0.5rem; }
.forum-form-actions { display: flex; gap: 0.5rem; }

/* Comment form */
.forum-comment-form { background: #fff; border-radius: 8px; padding: 0.75rem 1rem; margin-top: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.forum-comment-form textarea {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; resize: vertical; min-height: 60px; margin-bottom: 0.5rem; box-sizing: border-box;
}

/* Modal */
.forum-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.forum-modal {
    background: #fff; border-radius: 12px; padding: 1.5rem; max-width: 420px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.forum-modal h3 { margin-bottom: 0.75rem; }

/* Toast */
#toastContainer { position: fixed; top: 4rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.forum-toast {
    padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15); opacity: 0; transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
}
.forum-toast-show { opacity: 1; transform: translateX(0); }
.forum-toast-info { background: #eff6ff; color: #1e40af; }
.forum-toast-error { background: #fef2f2; color: #991b1b; }
.forum-toast-success { background: #f0fdf4; color: #166534; }

/* Back link */
.forum-back { font-size: 0.85rem; color: #2e86c1; text-decoration: none; display: inline-block; margin-bottom: 0.75rem; }

/* Scroll sentinel */
.forum-sentinel { height: 1px; }

/* Empty state */
.forum-empty { text-align: center; color: #94a3b8; padding: 3rem 1rem; font-size: 0.95rem; }

/* Admin section */
.forum-admin-section { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #fef3c7; }
.forum-admin-label { font-size: 0.75rem; font-weight: 700; color: #d97706; margin-bottom: 0.4rem; }
