/*
 * TipTap Rich-Text-Editor — FIN-Standard-Editor (Port aus FlowDesk, Niko 05.06.2026):
 * Notizen, E-Mail-Client, später Dokumente. Klassen aus tiptap-interop.js
 * (.tiptap-toolbar/.tt-*/.tiptap-content), Farben ausschließlich --fn-*-Tokens.
 */

.fn-richtext {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    border: var(--fn-border-width) solid var(--fn-input-border);
    border-radius: var(--fn-radius-sm);
    background: var(--fn-input-bg);
    overflow: hidden;
}

.fn-richtext:focus-within { box-shadow: var(--fn-focus-ring); }

.tiptap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: var(--fn-border-width) solid var(--fn-border);
    background: var(--fn-bg-muted);
    flex: 0 0 auto;
}

.tt-group { display: inline-flex; gap: 3px; align-items: center; }
.tt-group + .tt-group { padding-left: 6px; border-left: var(--fn-border-width) solid var(--fn-border); }

.tt-btn {
    min-width: 26px; height: 26px; padding: 0 6px;
    background: transparent; border: var(--fn-border-width) solid transparent;
    border-radius: 6px; color: var(--fn-text-secondary); cursor: pointer;
    font-family: var(--fn-font); font-size: 12.5px;
    transition: background .14s, color .14s, border-color .14s;
}
.tt-btn:hover { background: var(--fn-bg-alt); color: var(--fn-text); border-color: var(--fn-border); }
.tt-btn.active { color: var(--fn-primary); border-color: var(--fn-accent-line); background: var(--fn-accent-soft); }

.tt-select {
    height: 26px; background: var(--fn-input-bg);
    border: var(--fn-border-width) solid var(--fn-border); border-radius: 6px;
    color: var(--fn-text); font-family: var(--fn-font); font-size: 12px; padding: 0 6px;
}

.tt-color {
    width: 26px; height: 26px; padding: 2px;
    background: var(--fn-input-bg); border: var(--fn-border-width) solid var(--fn-border);
    border-radius: 6px; cursor: pointer;
}

.tiptap-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    color: var(--fn-text);
    font-family: var(--fn-font);
    font-size: 13px;
    line-height: 1.6;
}

.tiptap-content .ProseMirror { outline: none; min-height: 100%; }
.tiptap-content .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: var(--fn-text-tertiary);
    float: left; height: 0; pointer-events: none;
}
.tiptap-content a { color: var(--fn-primary); }
.tiptap-content h1, .tiptap-content h2, .tiptap-content h3 { margin: 10px 0 6px; }
.tiptap-content ul, .tiptap-content ol { padding-left: 22px; }

.tiptap-readonly .tiptap-content { color: var(--fn-text-secondary); }

/* Shared reading measure for user-authored notes. The editor remains the same component and keeps
   every toolbar capability; only note documents receive the calmer long-form typography. */
.fn-richtext.fn-note-richtext .tiptap-content {
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.7;
}

.fn-richtext.fn-note-richtext .ProseMirror {
    width: 100%;
    max-width: 72ch;
    margin-inline: auto;
}

.fn-richtext.fn-note-richtext .ProseMirror p,
.fn-richtext.fn-note-richtext .ProseMirror h1,
.fn-richtext.fn-note-richtext .ProseMirror h2,
.fn-richtext.fn-note-richtext .ProseMirror h3,
.fn-richtext.fn-note-richtext .ProseMirror ul,
.fn-richtext.fn-note-richtext .ProseMirror ol {
    margin-block: 0 0.9em;
}

.fn-richtext.fn-note-richtext .ProseMirror h1,
.fn-richtext.fn-note-richtext .ProseMirror h2,
.fn-richtext.fn-note-richtext .ProseMirror h3 {
    color: var(--fn-text);
    line-height: 1.35;
}

.fn-richtext.fn-note-richtext .ProseMirror h3 {
    margin-top: 1.4em;
    font-size: 15px;
    font-weight: var(--fn-font-weight-bold);
}

.fn-richtext.fn-note-richtext .ProseMirror li + li { margin-top: 0.45em; }
.fn-richtext.fn-note-richtext .ProseMirror strong { color: var(--fn-text); }
.fn-richtext.fn-note-richtext .ProseMirror a {
    text-decoration: underline;
    text-underline-offset: 2px;
}
