/* ============================================================================
   CODE EDITOR - Syntax Highlighting Styles
   ============================================================================ */

/* Editor wrapper */
.code-editor-wrapper {
    display: flex;
    background: #1e1e2e;
    border: 1px solid #3a3a5c;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Consolas', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
}

    .code-editor-wrapper:focus-within {
        border-color: #4a8af4;
        box-shadow: 0 0 0 2px rgba(74, 138, 244, 0.15);
    }

/* Line numbers gutter */
.code-editor-gutter {
    padding: 10px 0;
    background: #16161f;
    border-right: 1px solid #2a2a45;
    user-select: none;
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
    overflow: hidden;
}

    .code-editor-gutter .line-number {
        padding: 0 10px;
        color: #4a4a6a;
        font-size: 12px;
        height: 19.5px;
        line-height: 19.5px;
    }

/* Content wrapper - positions textarea over highlight */
.code-editor-content-wrapper {
    position: relative;
    flex: 1;
    overflow: auto;
}

/* Highlight layer (behind textarea) */
.code-editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px;
    margin: 0;
    color: #e0e0e0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    pointer-events: none;
    overflow: hidden;
}

/* Textarea layer (on top, transparent background) */
.code-editor-textarea {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 60px;
    padding: 10px 12px;
    margin: 0;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: #ffffff;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

    .code-editor-textarea::placeholder {
        color: #5a5a7a;
    }

/* ===== SYNTAX HIGHLIGHTING COLORS ===== */

/* Template variables ${...} - bright cyan */
.cm-variable-template {
    color: #56d4dd;
    font-weight: 500;
}

/* Keywords - purple */
.cm-keyword {
    color: #c678dd;
    font-weight: 500;
}

/* Strings - green */
.cm-string {
    color: #98c379;
}

/* Numbers - orange */
.cm-number {
    color: #d19a66;
}

/* Built-in functions - blue */
.cm-builtin {
    color: #61afef;
}

/* Comments - gray italic */
.cm-comment {
    color: #5c6370;
    font-style: italic;
}

/* Operators - light gray/white */
.cm-operator {
    color: #abb2bf;
}

/* SQL-specific: data types - yellow */
.cm-type {
    color: #e5c07b;
}

/* SQL-specific: variables/parameters - cyan */
.cm-variable {
    color: #56b6c2;
}

/* ===== MAXIMIZED EDITOR ===== */
.expression-maximized-body .code-editor-wrapper {
    flex: 1;
    min-height: 200px;
    max-height: none;
}

.expression-maximized-body .code-editor-content-wrapper {
    min-height: 300px;
}

.expression-maximized-body .code-editor-textarea {
    min-height: 300px;
}

/* ===== EDITOR IN MAPPING PANEL ===== */
.mapping-editor-panel .code-editor-wrapper {
    min-height: 80px;
    max-height: 150px;
}

/* ===== SQL EDITOR IN NODE CONFIG ===== */
.sql-editor-container .code-editor-wrapper {
    min-height: 150px;
    max-height: 400px;
}

/* ===== SCROLLBAR STYLING ===== */
.code-editor-content-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-editor-content-wrapper::-webkit-scrollbar-track {
    background: #1e1e2e;
}

.code-editor-content-wrapper::-webkit-scrollbar-thumb {
    background: #3a3a5c;
    border-radius: 4px;
}

    .code-editor-content-wrapper::-webkit-scrollbar-thumb:hover {
        background: #4a4a6c;
    }

/* ===== SELECTION ===== */
.code-editor-textarea::selection {
    background: rgba(74, 138, 244, 0.3);
}

/* ===== INLINE CODE EDITOR (smaller variant) ===== */
.code-editor-inline .code-editor-wrapper {
    min-height: 36px;
    max-height: 100px;
}

.code-editor-inline .code-editor-gutter {
    display: none;
}

.code-editor-inline .code-editor-textarea {
    padding: 8px 10px;
}

.code-editor-inline .code-editor-highlight {
    padding: 8px 10px;
}

/* Code editor container */
.code-editor-container {
    min-height: 80px;
}
