/* PyWiki - Split-Panel Editor Styles */

.editor-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-height));
    overflow: hidden;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.editor-toolbar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.editor-toolbar input[type="text"] {
    flex: 1;
    max-width: 300px;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.editor-toolbar input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(44, 111, 173, 0.2);
}

.editor-toolbar button {
    padding: 0.4rem 1rem;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.editor-toolbar button:hover {
    background: var(--color-primary-dark);
}

.editor-toolbar button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.editor-status {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* Split panels */
.editor-panels {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.editor-panel + .editor-panel {
    border-left: 2px solid var(--color-border);
}

.panel-header {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Editor textarea */
#editor-input {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-surface);
    overflow-y: auto;
}

#editor-input::placeholder {
    color: var(--color-text-muted);
}

/* Preview panel */
#editor-preview {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: var(--color-surface);
}

#editor-preview .editor-placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

/* Reuse page-body styles in preview */
#editor-preview h1,
#editor-preview h2,
#editor-preview h3,
#editor-preview h4,
#editor-preview h5,
#editor-preview h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

#editor-preview h1 { font-size: 1.75rem; }
#editor-preview h2 {
    font-size: 1.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--color-border);
}
#editor-preview h3 { font-size: 1.2rem; }

#editor-preview p {
    margin: 0 0 0.8em;
}

#editor-preview ul,
#editor-preview ol {
    margin: 0 0 0.8em;
    padding-left: 1.5em;
}

#editor-preview blockquote {
    margin: 0 0 0.8em;
    padding: 0.5em 1em;
    border-left: 4px solid var(--color-primary);
    background: var(--color-code-bg);
    color: var(--color-text-muted);
}

#editor-preview code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    background: var(--color-code-bg);
    border-radius: 3px;
}

#editor-preview pre {
    margin: 0 0 0.8em;
    padding: 1rem;
    background: var(--color-code-bg);
    border-radius: 6px;
    overflow-x: auto;
}

#editor-preview pre code {
    padding: 0;
    background: none;
}

#editor-preview pre.mermaid {
    background: transparent;
    text-align: center;
    padding: 1rem 0;
}

#editor-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 0.8em;
}

#editor-preview th,
#editor-preview td {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

#editor-preview th {
    background: var(--color-code-bg);
    font-weight: 600;
}

#editor-preview img {
    max-width: 100%;
    height: auto;
}

#editor-preview hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5em 0;
}

/* Responsive: stack panels on narrow screens */
@media (max-width: 768px) {
    .editor-panels {
        flex-direction: column;
    }

    .editor-panel + .editor-panel {
        border-left: none;
        border-top: 2px solid var(--color-border);
    }

    .editor-panel {
        flex: none;
        height: 50%;
    }
}


/* Drag and drop state */
#editor-input.drag-over {
    background: var(--color-code-bg);
    border: 2px dashed var(--color-primary);
}

/* Toolbar button variants */
.editor-toolbar button + button {
    margin-left: 0.25rem;
}

#editor-delete {
    background: transparent;
    color: #d13212;
    border: 1px solid #d13212;
}

#editor-delete:hover {
    background: #d13212;
    color: #ffffff;
}

#editor-rename {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

#editor-rename:hover {
    background: var(--color-primary);
    color: #ffffff;
}

#editor-upload {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

#editor-upload:hover {
    background: var(--color-bg);
    color: var(--color-text);
}


/* Tags bar */
.editor-tags-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.editor-tags-bar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.editor-tags-bar input[type="text"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.8rem;
    min-width: 120px;
}

.editor-tags-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.tags-list {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    align-items: center;
}

.tags-empty {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
}
