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

/* Code blocks with better contrast */
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: #282a36 !important;  /* Dracula background - less harsh */
  background-color: #282a36 !important;
  border: 1px solid #44475a !important;  /* Softer border */
  border-radius: 0.5rem !important;
  margin: 1rem 0 !important;
  overflow: hidden !important;
  position: relative !important;  /* For language labels positioning */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;  /* Subtle shadow */
}

.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 BETTER CONTRAST */
.highlight .c { color: #b8b8ff !important; font-style: italic !important; } /* Comment - Brighter purple */
.highlight .err { color: #ff6b6b !important; background-color: transparent !important; } /* Error - Brighter red */
.highlight .k { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword - Bright pink */
.highlight .l { color: #f1fa8c !important; } /* Literal - Bright yellow */
.highlight .n { color: #ffffff !important; } /* Name - Pure white for readability */
.highlight .o { color: #50fa7b !important; } /* Operator - Bright green */
.highlight .p { color: #ffffff !important; } /* Punctuation - Pure white */
.highlight .ch { color: #b8b8ff !important; font-style: italic !important; } /* Comment.Hashbang */
.highlight .cm { color: #b8b8ff !important; font-style: italic !important; } /* Comment.Multiline */
.highlight .cp { color: #b8b8ff !important; font-style: italic !important; } /* Comment.Preproc */
.highlight .cpf { color: #b8b8ff !important; font-style: italic !important; } /* Comment.PreprocFile */
.highlight .c1 { color: #b8b8ff !important; font-style: italic !important; } /* Comment.Single */
.highlight .cs { color: #b8b8ff !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: #bd93f9 !important; } /* Generic.Subheading - Bright purple */
.highlight .kc { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword.Constant - Pink */
.highlight .kd { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword.Declaration - Pink */
.highlight .kn { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword.Namespace - Pink */
.highlight .kp { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword.Pseudo - Pink */
.highlight .kr { color: #ff79c6 !important; font-weight: bold !important; } /* Keyword.Reserved - Pink */
.highlight .kt { color: #8be9fd !important; } /* Keyword.Type - Cyan */
.highlight .ld { color: #f1fa8c !important; } /* Literal.Date - Yellow */
.highlight .m { color: #bd93f9 !important; } /* Literal.Number - Purple */
.highlight .s { color: #f1fa8c !important; } /* Literal.String - Yellow */
.highlight .na { color: #50fa7b !important; } /* Name.Attribute - Green */
.highlight .nb { color: #8be9fd !important; } /* Name.Builtin - Cyan */
.highlight .nc { color: #50fa7b !important; font-weight: bold !important; } /* Name.Class - Green */
.highlight .no { color: #bd93f9 !important; } /* Name.Constant - Purple */
.highlight .nd { color: #50fa7b !important; font-weight: bold !important; } /* Name.Decorator - Green */
.highlight .ni { color: #ffffff !important; } /* Name.Entity - White */
.highlight .ne { color: #ff5555 !important; font-weight: bold !important; } /* Name.Exception - Red */
.highlight .nf { color: #50fa7b !important; font-weight: bold !important; } /* Name.Function - Green */
.highlight .nl { color: #ffffff !important; } /* Name.Label */
.highlight .nn { color: #8be9fd !important; } /* Name.Namespace - Cyan */
.highlight .nx { color: #50fa7b !important; } /* Name.Other - Green */
.highlight .py { color: #ffffff !important; } /* Name.Property */
.highlight .nt { color: #ff79c6 !important; } /* Name.Tag - Pink */
.highlight .nv { color: #ffffff !important; } /* Name.Variable */
.highlight .ow { color: #ff79c6 !important; font-weight: bold !important; } /* Operator.Word - Pink */
.highlight .w { color: #ffffff !important; } /* Text.Whitespace */
.highlight .mb { color: #bd93f9 !important; } /* Literal.Number.Bin - Purple */
.highlight .mf { color: #bd93f9 !important; } /* Literal.Number.Float - Purple */
.highlight .mh { color: #bd93f9 !important; } /* Literal.Number.Hex - Purple */
.highlight .mi { color: #bd93f9 !important; } /* Literal.Number.Integer - Purple */
.highlight .mo { color: #bd93f9 !important; } /* Literal.Number.Oct - Purple */
.highlight .sa { color: #f1fa8c !important; } /* Literal.String.Affix - Yellow */
.highlight .sb { color: #f1fa8c !important; } /* Literal.String.Backtick - Yellow */
.highlight .sc { color: #f1fa8c !important; } /* Literal.String.Char - Yellow */
.highlight .dl { color: #f1fa8c !important; } /* Literal.String.Delimiter - Yellow */
.highlight .sd { color: #b8b8ff !important; font-style: italic !important; } /* Literal.String.Doc - Bright purple */
.highlight .s2 { color: #f1fa8c !important; } /* Literal.String.Double - Yellow */
.highlight .se { color: #ff79c6 !important; } /* Literal.String.Escape - Pink */
.highlight .sh { color: #f1fa8c !important; } /* Literal.String.Heredoc - Yellow */
.highlight .si { color: #ff79c6 !important; } /* Literal.String.Interpol - Pink */
.highlight .sx { color: #f1fa8c !important; } /* Literal.String.Other - Yellow */
.highlight .sr { color: #ff79c6 !important; } /* Literal.String.Regex - Pink */
.highlight .s1 { color: #f1fa8c !important; } /* Literal.String.Single - Yellow */
.highlight .ss { color: #bd93f9 !important; } /* Literal.String.Symbol - Purple */
.highlight .bp { color: #8be9fd !important; } /* Name.Builtin.Pseudo - Cyan */
.highlight .fm { color: #50fa7b !important; font-weight: bold !important; } /* Name.Function.Magic - Green */
.highlight .vc { color: #ffffff !important; } /* Name.Variable.Class - White */
.highlight .vg { color: #ffffff !important; } /* Name.Variable.Global - White */
.highlight .vi { color: #ffffff !important; } /* Name.Variable.Instance - White */
.highlight .vm { color: #ffffff !important; } /* Name.Variable.Magic - White */
.highlight .il { color: #bd93f9 !important; } /* Literal.Number.Integer.Long - Purple */

/* 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 high-contrast syntax colors as dark mode since we're using dark backgrounds */
  .highlight .c { color: #b8b8ff !important; }  /* Comments - Bright purple */
  .highlight .k { color: #ff79c6 !important; }  /* Keywords - Pink */
  .highlight .s { color: #f1fa8c !important; }  /* Strings - Yellow */
  .highlight .n { color: #ffffff !important; }  /* Names - White */
  .highlight .nf { color: #50fa7b !important; }  /* Functions - Green */
  .highlight .nc { color: #50fa7b !important; }  /* Classes - Green */
  
  .sig {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%) !important;
    border-color: #e9d5ff !important;
    border-left-color: #8b5cf6 !important;
    color: #1f2937 !important;
  }
}