/**
 * Public-facing CSS for Code Highlighting Block
 *
 * @since      1.0.0
 * @package    Code_Highlighting_Block
 */

/* Main container */
.code-highlighting-block {
    margin: 1.5em 0;
    background-color: #f5f5f5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: auto;
    position: relative;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    line-height: 1.5;
}

/* Code element */
.code-highlighting-block code {
    display: block;
    padding: 1em;
    overflow-x: auto;
    tab-size: 4;
    -moz-tab-size: 4;
    -o-tab-size: 4;
    -webkit-tab-size: 4;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
}

/* Line numbers */
.code-highlighting-block.line-numbers {
    padding-left: 3.5em;
    counter-reset: line;
}

.code-highlighting-block.line-numbers code {
    position: relative;
}

.code-highlighting-block.line-numbers code::before {
    content: counter(line);
    counter-increment: line;
    position: absolute;
    left: -3.5em;
    width: 3em;
    text-align: right;
    color: #999;
    padding-right: 0.5em;
    border-right: 1px solid #ddd;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Line wrapping */
.code-highlighting-block.wrap-lines code {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Language indicator */
.code-highlighting-block::after {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.3em 0.6em;
    font-size: 0.7em;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 0 4px 0 4px;
    text-transform: uppercase;
}

/* Themes - Default Light */
.code-highlighting-block.theme-default {
    background-color: #f5f5f5;
    color: #333;
}

/* Theme - Dark */
.code-highlighting-block.theme-dark {
    background-color: #282c34;
    color: #abb2bf;
}

/* Theme - Monokai */
.code-highlighting-block.theme-monokai {
    background-color: #272822;
    color: #f8f8f2;
}

/* Different language syntax highlighting */
/* Keywords */
.code-highlighting-block .hljs-keyword {
    color: #569cd6;
    font-weight: bold;
}

/* Strings */
.code-highlighting-block .hljs-string {
    color: #ce9178;
}

/* Comments */
.code-highlighting-block .hljs-comment {
    color: #6a9955;
    font-style: italic;
}

/* Functions */
.code-highlighting-block .hljs-function {
    color: #dcdcaa;
}

/* Variables */
.code-highlighting-block .hljs-variable {
    color: #9cdcfe;
}

/* Numbers */
.code-highlighting-block .hljs-number {
    color: #b5cea8;
}

/* Operators */
.code-highlighting-block .hljs-operator {
    color: #d4d4d4;
}

/* Classes */
.code-highlighting-block .hljs-class {
    color: #4ec9b0;
}

/* Copy button */
.code-highlighting-copy-button {
    position: absolute;
    top: 0.5em;
    right: 2.5em;
    padding: 0.3em 0.6em;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    color: #333;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

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

.code-highlighting-copy-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.code-highlighting-copy-button:active {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media screen and (max-width: 600px) {
    .code-highlighting-block {
        font-size: 0.85em;
    }
    
    .code-highlighting-block.line-numbers {
        padding-left: 3em;
    }
    
    .code-highlighting-block.line-numbers code::before {
        left: -3em;
        width: 2.5em;
    }
}