﻿/* ============================================================
   WIS RichText – Darkmode (W6 Extended)
   ------------------------------------------------------------
   Scope: nur im Dark/Contrast-Dark Theme
   - Toolbar dunkel + Buttons/Icons sichtbar
   - Dropdowns/Separatoren angepasst
   - Editorfläche dunkel + Text hell
   - Links/Selection/Placeholder passend
   ============================================================ */

/* ---------- TOKENS (optional feinjustieren) ---------- */
html[data-wiso-theme="dark"],
html[data-wiso-theme="contrast-dark"] {
    --w6rt-bg: #3f4350;
    --w6rt-bg2: #0f172a;
    --w6rt-surface: rgba(18,24,36,0.98);
    --w6rt-border: rgba(255,255,255,0.14);
    --w6rt-border2: rgba(255,255,255,0.10);
    --w6rt-text: rgba(235,242,255,0.92);
    --w6rt-muted: rgba(235,242,255,0.64);
    --w6rt-accent: rgba(120,180,255,0.98);
    --w6rt-hover: rgba(120,180,255,0.12);
    --w6rt-active: rgba(120,180,255,0.18);
}

    /* ============================================================
   ROOT / FRAME
   ============================================================ */

    html[data-wiso-theme="dark"] .WIS_richtext,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext {
        background: transparent;
        width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
        min-height: 200px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Äußerer Rahmen (falls Richtext in Card steckt) */
    html[data-wiso-theme="dark"] .WIS_richtext__overflow-wrapper,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__overflow-wrapper {
        background: var(--w6rt-bg) !important;
    }

    /* ============================================================
   TOOLBAR
   ============================================================ */
    html[data-wiso-theme="dark"] .WIS_richtext__toolbar-holder .WIS_toolbar,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__toolbar-holder .WIS_toolbar {
        background: var(--w6rt-surface) !important;
        border: 1px solid var(--w6rt-border) !important;
        box-shadow: none !important;
        border-radius: 10px;
    }

    /* Toolbar items / separators */
    html[data-wiso-theme="dark"] .WIS_toolbar__item--separator,
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar__item--separator {
        background: transparent !important;
        border-left: 1px solid var(--w6rt-border2) !important;
        opacity: 1 !important;
    }

    /* Buttons allgemein */
    html[data-wiso-theme="dark"] .WIS_toolbar .WIS_button,
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .WIS_button {
        color: var(--w6rt-text) !important;
    }

    /* Icon-Farbe (dxi) */
    html[data-wiso-theme="dark"] .WIS_toolbar .dxi,
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .dxi {
        color: var(--w6rt-text) !important;
        opacity: 0.92;
    }

    /* Hover */
    html[data-wiso-theme="dark"] .WIS_toolbar .WIS_button:hover,
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .WIS_button:hover {
        background: var(--w6rt-hover) !important;
        border-radius: 8px;
    }

    /* Active/Pressed */
    html[data-wiso-theme="dark"] .WIS_toolbar .WIS_button--active,
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .WIS_button--active {
        background: var(--w6rt-active) !important;
        border-radius: 8px;
    }

    /* Disabled */
    html[data-wiso-theme="dark"] .WIS_toolbar .WIS_button[disabled],
    html[data-wiso-theme="dark"] .WIS_toolbar .WIS_button[aria-disabled="true"],
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .WIS_button[disabled],
    html[data-wiso-theme="contrast-dark"] .WIS_toolbar .WIS_button[aria-disabled="true"] {
        opacity: 0.45 !important;
        background: transparent !important;
    }

    /* Dropdown Button Text + Chevron */
    html[data-wiso-theme="dark"] .WIS_richtext__dropdown .WIS_button__text,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__dropdown .WIS_button__text {
        color: var(--w6rt-text) !important;
    }

    html[data-wiso-theme="dark"] .WIS_richtext__dropdown .WIS_button__icon--menu,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__dropdown .WIS_button__icon--menu {
        color: var(--w6rt-muted) !important;
    }

    /* Farbindikatoren in Dark besser sichtbar */
    html[data-wiso-theme="dark"] .WIS_richtext__text-color,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__text-color {
        filter: brightness(1.2);
    }

    html[data-wiso-theme="dark"] .WIS_richtext__background-color,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__background-color {
        filter: brightness(1.2);
    }

    /* ============================================================
   EDITOR AREA
   ============================================================ */
    html[data-wiso-theme="dark"] .WIS_richtext__editor-holder,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor-holder {
        background: var(--w6rt-bg) !important;
        border: 1px solid var(--w6rt-border) !important;
        border-radius: 10px;
    }

    /* Editor selbst
   WICHTIG:
   Keine Textfarbe mit !important setzen, sonst kann der Benutzer
   die Schriftfarbe im Editor nicht mehr ändern.
*/
    html[data-wiso-theme="dark"] .WIS_richtext__editor,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor {
        background: transparent !important;
        caret-color: var(--w6rt-text) !important;
    }

        /* Nur leeren/ungefärbten Inhalt lesbar machen.
   Inline-Farben aus dem Editor bleiben dadurch erhalten. */
        html[data-wiso-theme="dark"] .WIS_richtext__editor:not([style*="color"]),
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor:not([style*="color"]) {
            color: var(--w6rt-text);
        }

        /* Keine Farb-Erzwingung auf p/span/div!
   Sonst überschreibst du Editor-Farbformatierungen. */
        html[data-wiso-theme="dark"] .WIS_richtext__editor p,
        html[data-wiso-theme="dark"] .WIS_richtext__editor span,
        html[data-wiso-theme="dark"] .WIS_richtext__editor div,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor p,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor span,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor div {
            color: inherit;
        }

        /* Links */
        html[data-wiso-theme="dark"] .WIS_richtext__editor a,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor a {
            color: var(--w6rt-accent) !important;
            text-decoration-color: color-mix(in srgb, var(--w6rt-accent) 55%, transparent);
        }

        /* Blockquote */
        html[data-wiso-theme="dark"] .WIS_richtext__editor blockquote,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor blockquote {
            border-left: 3px solid var(--w6rt-border) !important;
            margin-left: 0;
            padding-left: 12px;
            color: var(--w6rt-muted) !important;
        }

        /* Code / Pre (falls vorhanden) */
        html[data-wiso-theme="dark"] .WIS_richtext__editor code,
        html[data-wiso-theme="dark"] .WIS_richtext__editor pre,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor code,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor pre {
            background: rgba(255,255,255,0.06) !important;
            border: 1px solid var(--w6rt-border2) !important;
            border-radius: 8px;
            color: var(--w6rt-text) !important;
        }

        /* Selection */
        html[data-wiso-theme="dark"] .WIS_richtext__editor ::selection,
        html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor ::selection {
            background: color-mix(in srgb, var(--w6rt-accent) 35%, transparent) !important;
            color: var(--w6rt-text) !important;
        }

    /* Fokus-Ring (wenn editor fokussiert) */
    html[data-wiso-theme="dark"] .WIS_richtext__editor-holder:focus-within,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext__editor-holder:focus-within {
        border-color: color-mix(in srgb, var(--w6rt-accent) 55%, var(--w6rt-border)) !important;
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--w6rt-accent) 22%, transparent) !important;
    }

    html[data-wiso-theme="dark"] .WIS_richtext-editor,
    html[data-wiso-theme="contrast-dark"] .WIS_richtext-editor {
        border: none !important;
    }
    /* ============================================================
   OPTIONAL: Dropdown-Menüs / Popups (falls WIS Menüs nutzt)
   ------------------------------------------------------------
   Nur aktivieren, wenn deine Dropdowns im Dark sonst hell bleiben.
   (Selektoren ggf. anpassen, je nach Menü-Klassen in WIS)
   ============================================================ */
    /*
html[data-wiso-theme="dark"] .WIS_menu,
html[data-wiso-theme="contrast-dark"] .WIS_menu{
  background: var(--w6rt-surface) !important;
  border: 1px solid var(--w6rt-border) !important;
  color: var(--w6rt-text) !important;
}
html[data-wiso-theme="dark"] .WIS_menu-item:hover,
html[data-wiso-theme="contrast-dark"] .WIS_menu-item:hover{
  background: var(--w6rt-hover) !important;
}
*/
    /* ============================================================
   WIS RichText – Popup Menu Premium Dark / Contrast-Dark
   - Dark Popup
   - Active/Hover/Focus
   - Font-Vorschau
   - dezente Animation
   ============================================================ */

    html[data-wiso-theme="dark"] .WIS_menu,
    html[data-wiso-theme="contrast-dark"] .WIS_menu {
        background: linear-gradient( 180deg, rgba(18,24,36,0.98), rgba(12,18,28,0.98) ) !important;
        border: 1px solid var(--w6rt-border) !important;
        border-radius: 12px;
        box-shadow: 0 18px 42px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.06);
        backdrop-filter: blur(10px) saturate(120%);
        padding: 7px;
        color: var(--w6rt-text) !important;
        animation: w6rtMenuIn 0.14s ease-out;
        transform-origin: top left;
    }

/* Menü-Animation */
@keyframes w6rtMenuIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Menüzeilen */
html[data-wiso-theme="dark"] .WIS_menu-item,
html[data-wiso-theme="contrast-dark"] .WIS_menu-item {
    border-radius: 9px;
}

/* Menübutton */
html[data-wiso-theme="dark"] .WIS_menu-button,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button {
    width: 100%;
    min-height: 32px;
    background: transparent !important;
    color: var(--w6rt-text) !important;
    border-radius: 9px;
    padding: 7px 10px;
    transition: background 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

/* Linker Block sauber ausrichten */
html[data-wiso-theme="dark"] .WIS_menu-button__block--left,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button__block--left {
    display: flex;
    align-items: center;
    gap: 9px;
}

    /* Font-Vorschau-Punkt */
    html[data-wiso-theme="dark"] .WIS_menu-button__block--left::before,
    html[data-wiso-theme="contrast-dark"] .WIS_menu-button__block--left::before {
        content: "Aa";
        width: 28px;
        height: 22px;
        border-radius: 7px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 700;
        color: var(--w6rt-accent);
        background: rgba(120,180,255,0.10);
        border: 1px solid rgba(120,180,255,0.18);
    }

/* Text */
html[data-wiso-theme="dark"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button__text {
    color: var(--w6rt-text) !important;
    font-size: 13px;
}

/* Hover */
html[data-wiso-theme="dark"] .WIS_menu-button:hover,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button:hover {
    background: var(--w6rt-hover) !important;
    transform: translateX(1px);
}

/* Active */
html[data-wiso-theme="dark"] .WIS_menu-button--active,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button--active {
    background: var(--w6rt-active) !important;
    box-shadow: inset 0 0 0 1px rgba(120,180,255,0.20);
}

    /* Active Check rechts */
    html[data-wiso-theme="dark"] .WIS_menu-button--active::after,
    html[data-wiso-theme="contrast-dark"] .WIS_menu-button--active::after {
        content: "✓";
        margin-left: auto;
        color: var(--w6rt-accent);
        font-weight: 800;
    }

/* Fokus */
html[data-wiso-theme="dark"] .WIS_menu-button:focus,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--w6rt-accent) 45%, transparent);
}

/* Disabled */
html[data-wiso-theme="dark"] .WIS_menu-button[aria-disabled="true"],
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[aria-disabled="true"] {
    opacity: 0.42;
    pointer-events: none;
}

/* Separator */
html[data-wiso-theme="dark"] .WIS_menu-separator,
html[data-wiso-theme="contrast-dark"] .WIS_menu-separator {
    height: 1px;
    background: var(--w6rt-border2);
    margin: 7px 0;
}

/* Font-spezifische Vorschau */
html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Roboto"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Roboto"] .WIS_menu-button__text {
    font-family: Roboto, Arial, sans-serif;
}

html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Arial"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Arial"] .WIS_menu-button__text {
    font-family: Arial, sans-serif;
}

html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Georgia"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Georgia"] .WIS_menu-button__text {
    font-family: Georgia, serif;
}

html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Tahoma"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Tahoma"] .WIS_menu-button__text {
    font-family: Tahoma, sans-serif;
}

html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Times New Roman"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Times New Roman"] .WIS_menu-button__text {
    font-family: "Times New Roman", serif;
}

html[data-wiso-theme="dark"] .WIS_menu-button[wis_id="font-Verdana"] .WIS_menu-button__text,
html[data-wiso-theme="contrast-dark"] .WIS_menu-button[wis_id="font-Verdana"] .WIS_menu-button__text {
    font-family: Verdana, sans-serif;
}