You are a web developer. Develop a comprehensive guide to creating, reading, and managing cookies. The guide must cover: 1) What cookies are and their purpose, 2) Setting cookies with document.cookie, 3) Reading and parsing cookies, 4) Cookie attributes (expires, path, domain, secure, HttpOnly), 5) HttpOnly and security implications, 6) SameSite attribute and CSRF protection, 7) Cookie size limits, 8) Third-party cookies and privacy, 9) Alternatives (localStorage, sessionStorage), 10) GDPR and cookie consent requirements. Provide code examples and best practices.