/* ===== Editor Panel ===== */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-width: 0;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    height: 26px;
}

.editor-file-count::before {
    content: '📄 ';
}

.editor-sort-select {
    margin-left: 8px;
    font-size: 11px;
    padding: 1px 4px;
}

.editor-selection-hint {
    position: relative;
    margin-left: auto;
    min-width: 260px;
    height: 18px;
    overflow: hidden;
    text-align: right;
    font-size: 11px;
    opacity: 0.8;
}

.editor-selection-hint-line {
    padding-left: 10px;
    padding-right: 10px;
    position: absolute;
    inset: 0;
    display: block;
    white-space: nowrap;
    opacity: 0;
    animation: editor-selection-hint-fade 8s infinite;
}

.editor-selection-hint-line:nth-child(2) {
    animation-delay: 4s;
}

@keyframes editor-selection-hint-fade {
    0% { opacity: 0; }
    10% { opacity: 1; }
    40% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 0; }
}

/* ===== Editor Scroll Container ===== */
.editor-scroll {
    flex: 1;
    display: flex;
    overflow: auto;
    position: relative;
}

/* ===== Line Numbers ===== */
.line-numbers {
    background: var(--line-number-bg);
    color: var(--line-number-color);
    text-align: right;
    padding: 4px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 20px;
    user-select: none;
    flex-shrink: 0;
    min-width: 40px;
    border-right: 1px solid var(--border-color);
    position: sticky;
    left: 0;
    z-index: 3;
}

.line-number {
    padding: 0 8px 0 8px;
    height: 20px;
}

/* ===== Editor Content ===== */
.editor {
    flex: 1;
    padding: 4px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 20px;
    outline: none;
    position: relative;
    cursor: text;
    min-width: 0;
    overflow: visible;
}

/* ===== Editor Line ===== */
.editor-line {
    height: 20px;
    padding: 0 8px;
    white-space: pre;
    tab-size: 4;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-line.modified {
    background: var(--diff-added-bg);
}

.editor-line-folder {
    color: var(--text-accent);
}

.editor-line.has-invalid {
    box-shadow: inset 3px 0 0 var(--diff-removed-text);
}

.editor-line.has-conflict {
    box-shadow: inset 3px 0 0 #d29922;
}

.editor-line-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    tab-size: 4;
}

.editor-line-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.editor-line-badge {
    font-size: 10px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.editor-line-badge-invalid {
    background: rgba(218, 54, 51, 0.2);
    color: var(--diff-removed-text);
    border: 1px solid rgba(218, 54, 51, 0.45);
}

.editor-line-badge-conflict {
    background: rgba(210, 153, 34, 0.18);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.45);
}

/* ===== Inline Diff Spans ===== */
.diff-added {
    background: var(--diff-added-bg);
    color: var(--diff-added-text);
}

.diff-removed {
    background: var(--diff-removed-bg);
    color: var(--diff-removed-text);
    text-decoration: line-through;
    opacity: 0.7;
}

.diff-delete-line {
    display: inline-block;
    width: 2px;
    margin-left: -1px;
    margin-right: -1px;
    background: var(--diff-removed-text);
    opacity: 0.6;
}

/* ===== Search Highlight ===== */
.search-highlight {
    background: rgba(255, 200, 0, 0.35);
    border-bottom: 2px solid rgba(255, 180, 0, 0.8);
    border-radius: 1px;
}

/* ===== Block Selection Overlay ===== */
.block-selection-highlight {
    position: absolute;
    background: var(--bg-block-selection);
    pointer-events: none;
    z-index: 1;
    border: 1px solid rgba(100, 150, 255, 0.4);
    box-sizing: border-box;
}

/* ===== Caret ===== */
.editor-caret {
    position: absolute;
    width: 2px;
    height: 20px;
    background: var(--text-primary);
    z-index: 2;
    animation: blink 1s step-end infinite;
    pointer-events: none;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ===== Normal text selection highlight ===== */
.text-selection {
    position: absolute;
    background: var(--bg-selection);
    pointer-events: none;
    z-index: 1;
    height: 20px;
}

/* ===== Hidden textarea for input capture ===== */
.editor-hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    top: 0;
    left: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    resize: none;
    white-space: pre;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
}
