/* Rich text box (assets/js/rich-editor.js): the editable text and the floating format toolbar */
.re-content {
    min-height: 100%;
    outline: none;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* Paragraphs keep the gap they have once sent (.tv-msg-body) */
.re-content :is(p, ul, ol, blockquote, pre) { margin: 0; }
.re-content :is(p, ul, ol, blockquote, pre) + * { margin-top: 0.5em; }
.re-content :is(ul, ol) { padding-left: 1.4em; }
.re-content li > p + * { margin-top: 0; }
.re-content li + li { margin-top: 0.15em; }

.re-content blockquote {
    padding-left: 0.75em;
    border-left: 3px solid var(--c-border-strong);
    color: var(--c-text-body);
}

.re-content code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgb(var(--c-text-rgb) / 0.07);
    font-size: 0.875em;
}

.re-content pre {
    margin-bottom: 0;
    padding: 0.6em 0.8em;
    border-radius: 6px;
    background: rgb(var(--c-text-rgb) / 0.07);
    white-space: pre-wrap;
}

.re-content pre code { padding: 0; background: none; }
.re-content a { color: var(--c-primary); text-decoration: underline; cursor: text; }

.re-content p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    color: var(--c-text-muted);
    opacity: 0.8;
    pointer-events: none;
}

/* Floating toolbar over selected text; Tiptap positions it and shows/hides it */
.re-bubble {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000; /* above the ticket composer and the new-ticket modal */
    display: flex;
    width: max-content; /* Tiptap measures it before placing it; full width would push it off to the side */
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgb(var(--c-shadow-rgb) / 0.14);
}

.re-bubble button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--c-text-body);
    cursor: pointer;
}

.re-bubble button:hover { background: var(--c-surface-subtle); color: var(--c-text); }
.re-bubble button.is-active { background: rgb(var(--c-text-rgb) / 0.09); color: var(--c-text); }
.re-bubble button:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -2px; }
.re-bubble [hidden] { display: none; }

.re-link { display: flex; align-items: center; gap: 2px; margin: 0; }

.re-link input {
    width: 240px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface-subtle);
    color: var(--c-text);
    font-size: 0.875rem;
    outline: none;
}

.re-link input:focus { border-color: var(--c-primary); }

@media (max-width: 575.98px) {
    .re-link input { width: 180px; }
}
