/**
 * MarkTreeDoc Pure CSS Code Syntax Highlighting (Zero JavaScript)
 */

.mtd-code-block {
  margin: 22px 0;
  border-radius: var(--mtd-radius-md);
  background: #0f172a;
  color: #f8fafc;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  border: 1px solid #1e293b;
  font-family: var(--mtd-code-font);
}

.mtd-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  user-select: none;
}

.mtd-code-dots {
  display: flex;
  gap: 7px;
}

.mtd-code-dots i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.mtd-code-dots i:nth-child(1) { background: #ef4444; }
.mtd-code-dots i:nth-child(2) { background: #f59e0b; }
.mtd-code-dots i:nth-child(3) { background: #10b981; }

.mtd-code-lang {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #94a3b8;
}

.mtd-code-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mtd-code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.2;
}

.mtd-code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.mtd-code-copy-btn.is-copied {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #34d399;
}

.mtd-code-pre {
  margin: 0;
  padding: 16px 0;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  counter-reset: mtdline;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.mtd-code-pre::-webkit-scrollbar {
  height: 6px;
}

.mtd-code-pre::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}

.mtd-code-pre code {
  display: block;
  font-family: inherit;
}

/* Line Numbers via Pure CSS Counter */
.mtd-code-line {
  display: block;
  padding: 0 20px 0 60px;
  position: relative;
  white-space: pre;
}

.mtd-code-line::before {
  counter-increment: mtdline;
  content: counter(mtdline);
  position: absolute;
  left: 0;
  width: 44px;
  text-align: right;
  color: #475569;
  user-select: none;
  font-size: 12px;
  border-right: 1px solid #334155;
  padding-right: 12px;
}

.mtd-code-line:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Syntax Token Colors (Dracula / OneDark Inspired) */
.tok-kw {
  color: #f43f5e; /* Red-Pink Keywords */
  font-weight: 600;
}

.tok-str {
  color: #34d399; /* Green Strings */
}

.tok-com {
  color: #64748b; /* Slate Comments */
  font-style: italic;
}

.tok-num {
  color: #fb923c; /* Orange Numbers */
}

.tok-fn {
  color: #60a5fa; /* Blue Functions */
}

.tok-var {
  color: #e2e8f0; /* Soft White Variables */
}

.tok-op {
  color: #38bdf8; /* Cyan Operators */
}

.tok-punc {
  color: #94a3b8; /* Slate Punctuation */
}

.tok-tag {
  color: #f43f5e; /* HTML Tag */
}

.tok-attr {
  color: #a78bfa; /* Attributes */
}
