.code-container { padding: 40px 24px; margin: 0 auto; max-width: 800px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); } .code-title { font-size: 1.75rem; font-weight: 600; margin-bottom: 0.75rem; color: #1a1a1a; } .code-description { font-size: 1rem; color: #666; margin-bottom: 1.5rem; } .code-block { width: 100%; max-width: 700px; margin: 0 auto 1.5rem; padding: 1.5rem; background-color: #1e1e1e; border-radius: 8px; overflow-x: auto; font-family: 'Fira Code', 'Consolas', 'Monaco', monospace; font-size: 0.95rem; line-height: 1.6; color: #d4d4d4; position: relative; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } /* Syntax Highlighting */ .code-block .keyword { color: #569cd6; } .code-block .function { color: #dcdcaa; } .code-block .string { color: #ce9178; } .code-block .comment { color: #6a9955; } .code-block .variable { color: #9cdcfe; } .code-block .operator { color: #d4d4d4; } /* Copy Button */ .code-block::before { content: "Copy"; position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.25rem 0.5rem; background-color: #2d2d2d; color: #d4d4d4; border-radius: 4px; font-size: 0.8rem; cursor: pointer; opacity: 0; transition: opacity 0.3s ease; } .code-block:hover::before { opacity: 1; } .code-block.copied::before { content: "Copied!"; background-color: #4caf50; color: white; } /* Line Numbers */ .code-block { counter-reset: line; } .code-block .line { position: relative; padding-left: 3.5rem; } .code-block .line::before { counter-increment: line; content: counter(line); position: absolute; left: 0; width: 2.5rem; text-align: right; color: #6a9955; padding-right: 1rem; border-right: 1px solid #3d3d3d; user-select: none; } .code-info { font-size: 0.9rem; color: #666; margin-top: 0.75rem; } /* Responsive Styles */ @media (max-width: 768px) { .code-container { padding: 30px 16px; } .code-title { font-size: 1.5rem; } .code-description { font-size: 0.95rem; } .code-block { padding: 1rem; font-size: 0.9rem; } .code-block .line { padding-left: 3rem; } .code-block .line::before { width: 2rem; } } /* Scrollbar Styling */ .code-block::-webkit-scrollbar { height: 8px; } .code-block::-webkit-scrollbar-track { background: #2d2d2d; border-radius: 4px; } .code-block::-webkit-scrollbar-thumb { background: #4d4d4d; border-radius: 4px; } .code-block::-webkit-scrollbar-thumb:hover { background: #5d5d5d; } /* Selection Styling */ .code-block::selection { background-color: #264f78; color: #d4d4d4; }