/* =====================================================
   UDDS OX API Documentation - Syntax Highlighting
   Custom theme for code blocks
   ===================================================== */

/* === Base code styling === */
pre[class*="language-"],
code[class*="language-"] {
  color: #e6edf3;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.6;
  tab-size: 4;
  hyphens: none;
}

pre[class*="language-"] {
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  overflow: auto;
  background: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

/* === Inline code === */
:not(pre) > code[class*="language-"] {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}

/* === Tokens === */

/* Comments */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #8b949e;
  font-style: italic;
}

/* Punctuation */
.token.punctuation {
  color: #8b949e;
}

/* Namespace */
.token.namespace {
  opacity: 0.7;
}

/* Properties, Tags, Symbols, Constants */
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
  color: #ff7b72;
}

/* Booleans, Numbers */
.token.boolean,
.token.number {
  color: #79c0ff;
}

/* Selectors, Strings, Characters, Attributes, Inserted */
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #a5d6ff;
}

/* Operators, Entities, URLs, CSS strings */
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #79c0ff;
}

/* At-rules, Keywords */
.token.atrule,
.token.attr-value,
.token.keyword {
  color: #ff7b72;
}

/* Functions, Classes */
.token.function,
.token.class-name {
  color: #d2a8ff;
}

/* Regex, Important */
.token.regex,
.token.important {
  color: #ffa657;
}

/* Variables */
.token.variable {
  color: #ffa657;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

/* === PHP specific === */
.language-php .token.variable {
  color: #ffa657;
}

.language-php .token.keyword {
  color: #ff7b72;
}

.language-php .token.function {
  color: #d2a8ff;
}

.language-php .token.string {
  color: #a5d6ff;
}

.language-php .token.comment {
  color: #8b949e;
}

/* === JSON specific === */
.language-json .token.property {
  color: #7ee787;
}

.language-json .token.string {
  color: #a5d6ff;
}

.language-json .token.number {
  color: #79c0ff;
}

.language-json .token.boolean,
.language-json .token.null {
  color: #ff7b72;
}

/* === Bash/Shell specific === */
.language-bash .token.function {
  color: #d2a8ff;
}

.language-bash .token.builtin {
  color: #ff7b72;
}

/* === Line Numbers (optional) === */
pre.line-numbers {
  position: relative;
  padding-left: 3.8em;
  counter-reset: linenumber;
}

pre.line-numbers > code {
  position: relative;
  white-space: inherit;
}

.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 var(--border-color);
  user-select: none;
}

.line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
}

.line-numbers-rows > span:before {
  content: counter(linenumber);
  color: var(--text-muted);
  display: block;
  padding-right: 0.8em;
  text-align: right;
}

/* === Code block labels === */
.code-label {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.code-label + pre {
  border-top-left-radius: 0;
}

/* === Highlighted lines === */
.line-highlight {
  background: rgba(88, 166, 255, 0.1);
  border-left: 3px solid var(--accent-primary);
  margin-left: -var(--spacing-md);
  padding-left: calc(var(--spacing-md) - 3px);
  display: block;
}

/* === Diff highlighting === */
.token.deleted {
  background: rgba(248, 81, 73, 0.15);
  color: #ffa198;
}

.token.inserted {
  background: rgba(63, 185, 80, 0.15);
  color: #7ee787;
}

/* === Selection in code === */
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
  background: rgba(88, 166, 255, 0.3);
}
