/* retoor <retoor@molodetz.nl> */

.pf-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 2rem);
    min-height: 480px;
}

.pf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.pf-toolbar .btn {
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.pf-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pf-toolbar .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.pf-status {
    font-size: 0.8125rem;
    color: var(--accent);
    min-width: 4rem;
}

.pf-body {
    display: flex;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}

.pf-tree {
    width: 280px;
    flex-shrink: 0;
    overflow: auto;
    padding: 0.5rem;
    border-right: 1px solid var(--border);
    background: var(--bg-card-hover);
}

.pf-tree-empty {
    padding: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pf-tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pf-children {
    padding-left: 1rem;
}

.pf-node.collapsed > .pf-children {
    display: none;
}

.pf-node-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
}

.pf-node-row:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.pf-node-row.active {
    background: var(--accent);
    color: var(--on-accent);
}

.pf-node-row.pf-selected {
    background: var(--accent-light);
    color: var(--text-primary);
}

.pf-node-row.pf-selected.active {
    background: var(--accent);
    color: var(--on-accent);
}

.pf-node-row.pf-dragging {
    opacity: 0.5;
}

.pf-node-row.pf-dragover {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    background: var(--accent-light);
}

.pf-tree.pf-root-drop {
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
}

.pf-root-row {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.pf-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pf-editor-wrap[hidden],
.pf-preview[hidden],
.pf-empty[hidden],
.pf-current[hidden] {
    display: none;
}

.pf-current {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: monospace;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    min-height: 1.25rem;
}

.pf-editor-wrap {
    flex: 1;
    min-height: 0;
}

.pf-editor-wrap .CodeMirror {
    height: 100%;
    font-size: 0.9rem;
}

.pf-preview {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.pf-preview img,
.pf-preview video {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
}

.pf-download {
    color: var(--accent);
    font-size: 0.9375rem;
}

.pf-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 1rem;
    text-align: center;
}

.pf-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pf-empty-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.pf-empty-msg {
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .pf-tree {
        width: 180px;
    }
}

.pf-readonly-banner {
    margin: 0.75rem 0;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 0.85rem;
}
