/* Partial: _file-viewer.css.j2 — Split layout and file viewer panel */

.split-layout {
    display: flex;
    height: calc(100vh - 140px);
    overflow: hidden;
}

.split-layout > .main-content {
    flex: 1;
    min-width: 350px;
    overflow-y: auto;
    padding: 24px;
}

.split-layout > .main-content.full-width {
    /* When file viewer is closed */
}

.split-divider {
    width: 5px;
    background: #e9ecef;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
    display: none; /* hidden until panel opens */
}

.split-divider:hover,
.split-divider.dragging {
    background: #0d6efd;
}

.split-divider::after {
    content: '···';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    color: #6c757d;
    font-size: 10px;
    letter-spacing: 2px;
}

.file-viewer-panel {
    width: 50%;
    max-width: 60%;
    min-width: 300px;
    display: none; /* hidden until a file is clicked */
    flex-direction: column;
    background: white;
    border-left: 1px solid #e9ecef;
    overflow: hidden;
}

.file-viewer-panel.open {
    display: flex;
}

.file-viewer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.file-viewer-path {
    flex: 1;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8rem;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-viewer-lang {
    font-size: 0.7rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.file-viewer-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    color: #495057;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.file-viewer-btn:hover {
    background: #e9ecef;
}

.file-viewer-close {
    font-size: 1.2rem;
    line-height: 1;
    font-weight: bold;
    color: #6c757d;
}

.file-viewer-close:hover {
    color: #dc3545;
}

.file-viewer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
}

/* Line-numbered source display */
.source-lines {
    display: table;
    width: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
}

.source-line {
    display: table-row;
}

.source-line:hover {
    background: #f0f4ff;
}

.source-line.highlighted {
    background: #fff3cd;
}

.source-line.highlighted:hover {
    background: #ffe69c;
}

.line-num {
    display: table-cell;
    width: 1px; /* shrink to content */
    min-width: 40px;
    padding: 0 12px 0 8px;
    text-align: right;
    color: #adb5bd;
    user-select: none;
    white-space: nowrap;
    vertical-align: top;
    border-right: 1px solid #e9ecef;
    background: #f8f9fa;
}

.line-content {
    display: table-cell;
    padding: 0 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    tab-size: 4;
}

.line-content.rendered-line {
    white-space: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.line-content.rendered-line p {
    margin: 0;
    display: inline;
}

.line-content.rendered-line h1,
.line-content.rendered-line h2,
.line-content.rendered-line h3 {
    margin: 0;
    display: inline;
    font-size: inherit;
}

.line-content.rendered-line h1 { font-size: 1.4em; }
.line-content.rendered-line h2 { font-size: 1.2em; }
.line-content.rendered-line h3 { font-size: 1.1em; }

.line-content.rendered-line code {
    background: #f1f3f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Markdown rendered view (full-page, no longer used but kept for fallback) */
.file-viewer-rendered {
    padding: 16px 24px;
    line-height: 1.6;
}

.file-viewer-rendered h1,
.file-viewer-rendered h2,
.file-viewer-rendered h3 {
    margin: 16px 0 8px;
    color: #212529;
}

.file-viewer-rendered p {
    margin: 8px 0;
}

.file-viewer-rendered code {
    background: #f1f3f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.file-viewer-rendered pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
}

.file-viewer-rendered pre code {
    background: none;
    padding: 0;
}

/* View mode toggle for markdown files */
.file-viewer-mode-toggle {
    display: flex;
    gap: 2px;
    background: #e9ecef;
    border-radius: 4px;
    padding: 2px;
}

.file-viewer-mode-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: #495057;
    transition: all 0.15s;
}

.file-viewer-mode-btn.active {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
