/* Code Block Styles */
pre {
  background: linear-gradient(145deg, #161b22 0%, #1c2128 50%, #161b22 100%);
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1em 0;
  position: relative;
}

pre code {
  display: block;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.875em;
  color: #e6edf3;
  line-height: 1.5;
  background: none;
  padding: 0;
}

code {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.9em;
}

:not(pre) > code {
  background: #262c36;
  color: #f0883e;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

/* Copy Button */
.code-block {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #30363d;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  color: #8b949e;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  font-size: 0.75rem;
}

pre:hover .copy-btn,
.code-block:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: #8b949e;
  color: #0d1117;
}

.copy-btn.copied {
  background: #238636;
  color: #fff;
}

/* Language Badge */
.code-lang {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 0.7rem;
  color: #6e7681;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Syntax Highlighting Tokens */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #8b949e;
}

.token.punctuation {
  color: #c9d1d9;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #79c0ff;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #a5d6ff;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #ff7b72;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #ff7b72;
}

.token.function,
.token.class-name {
  color: #d2a8ff;
}

.token.regex,
.token.important,
.token.variable {
  color: #ffa657;
}

/* Line Numbers */
.line-numbers {
  counter-reset: line;
}

.line-numbers .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2em;
  margin-right: 1em;
  text-align: right;
  color: #484f58;
  user-select: none;
}

/* Highlighted Lines */
.highlight-line {
  background: rgba(56, 139, 253, 0.15);
  margin: 0 -1rem;
  padding: 0 1rem;
  display: block;
}

/* Diff Styles */
.diff-add {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
}

.diff-remove {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

/* Interactive Code Block */
.code-interactive {
  border: 1px solid #238636;
}

.code-interactive .code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(35, 134, 54, 0.1);
  border-bottom: 1px solid #30363d;
}

.code-interactive .run-btn {
  background: #238636;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.code-interactive .run-btn:hover {
  background: #2ea043;
}

.code-output {
  padding: 1rem;
  background: #0d1117;
  border-top: 1px solid #30363d;
  font-family: 'SF Mono', monospace;
  font-size: 0.85rem;
  color: #8b949e;
  max-height: 200px;
  overflow-y: auto;
}

.code-output.success { color: #3fb950; }
.code-output.error { color: #f85149; }
