/* Code Highlighting Styles */

/* Code block container */
.content pre,
.content .code-block {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    box-shadow: 0 4px 6px var(--shadow-light);
    outline: none !important;
    transition: none;
    
    -webkit-tap-highlight-color: transparent;
}

.content pre:focus,
.content .code-block:focus {
    outline: none !important;
    box-shadow: none !important;

}

.content pre:focus-within,
.content .code-block:focus-within {
    outline: none !important;
    box-shadow: none !important;
}

.content pre:focus-visible,
.content .code-block:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Copy button */
.copy-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.5rem;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    backdrop-filter: blur(4px);
    z-index: 10;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.copy-button:active {
    transform: translateY(0);
}

.copy-button:focus {
    outline: none;
    box-shadow: none;
}

.copy-button:focus-visible {
    outline: none;
    box-shadow: none;
}

.copy-button.copied {
    background: #38a169;
    color: white;
    border-color: #38a169;
}

.copy-button.copied:hover {
    background: #2f855a;
    border-color: #2f855a;
}

/* Code syntax highlighting */
.content pre code,
.content .code-block code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
    transition: none;
    text-shadow: none !important;
}

/* Remove text shadows from all code elements */
.content pre *,
.content .code-block * {
    text-shadow: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
}

/* Remove any lines from Prism.js elements */
.content pre .token,
.content .code-block .token,
.content pre code,
.content .code-block code,
.content pre span,
.content .code-block span {
    text-decoration: none !important;
    border-bottom: none !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
    text-decoration-thickness: 0 !important;
    text-underline-offset: 0 !important;
    text-underline-position: auto !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* String literals */
.content pre .string,
.content .code-block .string {
    color: #9f7aea;
}

/* Comments */
.content pre .comment,
.content .code-block .comment {
    color: #718096;
    font-style: italic;
}

/* Keywords */
.content pre .keyword,
.content .code-block .keyword {
    color: #f56565;
    font-weight: 600;
}

/* Numbers */
.content pre .number,
.content .code-block .number {
    color: #ed8936;
}

/* Functions */
.content pre .function,
.content .code-block .function {
    color: #4299e1;
    font-weight: 500;
}

/* Classes */
.content pre .class,
.content .code-block .class {
    color: #48bb78;
    font-weight: 600;
}

/* Boolean values */
.content pre .boolean,
.content .code-block .boolean {
    color: #ed8936;
    font-weight: 600;
}

/* HTML specific */
.content pre .tag,
.content .code-block .tag {
    color: #f56565;
}

.content pre .attribute,
.content .code-block .attribute {
    color: #4299e1;
}

/* CSS specific */
.content pre .selector,
.content .code-block .selector {
    color: #f56565;
    font-weight: 600;
}

.content pre .property,
.content .code-block .property {
    color: #4299e1;
}

.content pre .value,
.content .code-block .value {
    color: #ed8936;
}

/* JSON specific */
.content pre .key,
.content .code-block .key {
    color: #4299e1;
    font-weight: 500;
}

/* Dark mode specific syntax highlighting */
[data-theme="dark"] .content pre .string,
[data-theme="dark"] .content .code-block .string {
    color: #d6bcfa;
}

[data-theme="dark"] .content pre .comment,
[data-theme="dark"] .content .code-block .comment {
    color: #a0aec0;
}

[data-theme="dark"] .content pre .keyword,
[data-theme="dark"] .content .code-block .keyword {
    color: #fc8181;
}

[data-theme="dark"] .content pre .number,
[data-theme="dark"] .content .code-block .number {
    color: #fbbf24;
}

[data-theme="dark"] .content pre .function,
[data-theme="dark"] .content .code-block .function {
    color: #90cdf4;
}

[data-theme="dark"] .content pre .class,
[data-theme="dark"] .content .code-block .class {
    color: #9ae6b4;
}

[data-theme="dark"] .content pre .boolean,
[data-theme="dark"] .content .code-block .boolean {
    color: #fbbf24;
}

[data-theme="dark"] .content pre .tag,
[data-theme="dark"] .content .code-block .tag {
    color: #fc8181;
}

[data-theme="dark"] .content pre .attribute,
[data-theme="dark"] .content .code-block .attribute {
    color: #90cdf4;
}

[data-theme="dark"] .content pre .selector,
[data-theme="dark"] .content .code-block .selector {
    color: #fc8181;
}

[data-theme="dark"] .content pre .property,
[data-theme="dark"] .content .code-block .property {
    color: #90cdf4;
}

[data-theme="dark"] .content pre .value,
[data-theme="dark"] .content .code-block .value {
    color: #fbbf24;
}

[data-theme="dark"] .content pre .key,
[data-theme="dark"] .content .code-block .key {
    color: #90cdf4;
}

/* Code block language indicator */
.content pre::before,
.content .code-block::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    left: 0;
    background: #2d3748;
    color: #a0aec0;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 8px 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive design for code blocks */
@media (max-width: 768px) {
    .content pre,
    .content .code-block {
        padding: 1rem;
        font-size: 0.8rem;
        margin: 1rem 0;
    }
    
    .copy-button {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .content pre::before,
    .content .code-block::before {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .content code,
    .content .inline-code {
        background: #2d3748;
        border-color: #4a5568;
        color: #9f7aea;
    }
}

/* Animation for copy success */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.copy-button.copied {
    animation: copySuccess 0.3s ease;
}

/* Print styles */
@media print {
    .copy-button {
        display: none;
    }
    
    .content pre,
    .content .code-block {
        background: #f7fafc;
        color: #1a202c;
        border: 1px solid #e2e8f0;
        box-shadow: none;
    }
}

/* Inline code */
.content code,
.content .inline-code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-family: 'Fira Code', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.875rem;
    color: var(--code-text);
    font-weight: 600;
    box-shadow: 0 1px 2px var(--shadow-medium);
    transition: none;
}

/* Override Prism.js default styles */
.content pre[class*="language-"],
.content .code-block[class*="language-"] {
    text-decoration: none !important;
    border-bottom: none !important;
}

.content pre[class*="language-"] *,
.content .code-block[class*="language-"] * {
    text-decoration: none !important;
    border-bottom: none !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
    text-decoration-thickness: 0 !important;
    text-underline-offset: 0 !important;
    text-underline-position: auto !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* Force remove any underline from all code elements */
.content pre,
.content .code-block,
.content pre *,
.content .code-block * {
    text-decoration: none !important;
    border-bottom: none !important;
    text-decoration-line: none !important;
    text-decoration-style: none !important;
    text-decoration-color: transparent !important;
    text-decoration-thickness: 0 !important;
    text-underline-offset: 0 !important;
    text-underline-position: auto !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
} 