/* Code Block Styles */

/* PrismJS Tomorrow Night Theme */
code[class*="language-"],
pre[class*="language-"] {
  color: #ccc;
  background: none;
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 1em;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

pre[class*="language-"] {
  padding: 1em;
  margin: 0;
  overflow: auto;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
  background: #2d2d2d;
}

:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
}

.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #999;
}

.token.punctuation {
  color: #ccc;
}

.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
  color: #e2777a;
}

.token.function-name {
  color: #6196cc;
}

.token.boolean,
.token.number,
.token.function {
  color: #f08d49;
}

.token.property,
.token.class-name,
.token.constant,
.token.symbol {
  color: #f8c555;
}

.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
  color: #cc99cd;
}

.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
  color: #7ec699;
}

.token.operator,
.token.entity,
.token.url {
  color: #67cdcc;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

.token.inserted {
  color: green;
}

/* Line Numbers Plugin */
pre[class*="language-"].line-numbers {
  position: relative;
  padding-left: 3.8em;
  counter-reset: linenumber;
}

pre[class*="language-"].line-numbers > code {
  position: relative;
  white-space: inherit;
  display: block;
}

.line-numbers .line-numbers-rows {
  position: absolute;
  pointer-events: none;
  top: 0;
  font-size: 100%;
  left: -3.8em;
  width: 3em;
  letter-spacing: -1px;
  border-right: 1px solid #444;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
}

.line-numbers-rows > span:before {
  content: counter(linenumber);
  color: #999;
  display: block;
  padding-right: 0.8em;
  text-align: right;
}

/* Custom Code Block Container Styles */
.code-block-container {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #2d2d2d;
}

.code-block-title {
  padding: 0.75rem 1rem;
  background: #1d1f21;
  color: #e1e4e8;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 0.875rem;
  border-bottom: 1px solid #3e3e3e;
}

.code-block-container pre[class*="language-"] {
  margin: 0;
  border-radius: 0;
  background: #2d2d2d;
}

.code-block-container pre[class*="language-"] code {
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Ensure consistent line height for line numbers */
.code-block-container pre.line-numbers {
  padding-left: 3.8em;
  padding-top: 1em;
  padding-bottom: 1em;
}

.code-block-container .line-numbers-rows {
  position: absolute;
  pointer-events: none;
  top: 0;
  font-size: 0.875rem;
  left: 0;
  width: 3em;
  letter-spacing: -1px;
  border-right: 1px solid #444;
  padding-top: 1em;
  padding-bottom: 1em;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  line-height: 1.6;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.code-block-container .line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
  height: 1.6em;
  line-height: 1.6;
}

.code-block-container .line-numbers-rows > span:before {
  content: counter(linenumber);
  color: #999;
  display: block;
  padding-right: 0.8em;
  text-align: right;
  min-width: 2.2em;
}

/* Copy button */
.code-copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.code-copy-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.code-copy-button.copied {
  background: rgba(40, 167, 69, 0.2);
  border-color: rgba(40, 167, 69, 0.4);
}

/* Pre container with position relative for copy button */
.code-block-pre-wrapper {
  position: relative;
}

/* Responsive */
@media (max-width: 768px) {
  .code-block-container {
    margin: 1rem -1rem;
    border-radius: 0;
  }
  
  .code-block-container pre[class*="language-"] code {
    font-size: 0.75rem;
  }
}