/* Partial: _file-viewer.css.j2 — Unified file viewer panel + source lines (both modes) */

/* --- File Viewer Panel (Right) --- */

.file-viewer-panel {
    width: 0;
    min-width: 0;
    display: none;
    flex-direction: column;
    background: white;
    border-left: 1px solid #e9ecef;
    overflow: hidden;
}

.file-viewer-panel.open {
    display: flex;
    width: 40%;
    min-width: 300px;
    max-width: 60%;
}

.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-close-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #6c757d;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

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

.fv-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.fv-status.on-disk {
    background: #d1fae5;
    color: #065f46;
}

.fv-status.has-mutations {
    background: #fef3c7;
    color: #92400e;
}

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

.file-viewer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #adb5bd;
    font-size: 0.85rem;
}

/* Source line display (matches trace_view pattern) */
.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;
}

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

/* VS Code link + generic header buttons */
.file-viewer-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    color: #495057;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.15s;
    flex-shrink: 0;
}

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

/* View mode toggle (Rendered / Source) */
.file-viewer-mode-toggle {
    display: flex;
    gap: 2px;
    background: #e9ecef;
    border-radius: 4px;
    padding: 2px;
    flex-shrink: 0;
}

.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);
}

/* Rendered markdown line content */
.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;
}

.line-content.rendered-line li {
    list-style-position: inside;
}

/* Pygments syntax highlighting container */
.line-content.highlight {
    white-space: pre-wrap;
}

.line-num {
    display: table-cell;
    width: 1px;
    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;
}
