/* mydc – Ticket-Editor (Toast UI). Nur auf Ticketseiten geladen.
 *
 * Farben als Variablen, Werte gemessen an Lagom (Eingabefeld, Knöpfe, Menüs)
 * hell und dunkel. Der Admin-Dunkelmodus (MydcAdminTheme, html.mydc-dark) nutzt
 * dieselbe Palette. Alles ist unter .mydc-te .toastui-editor-defaultUI
 * geschachtelt, damit es Toast UIs eigenes Hell/Dunkel sicher überstimmt.
 */

.mydc-te-hidden {
    display: none !important;
}

.mydc-te {
    position: relative;
    --te-bg: #fff;
    --te-bar: #f7f8fa;
    --te-border: #dee0e3;
    --te-line: #ebedf0;
    --te-text: #17191c;
    --te-soft: #5e636e;
    --te-muted: #979ba4;
    --te-hover: #eceef1;
    --te-pop: #fff;
    --te-pop-border: #dee0e3;
    --te-input: #fff;
    --te-code: #f2f3f5;
    --te-accent: #27b5c4;
    --te-accent-hover: #229fac;
    --te-shadow: 0 6px 24px rgba(23, 25, 28, .12);
}

html.lagom-dark-mode .mydc-te,
html.mydc-dark .mydc-te {
    --te-bg: #242424;
    --te-bar: #2b2b2b;
    --te-border: #424242;
    --te-line: #363636;
    --te-text: #e0e0e0;
    --te-soft: #b3b3b3;
    --te-muted: #8c8c8c;
    --te-hover: #383838;
    --te-pop: #2b2b2b;
    --te-pop-border: #424242;
    --te-input: #1e1e1e;
    --te-code: #1b1b1b;
    --te-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}

/* ---- Rahmen, Leisten ---- */

.mydc-te .toastui-editor-defaultUI {
    font-family: inherit;
    border: 1px solid var(--te-border);
    border-radius: 3px;
    background-color: var(--te-bg);
    color: var(--te-text);
    transition: border-color .15s;
}

.mydc-te.is-focused .toastui-editor-defaultUI,
.mydc-te.is-dragover .toastui-editor-defaultUI {
    border-color: var(--te-accent);
}

.mydc-te.is-dragover .toastui-editor-defaultUI {
    border-style: dashed;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-defaultUI-toolbar {
    background-color: var(--te-bar);
    border-bottom: 1px solid var(--te-line);
    border-radius: 3px 3px 0 0;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-toolbar-icons {
    border-color: transparent;
    border-radius: 3px;
    /* Symbole kommen aus einer Bildleiste; unter dem durchsichtigen Rand
       schiene sonst der Rand des Nachbarsymbols durch (Pünktchen). */
    background-clip: padding-box;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-toolbar-icons:not(:disabled):hover,
.mydc-te .toastui-editor-defaultUI .toastui-editor-toolbar-icons.active {
    background-color: var(--te-hover);
    border-color: var(--te-hover);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-toolbar-divider {
    background-color: var(--te-line);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-md-container,
.mydc-te .toastui-editor-defaultUI .toastui-editor-ww-container,
.mydc-te .toastui-editor-defaultUI .toastui-editor-md-preview {
    background-color: var(--te-bg);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-md-splitter {
    background-color: var(--te-line);
}

/* Reiter unten (Markdown | WYSIWYG) und oben im Markdown-Modus (Verfassen | Vorschau) */
.mydc-te .toastui-editor-defaultUI .toastui-editor-mode-switch {
    background-color: var(--te-bar);
    border-top: 1px solid var(--te-line);
    border-radius: 0 0 3px 3px;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-md-tab-container {
    background-color: var(--te-bar);
    border-bottom: 1px solid var(--te-line);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-mode-switch .tab-item,
.mydc-te .toastui-editor-defaultUI .toastui-editor-md-tab-container .tab-item {
    background-color: transparent;
    border-color: var(--te-line);
    color: var(--te-muted);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-mode-switch .tab-item:hover,
.mydc-te .toastui-editor-defaultUI .toastui-editor-md-tab-container .tab-item:hover {
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-mode-switch .tab-item.active {
    background-color: var(--te-bg);
    border-top-color: var(--te-bg);
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-md-tab-container .tab-item.active {
    background-color: var(--te-bg);
    border-bottom-color: var(--te-bg);
    color: var(--te-text);
}

/* ---- Schreibfläche: ganze Fläche klickbar ---- */

.mydc-te .toastui-editor-defaultUI .toastui-editor-main .toastui-editor {
    display: flex;
    flex-direction: column;
    cursor: text;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-main .toastui-editor > .ProseMirror {
    flex: 1 1 auto;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents,
.mydc-te .toastui-editor-defaultUI .toastui-editor-md-container .toastui-editor {
    font-family: inherit;
    font-size: 14px;
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents p {
    margin: 0;
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h1,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h2,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h3,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h4,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h5,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h6 {
    color: var(--te-text);
    border-color: var(--te-line);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents-placeholder::before {
    color: var(--te-muted);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents a {
    color: var(--te-accent);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents code {
    background-color: var(--te-code);
    color: var(--te-soft);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents pre {
    background-color: var(--te-code);
}

/* Zitat: ruhiger Balken links. Lagom stylt blockquote global als Karte mit
   Symbol (::before) – im Eingabefeld zu wuchtig, darum hier zurückgesetzt. */
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote {
    margin: 8px 0;
    padding: 2px 0 2px 14px;
    background: none;
    border: 0;
    border-left: 3px solid var(--te-border);
    border-radius: 0;
    box-shadow: none;
    font-size: inherit;
    font-weight: inherit;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote::before,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote::after,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote p::before,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote p::after {
    content: none;
    display: none;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents blockquote p {
    color: var(--te-soft);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents hr {
    border-top-color: var(--te-border);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents table th,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents table td {
    border-color: var(--te-border);
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents table th {
    background-color: var(--te-bar);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents ul > li::before {
    background-color: var(--te-muted);
}

/* ---- Menüs (Überschrift, Link, Tabelle, "mehr") ---- */

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup,
.mydc-te .toastui-editor-defaultUI .toastui-editor-dropdown-toolbar {
    background-color: var(--te-pop);
    border: 1px solid var(--te-pop-border);
    border-radius: 4px;
    box-shadow: var(--te-shadow);
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-body label {
    color: var(--te-soft);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-body input[type=text] {
    background-color: var(--te-input);
    border: 1px solid var(--te-border);
    border-radius: 3px;
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-body input[type=text]:focus {
    border-color: var(--te-accent);
    outline: 0;
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-ok-button {
    background-color: var(--te-accent);
    color: #fff;
    border: 0;
    border-radius: 3px;
    outline-color: var(--te-accent);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-ok-button:hover {
    background-color: var(--te-accent-hover);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-close-button {
    background-color: transparent;
    border: 1px solid var(--te-border);
    border-radius: 3px;
    color: var(--te-text);
    outline-color: var(--te-border);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-close-button:hover {
    border-color: var(--te-muted);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading ul li {
    color: var(--te-text);
}

/* Überschriften im Menü einheitlich (sonst greifen Lagoms h1–h6-Gewichte) */
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h1,
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h2,
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h3,
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h4,
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h5,
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h6 {
    font-family: inherit;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--te-text);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h1 { font-size: 22px; }
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h2 { font-size: 19px; }
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h3 { font-size: 17px; }
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h4 { font-size: 15px; }
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h5 { font-size: 14px; }
.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading h6 { font-size: 13px; }

.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h1,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h2,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h3,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h4,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h5,
.mydc-te .toastui-editor-defaultUI .toastui-editor-contents h6 {
    font-family: inherit;
    font-weight: 600;
}

.mydc-te .toastui-editor-defaultUI table.ProseMirror-selectednode,
.mydc-te .toastui-editor-defaultUI .html-block.ProseMirror-selectednode {
    outline-color: var(--te-accent);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-heading ul li:hover {
    background-color: var(--te-hover);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-table .toastui-editor-table-cell {
    background-color: var(--te-bg);
    border-color: var(--te-line);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-table .toastui-editor-table-cell.header {
    background-color: var(--te-bar);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-table .toastui-editor-table-selection-layer {
    border-color: var(--te-accent);
    background-color: rgba(39, 181, 196, .15);
}

.mydc-te .toastui-editor-defaultUI .toastui-editor-popup-add-table .toastui-editor-table-description {
    color: var(--te-muted);
}

/* ---- unter dem Editor ---- */

/* Statuszeile aus bootstrap-markdown ("Entwurf gespeichert") */
.mydc-te .mydc-te-status {
    border: 0;
    background: none;
    padding: 4px 2px 0;
    font-size: 12px;
    color: var(--te-muted);
}

.mydc-te-note {
    font-size: 12px;
    line-height: 1.4;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity .2s, max-height .2s;
    color: #2e8b57;
}

.mydc-te-note.is-visible {
    max-height: 60px;
    opacity: 1;
    padding-top: 6px;
}

.mydc-te-note.is-error {
    color: #c0392b;
}

html.lagom-dark-mode .mydc-te-note:not(.is-error),
html.mydc-dark .mydc-te-note:not(.is-error) {
    color: #5fd38d;
}

html.lagom-dark-mode .mydc-te-note.is-error,
html.mydc-dark .mydc-te-note.is-error {
    color: #ff7b6b;
}

/* Admin: Abstand wie das ersetzte Textfeld (bottom-margin-10) */
.mydc-te--admin {
    margin-bottom: 10px;
}

/* ---- Ticketansicht (ticket-view.js): Bilder ---- */

.mydc-ti-inline {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 8px 0;
    cursor: zoom-in;
}

.mydc-ti-inline img {
    display: block;
    max-width: 100%;
    max-height: 480px;
    height: auto;
    border: 1px solid rgba(127, 127, 127, .25);
    border-radius: 6px;
}

.ticket-reply-attachments a.mydc-ti-has-thumb {
    cursor: zoom-in;
}

/* füllt die Symbolfläche der Lagom-Kachel, ganzes Bild ohne Beschnitt */
.mydc-ti-thumb {
    display: block;
    width: 100%;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px 4px 0 0;
}

.mydc-ti-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 16px;
    background: rgba(0, 0, 0, .85);
    cursor: zoom-out;
}

.mydc-ti-overlay.is-open {
    display: flex;
}

.mydc-ti-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
}

.mydc-ti-overlay__bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    color: #eee;
    font-size: 14px;
}

.mydc-ti-overlay__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mydc-ti-overlay__dl,
.mydc-ti-overlay__dl:hover,
.mydc-ti-overlay__dl:focus {
    color: #27b5c4;
    cursor: pointer;
}

.mydc-ti-overlay__close {
    border: 0;
    background: none;
    color: #eee;
    font-size: 28px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}

/* ---- Ticketansicht: Codeblöcke + Kopieren ---- */

.ticket-reply-message pre,
.msgwrap > .message pre {
    position: relative;
    margin: 8px 0 12px;
    padding: 12px 48px 12px 14px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
}

/* Admin (blend) bringt für pre kaum Stil mit */
.msgwrap > .message pre {
    background: #f5f6f8;
    border: 1px solid #e1e3e6;
    border-radius: 4px;
    color: #333;
}

html.mydc-dark .msgwrap > .message pre {
    background: #1b1b1b;
    border-color: #363636;
    color: #e0e0e0;
}

.ticket-reply-message pre code,
.msgwrap > .message pre code {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    white-space: inherit;
}

/* Inline-Code: Lagom setzt im Dunkelmodus eine helle Fläche */
html.lagom-dark-mode .ticket-reply-message :not(pre) > code,
html.mydc-dark .msgwrap > .message :not(pre) > code {
    background: rgba(255, 255, 255, .08);
    color: #ff8fa3;
}

.mydc-tv-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    min-width: 28px;
    padding: 0 7px;
    border: 1px solid #dee0e3;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
    color: #5e636e;
    font-family: Roboto, -apple-system, "Segoe UI", sans-serif;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: .75;
    transition: opacity .15s, color .15s, border-color .15s;
}

.mydc-tv-code:hover .mydc-tv-copy,
.mydc-tv-copy:focus,
.mydc-tv-copy.is-done {
    opacity: 1;
}

.mydc-tv-copy:hover,
.mydc-tv-copy:focus {
    color: #27b5c4;
    border-color: #27b5c4;
    outline: 0;
}

.mydc-tv-copy.is-done {
    color: #2e8b57;
    border-color: #2e8b57;
}

.mydc-tv-copy__label:empty {
    display: none;
}

html.lagom-dark-mode .mydc-tv-copy,
html.mydc-dark .mydc-tv-copy {
    background: rgba(36, 36, 36, .92);
    border-color: #424242;
    color: #b3b3b3;
}

html.lagom-dark-mode .mydc-tv-copy.is-done,
html.mydc-dark .mydc-tv-copy.is-done {
    color: #5fd38d;
    border-color: #5fd38d;
}
