/* Purple-Enhanced Code Block Styling for Haive Documentation */

/* Force remove any white backgrounds from code blocks */
div.highlight, 
div.highlight-default,
div.highlight-python,
div.highlight-bash,
div.highlight-yaml,
div.highlight-json,
div.highlight-rst,
.highlight,
.highlighttable,
.code-block-wrapper,
pre {
  background: #1e1e2e !important;  /* Dark purple-tinted background */
  background-color: #1e1e2e !important;
  border: 1px solid #4c4c6d !important;
  border-radius: 0.5rem !important;
  margin: 1rem 0 !important;
  overflow: hidden !important;
  position: relative !important;  /* For language labels positioning */
}

.highlight pre {
  background: transparent !important;
  color: #e9ecef !important;
  padding: 1rem !important;
  margin: 0 !important;
  overflow-x: auto !important;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", "Monaco", "Courier New", monospace !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
}

/* Syntax highlighting colors with purple accent */
.highlight .c { color: #9184e0 !important; font-style: italic !important; } /* Comment */
.highlight .err { color: #f85149 !important; background-color: transparent !important; } /* Error */
.highlight .k { color: #c792ea !important; font-weight: bold !important; } /* Keyword */
.highlight .l { color: #ae81ff !important; } /* Literal */
.highlight .n { color: #e9ecef !important; } /* Name */
.highlight .o { color: #89ddff !important; } /* Operator */
.highlight .p { color: #e9ecef !important; } /* Punctuation */
.highlight .ch { color: #9184e0 !important; font-style: italic !important; } /* Comment.Hashbang */
.highlight .cm { color: #9184e0 !important; font-style: italic !important; } /* Comment.Multiline */
.highlight .cp { color: #9184e0 !important; font-style: italic !important; } /* Comment.Preproc */
.highlight .cpf { color: #9184e0 !important; font-style: italic !important; } /* Comment.PreprocFile */
.highlight .c1 { color: #9184e0 !important; font-style: italic !important; } /* Comment.Single */
.highlight .cs { color: #9184e0 !important; font-style: italic !important; } /* Comment.Special */
.highlight .gd { color: #f85149 !important; } /* Generic.Deleted */
.highlight .ge { font-style: italic !important; } /* Generic.Emph */
.highlight .gi { color: #56d364 !important; } /* Generic.Inserted */
.highlight .gs { font-weight: bold !important; } /* Generic.Strong */
.highlight .gu { color: #89ddff !important; } /* Generic.Subheading */
.highlight .kc { color: #c792ea !important; font-weight: bold !important; } /* Keyword.Constant */
.highlight .kd { color: #c792ea !important; font-weight: bold !important; } /* Keyword.Declaration */
.highlight .kn { color: #89ddff !important; font-weight: bold !important; } /* Keyword.Namespace */
.highlight .kp { color: #c792ea !important; font-weight: bold !important; } /* Keyword.Pseudo */
.highlight .kr { color: #c792ea !important; font-weight: bold !important; } /* Keyword.Reserved */
.highlight .kt { color: #ffcb6b !important; } /* Keyword.Type */
.highlight .ld { color: #c3e88d !important; } /* Literal.Date */
.highlight .m { color: #ae81ff !important; } /* Literal.Number */
.highlight .s { color: #c3e88d !important; } /* Literal.String */
.highlight .na { color: #82aaff !important; } /* Name.Attribute */
.highlight .nb { color: #e9ecef !important; } /* Name.Builtin */
.highlight .nc { color: #ffcb6b !important; font-weight: bold !important; } /* Name.Class */
.highlight .no { color: #ae81ff !important; } /* Name.Constant */
.highlight .nd { color: #82aaff !important; font-weight: bold !important; } /* Name.Decorator */
.highlight .ni { color: #e9ecef !important; } /* Name.Entity */
.highlight .ne { color: #f85149 !important; font-weight: bold !important; } /* Name.Exception */
.highlight .nf { color: #82aaff !important; font-weight: bold !important; } /* Name.Function */
.highlight .nl { color: #e9ecef !important; } /* Name.Label */
.highlight .nn { color: #ffcb6b !important; } /* Name.Namespace */
.highlight .nx { color: #82aaff !important; } /* Name.Other */
.highlight .py { color: #e9ecef !important; } /* Name.Property */
.highlight .nt { color: #89ddff !important; } /* Name.Tag */
.highlight .nv { color: #e9ecef !important; } /* Name.Variable */
.highlight .ow { color: #89ddff !important; font-weight: bold !important; } /* Operator.Word */
.highlight .w { color: #e9ecef !important; } /* Text.Whitespace */
.highlight .mb { color: #ae81ff !important; } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff !important; } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff !important; } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff !important; } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff !important; } /* Literal.Number.Oct */
.highlight .sa { color: #c3e88d !important; } /* Literal.String.Affix */
.highlight .sb { color: #c3e88d !important; } /* Literal.String.Backtick */
.highlight .sc { color: #c3e88d !important; } /* Literal.String.Char */
.highlight .dl { color: #c3e88d !important; } /* Literal.String.Delimiter */
.highlight .sd { color: #9184e0 !important; font-style: italic !important; } /* Literal.String.Doc */
.highlight .s2 { color: #c3e88d !important; } /* Literal.String.Double */
.highlight .se { color: #ae81ff !important; } /* Literal.String.Escape */
.highlight .sh { color: #c3e88d !important; } /* Literal.String.Heredoc */
.highlight .si { color: #ae81ff !important; } /* Literal.String.Interpol */
.highlight .sx { color: #c3e88d !important; } /* Literal.String.Other */
.highlight .sr { color: #89ddff !important; } /* Literal.String.Regex */
.highlight .s1 { color: #c3e88d !important; } /* Literal.String.Single */
.highlight .ss { color: #ae81ff !important; } /* Literal.String.Symbol */
.highlight .bp { color: #e9ecef !important; } /* Name.Builtin.Pseudo */
.highlight .fm { color: #82aaff !important; font-weight: bold !important; } /* Name.Function.Magic */
.highlight .vc { color: #e9ecef !important; } /* Name.Variable.Class */
.highlight .vg { color: #e9ecef !important; } /* Name.Variable.Global */
.highlight .vi { color: #e9ecef !important; } /* Name.Variable.Instance */
.highlight .vm { color: #e9ecef !important; } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff !important; } /* Literal.Number.Integer.Long */

/* Line numbers styling */
.highlight .linenos {
  color: #6c6c8a !important;
  padding-right: 1rem !important;
  user-select: none !important;
  border-right: 1px solid #4c4c6d !important;
}

/* Inline code styling with purple tint */
code:not(.highlight code) {
  background: #f3e8ff !important;
  color: #7c3aed !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 0.25rem !important;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", "Monaco", "Courier New", monospace !important;
  font-size: 0.875em !important;
  font-weight: 500 !important;
}

/* Dark mode inline code */
@media (prefers-color-scheme: dark) {
  code:not(.highlight code) {
    background: #312e81 !important;
    color: #c084fc !important;
  }
}

/* Copy button enhancement for code blocks */
.copybtn {
  background: #8b5cf6 !important;
  color: white !important;
  border: none !important;
  border-radius: 0.375rem !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  transition: all 0.2s ease !important;
  opacity: 0 !important;
}

.highlight:hover .copybtn {
  opacity: 1 !important;
}

.copybtn:hover {
  background: #7c3aed !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3) !important;
}

.copybtn.success {
  background: #10b981 !important;
}

/* Language label for code blocks */
.highlight::before {
  content: attr(data-language);
  position: absolute;
  top: 0;
  right: 0;
  background: #8b5cf6;
  color: white;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom-left-radius: 0.375rem;
}

/* Python-specific language label */
.highlight.language-python::before { content: "PYTHON"; }
.highlight.language-javascript::before { content: "JS"; }
.highlight.language-typescript::before { content: "TS"; }
.highlight.language-bash::before { content: "BASH"; }
.highlight.language-yaml::before { content: "YAML"; }
.highlight.language-json::before { content: "JSON"; }
.highlight.language-rst::before { content: "RST"; }
.highlight.language-markdown::before { content: "MD"; }

/* Console/terminal styling */
.highlight.language-console,
.highlight.language-bash {
  background: #0f0f23 !important;
  border-color: #4c1d95 !important;
}

.highlight.language-console pre,
.highlight.language-bash pre {
  color: #a5f3fc !important;
}

/* Prompt styling */
.highlight .gp { 
  color: #c084fc !important; 
  font-weight: bold !important;
  user-select: none !important;
}

/* API signature blocks with purple accent */
.sig {
  background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%) !important;
  border: 1px solid #4c4c6d !important;
  border-left: 3px solid #8b5cf6 !important;
  color: #e9ecef !important;
}

.sig-name {
  color: #c084fc !important;
  font-weight: 700 !important;
}

.sig-param {
  color: #82aaff !important;
}

.sig-return {
  color: #c3e88d !important;
}

/* Light mode adjustments */
@media not (prefers-color-scheme: dark) {
  div.highlight,
  div.highlight-default,
  div.highlight-python,
  div.highlight-bash,
  div.highlight-yaml,
  div.highlight-json,
  div.highlight-rst,
  .highlight,
  .highlighttable,
  .code-block-wrapper,
  pre {
    background: #2d2d3f !important;  /* Dark purple even in light mode for better contrast */
    background-color: #2d2d3f !important;
    border-color: #6b46c1 !important;
  }
  
  .highlight pre {
    color: #e9ecef !important;  /* Light text on dark background */
    background: transparent !important;
  }
  
  /* Keep same syntax colors as dark mode since we're using dark backgrounds */
  .highlight .c { color: #9184e0 !important; }
  .highlight .k { color: #c792ea !important; }
  .highlight .s { color: #c3e88d !important; }
  .highlight .n { color: #e9ecef !important; }
  .highlight .nf { color: #82aaff !important; }
  .highlight .nc { color: #ffcb6b !important; }
  
  .sig {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%) !important;
    border-color: #e9d5ff !important;
    border-left-color: #8b5cf6 !important;
    color: #1f2937 !important;
  }
}