/* Syntax Highlighting CSS */

/* Code Blocks */
pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
}

code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
}

/* Ensure consistent font size for all code elements */
.highlight code,
.highlight pre,
.highlight span {
    font-size: 0.75rem !important;
    font-family: var(--font-mono);
}

/* Code blocks */
pre code {
    font-size: 0.75rem !important;
}

/* All code block elements */
pre,
pre *,
.highlight,
.highlight *,
code,
code * {
    font-size: 0.75rem !important;
    font-family: var(--font-mono) !important;
}

/* Inline Code */
:not(pre) > code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem !important;
    color: var(--text-primary);
}

/* Line Numbers */
.highlight {
    position: relative;
}

.highlight pre {
    padding-left: 3.5rem;
}

.highlight .lineno {
    position: absolute;
    left: 0;
    width: 3rem;
    padding-right: 0.5rem;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
}

/* Language Badge */
pre[data-lang]::before {
    content: attr(data-lang);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom-left-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* GitHub Light Theme (default) */
.highlight .c { color: #6a737d; font-size: 0.75rem !important; } /* Comment */
.highlight .err { color: #b31d28; background-color: #ffeef0; } /* Error */
.highlight .k { color: #d73a49; } /* Keyword */
.highlight .o { color: #6f42c1; } /* Operator */
.highlight .cm { color: #6a737d; font-size: 0.75rem !important; } /* Comment.Multiline */
.highlight .cp { color: #d73a49; font-size: 0.75rem !important; } /* Comment.Preproc */
.highlight .c1 { color: #6a737d; font-size: 0.75rem !important; } /* Comment.Single */
.highlight .cs { color: #6a737d; font-weight: normal; font-size: 0.75rem !important; } /* Comment.Special */
.highlight .gd { color: #b31d28; background-color: #ffeef0; } /* Generic.Deleted */
.highlight .ge { font-style: italic; } /* Generic.Emph */
.highlight .gh { color: #005cc5; font-weight: normal; } /* Generic.Heading */
.highlight .gi { color: #22863a; background-color: #f0fff4; } /* Generic.Inserted */
.highlight .gp { color: #6a737d; font-weight: normal; } /* Generic.Prompt */
.highlight .gs { font-weight: normal; } /* Generic.Strong */
.highlight .gu { color: #6f42c1; font-weight: normal; } /* Generic.Subheading */
.highlight .kc { color: #005cc5; } /* Keyword.Constant */
.highlight .kd { color: #d73a49; } /* Keyword.Declaration */
.highlight .kn { color: #d73a49; } /* Keyword.Namespace */
.highlight .kp { color: #d73a49; } /* Keyword.Pseudo */
.highlight .kr { color: #d73a49; } /* Keyword.Reserved */
.highlight .kt { color: #d73a49; } /* Keyword.Type */
.highlight .m { color: #005cc5; } /* Literal.Number */
.highlight .s { color: #032f62; } /* Literal.String */
.highlight .na { color: #22863a; } /* Name.Attribute */
.highlight .nb { color: #005cc5; } /* Name.Builtin */
.highlight .nc { color: #6f42c1; } /* Name.Class */
.highlight .no { color: #005cc5; } /* Name.Constant */
.highlight .nd { color: #6f42c1; } /* Name.Decorator */
.highlight .ni { color: #005cc5; } /* Name.Entity */
.highlight .ne { color: #005cc5; } /* Name.Exception */
.highlight .nf { color: #6f42c1; } /* Name.Function */
.highlight .nl { color: #005cc5; } /* Name.Label */
.highlight .nn { color: #6f42c1; } /* Name.Namespace */
.highlight .nt { color: #22863a; } /* Name.Tag */
.highlight .nv { color: #e36209; } /* Name.Variable */
.highlight .ow { color: #d73a49; } /* Operator.Word */
.highlight .w { color: #f6f8fa; } /* Text.Whitespace */
.highlight .mf { color: #005cc5; } /* Literal.Number.Float */
.highlight .mh { color: #005cc5; } /* Literal.Number.Hex */
.highlight .mi { color: #005cc5; } /* Literal.Number.Integer */
.highlight .mo { color: #005cc5; } /* Literal.Number.Oct */
.highlight .sb { color: #032f62; } /* Literal.String.Backtick */
.highlight .sc { color: #032f62; } /* Literal.String.Char */
.highlight .sd { color: #032f62; } /* Literal.String.Doc */
.highlight .s2 { color: #032f62; } /* Literal.String.Double */
.highlight .se { color: #032f62; } /* Literal.String.Escape */
.highlight .sh { color: #032f62; } /* Literal.String.Heredoc */
.highlight .si { color: #005cc5; } /* Literal.String.Interpol */
.highlight .sx { color: #032f62; } /* Literal.String.Other */
.highlight .sr { color: #032f62; } /* Literal.String.Regex */
.highlight .s1 { color: #032f62; } /* Literal.String.Single */
.highlight .ss { color: #005cc5; } /* Literal.String.Symbol */
.highlight .bp { color: #005cc5; } /* Name.Builtin.Pseudo */
.highlight .vc { color: #e36209; } /* Name.Variable.Class */
.highlight .vg { color: #e36209; } /* Name.Variable.Global */
.highlight .vi { color: #e36209; } /* Name.Variable.Instance */
.highlight .il { color: #005cc5; } /* Literal.Number.Integer.Long */

/* Dark Theme Overrides */
[data-theme="dark"] .highlight .c { color: #8b949e; font-size: 0.75rem !important; }
[data-theme="dark"] .highlight .err { color: #f85149; background-color: transparent; }
[data-theme="dark"] .highlight .k { color: #ff7b72; }
[data-theme="dark"] .highlight .o { color: #79c0ff; }
[data-theme="dark"] .highlight .cm { color: #8b949e; font-size: 0.75rem !important; }
[data-theme="dark"] .highlight .cp { color: #ff7b72; font-size: 0.75rem !important; }
[data-theme="dark"] .highlight .c1 { color: #8b949e; font-size: 0.75rem !important; }
[data-theme="dark"] .highlight .cs { color: #8b949e; font-weight: normal; font-size: 0.75rem !important; }
[data-theme="dark"] .highlight .gd { color: #ffdcd7; background-color: #67060c; }
[data-theme="dark"] .highlight .gh { color: #79c0ff; font-weight: normal; }
[data-theme="dark"] .highlight .gi { color: #aff5b4; background-color: #033a16; }
[data-theme="dark"] .highlight .gp { color: #8b949e; font-weight: normal; }
[data-theme="dark"] .highlight .gu { color: #d2a8ff; font-weight: normal; }
[data-theme="dark"] .highlight .kc { color: #79c0ff; }
[data-theme="dark"] .highlight .kd { color: #ff7b72; }
[data-theme="dark"] .highlight .kn { color: #ff7b72; }
[data-theme="dark"] .highlight .kp { color: #ff7b72; }
[data-theme="dark"] .highlight .kr { color: #ff7b72; }
[data-theme="dark"] .highlight .kt { color: #ff7b72; }
[data-theme="dark"] .highlight .m { color: #79c0ff; }
[data-theme="dark"] .highlight .s { color: #a5d6ff; }
[data-theme="dark"] .highlight .na { color: #7ee787; }
[data-theme="dark"] .highlight .nb { color: #79c0ff; }
[data-theme="dark"] .highlight .nc { color: #f0883e; }
[data-theme="dark"] .highlight .no { color: #79c0ff; }
[data-theme="dark"] .highlight .nd { color: #d2a8ff; }
[data-theme="dark"] .highlight .ni { color: #ffa657; }
[data-theme="dark"] .highlight .ne { color: #f0883e; }
[data-theme="dark"] .highlight .nf { color: #d2a8ff; }
[data-theme="dark"] .highlight .nl { color: #79c0ff; }
[data-theme="dark"] .highlight .nn { color: #ff7b72; }
[data-theme="dark"] .highlight .nt { color: #7ee787; }
[data-theme="dark"] .highlight .nv { color: #ffa657; }
[data-theme="dark"] .highlight .ow { color: #ff7b72; }
[data-theme="dark"] .highlight .mf { color: #79c0ff; }
[data-theme="dark"] .highlight .mh { color: #79c0ff; }
[data-theme="dark"] .highlight .mi { color: #79c0ff; }
[data-theme="dark"] .highlight .mo { color: #79c0ff; }
[data-theme="dark"] .highlight .sb { color: #a5d6ff; }
[data-theme="dark"] .highlight .sc { color: #a5d6ff; }
[data-theme="dark"] .highlight .sd { color: #8b949e; }
[data-theme="dark"] .highlight .s2 { color: #a5d6ff; }
[data-theme="dark"] .highlight .se { color: #79c0ff; }
[data-theme="dark"] .highlight .sh { color: #a5d6ff; }
[data-theme="dark"] .highlight .si { color: #a5d6ff; }
[data-theme="dark"] .highlight .sx { color: #a5d6ff; }
[data-theme="dark"] .highlight .sr { color: #79c0ff; }
[data-theme="dark"] .highlight .s1 { color: #a5d6ff; }
[data-theme="dark"] .highlight .ss { color: #a5d6ff; }
[data-theme="dark"] .highlight .bp { color: #79c0ff; }
[data-theme="dark"] .highlight .vc { color: #ffa657; }
[data-theme="dark"] .highlight .vg { color: #ffa657; }
[data-theme="dark"] .highlight .vi { color: #ffa657; }
[data-theme="dark"] .highlight .il { color: #79c0ff; }

/* Copy Button */
.code-block-wrapper {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
}

.code-block-wrapper:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.copy-button.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* Diff Highlighting */
.diff-addition {
    background-color: rgba(34, 134, 58, 0.1);
    color: #22863a;
}

.diff-deletion {
    background-color: rgba(179, 29, 40, 0.1);
    color: #b31d28;
}

[data-theme="dark"] .diff-addition {
    background-color: rgba(126, 231, 135, 0.1);
    color: #7ee787;
}

[data-theme="dark"] .diff-deletion {
    background-color: rgba(248, 81, 73, 0.1);
    color: #f85149;
}