/* PrismJS CSS for Syntax Highlighting */
/* Copyright (C) 2025 Germán Luis Aracil Boned <garacilb@gmail.com> */
/* Licensed under GNU GPL v3 or later */

/* Base */
code[class*="language-"],
pre[class*="language-"] {
    color: #393A34;
    font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
    direction: ltr;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    font-size: 0.95em;
    line-height: 1.2em;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

pre > code[class*="language-"] {
    font-size: 1em;
}

pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
    background: #C1DEF1;
}

pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
    background: #C1DEF1;
}

/* Code blocks */
pre[class*="language-"] {
    padding: 1.5em;
    margin: 1em 0;
    overflow: auto;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

:not(pre) > code[class*="language-"] {
    padding: 0.2em 0.4em;
    border-radius: 0.3em;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Tokens */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #999988;
    font-style: italic;
}

.token.namespace {
    opacity: 0.7;
}

.token.string,
.token.attr-value {
    color: #e3116c;
}

.token.punctuation,
.token.operator {
    color: #393A34;
}

.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
    color: #36acaa;
}

.token.keyword {
    color: #00a4db;
    font-weight: bold;
}

.token.regex,
.token.important {
    color: #e90;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

.token.deleted {
    color: red;
}

.token.inserted {
    color: green;
}

/* SQL specific */
.language-sql .token.keyword {
    color: #0000ff;
    font-weight: bold;
}

.language-sql .token.string {
    color: #008000;
}

.language-sql .token.number {
    color: #ff0000;
}

.language-sql .token.function {
    color: #795da3;
}

.language-sql .token.operator {
    color: #d73a49;
}

/* PHP specific */
.language-php .token.keyword {
    color: #0000bb;
    font-weight: bold;
}

.language-php .token.string {
    color: #dd0000;
}

.language-php .token.variable {
    color: #bb0066;
}

.language-php .token.function {
    color: #007700;
}

.language-php .token.class-name {
    color: #445588;
    font-weight: bold;
}

/* JavaScript specific */
.language-javascript .token.keyword {
    color: #0000ff;
    font-weight: bold;
}

.language-javascript .token.string {
    color: #008000;
}

.language-javascript .token.number {
    color: #ff0000;
}

.language-javascript .token.function {
    color: #795da3;
}

/* Line highlighting */
pre[data-line] {
    position: relative;
    padding: 1em 0 1em 3em;
}

.line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    padding: inherit 0;
    margin-top: 1em;
    background: hsla(24, 20%, 50%,.08);
    background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
    pointer-events: none;
    line-height: inherit;
    white-space: pre;
}

.line-highlight:before,
.line-highlight[data-end]:after {
    content: attr(data-start);
    position: absolute;
    top: .4em;
    left: .6em;
    min-width: 1em;
    padding: 0 .5em;
    background-color: hsla(24, 20%, 50%,.4);
    color: hsl(24, 20%, 95%);
    font: bold 65%/1.5 sans-serif;
    text-align: center;
    vertical-align: .3em;
    border-radius: 999px;
    text-shadow: none;
    box-shadow: 0 1px white;
}

.line-highlight[data-end]:after {
    content: attr(data-end);
    top: auto;
    bottom: .4em;
}

/* Custom styles for the documentation */
.code-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.code-before,
.code-after {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.code-before h4,
.code-after h4 {
    padding: 1rem;
    margin: 0;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    font-size: 1rem;
}

.code-after h4 {
    background: linear-gradient(135deg, #51cf66, #40c057);
}

.code-before pre,
.code-after pre {
    margin: 0;
    border-radius: 0;
    border: none;
}

.code-comparison-result {
    margin-top: 2rem;
    background: linear-gradient(135deg, #339af0, #228be6);
    border-radius: 8px;
    padding: 1.5rem;
    color: white;
}

.code-comparison-result h4 {
    margin-bottom: 1rem;
    color: white;
}

.result-php {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
}

.result-php h5 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.result-php pre {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-radius: 4px;
    margin: 0;
}

/* Responsive code blocks */
@media (max-width: 768px) {
    .code-comparison {
        grid-template-columns: 1fr;
    }
    
    pre[class*="language-"] {
        padding: 1rem;
        font-size: 0.85em;
        overflow-x: auto;
    }
    
    .code-before h4,
    .code-after h4 {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
}

/* Copy button styling */
.copy-code-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    z-index: 10;
}

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

/* Enhanced syntax highlighting for specific elements */
.token.comment.sql {
    color: #5e6687;
    font-style: italic;
}

.token.sql-keyword {
    color: #c678dd;
    font-weight: bold;
}

.token.sql-function {
    color: #61afef;
}

.token.sql-string {
    color: #98c379;
}

.token.sql-number {
    color: #d19a66;
}

.token.php-variable {
    color: #e06c75;
}

.token.php-function {
    color: #61afef;
}

.token.php-class {
    color: #e5c07b;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    code[class*="language-"],
    pre[class*="language-"] {
        color: #f8f8f2;
    }
    
    pre[class*="language-"] {
        background: #282c34;
        border-color: #4a5568;
    }
    
    :not(pre) > code[class*="language-"] {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .token.comment,
    .token.prolog,
    .token.doctype,
    .token.cdata {
        color: #999999;
    }
    
    .token.string,
    .token.attr-value {
        color: #98c379;
    }
    
    .token.keyword {
        color: #c678dd;
    }
    
    .token.function {
        color: #61afef;
    }
    
    .token.number {
        color: #d19a66;
    }
}