.ProsemirrorEditor.fullscreen {
    height: calc(100vh - 3px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 9998;

    .ProseMirror-menubar-wrapper {
        height: 100%;
    }

    .humhub-ui-richtext {
        max-height: none !important;
    }

    .ProseMirror {
        height: calc(100% - 26px);
        position: static;
        overflow: auto;
    }

    .ProseMirror-menubar {
        position: static !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
}

.login-container, .modal-dialog {
    .ProsemirrorEditor.fullscreen {
        width: 100%;
        height: 100%;
    }
}

/**
 * Menu defaults
 */
.ProsemirrorEditor {
    .ProseMirror {
        padding-right: 12px;
        &.form-control {
            font-size: inherit;
        }
    }

    .ProseMirror-menu {
        margin: 0 -4px;
        line-height: 1;
    }

    .ProseMirror-tooltip .ProseMirror-menu {
        width: fit-content;
        white-space: pre;
    }

    .ProseMirror-menuitem {
        display: flex;
        margin-right: 0;
    }

    .ProseMirror-menuseparator {
        border-right: 1px solid @background3;
        margin-right: 1px;
    }

    .ProseMirror-menubar-wrapper {
        z-index: 200;
    }

    .ProseMirror-menu-group {
        display: flex;
        flex-wrap: wrap;
        min-height: 22px;
    }

    .ProseMirror-menuitem {
        .ProseMirror-menu-group {
            border-right: 1px solid @background3;
        }

        .ProseMirror-menu-group.last {
            border-right: none;
        }

        .ProseMirror-icon {
            background: transparent;
        }

        .seperator {
            border-right: 1px solid @background3;
            border-radius: 0;
        }
    }

    .ProseMirror-menu-dropdown, .ProseMirror-menu-dropdown-menu {
        white-space: nowrap;
        @media (max-width: 400px) {
            white-space: normal !important;
        }
        @media (max-width: 768px) {
            small {
                white-space: normal;
            }
        }
    }

    .ProseMirror-menu-dropdown {
        cursor: pointer;
        position: relative;
        padding-right: 14px !important;
    }

    .ProseMirror-menu-dropdown-wrap {
        padding: 0;
        display: inline-block;
        position: relative;
    }

    .ProseMirror-menu-dropdown:after {
        content: "";
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 4px solid currentColor;
        opacity: .6;
        position: absolute;
        right: 4px;
        top: calc(50% - 2px);
    }

    .ProseMirror-menu-dropdown-menu, .ProseMirror-menu-submenu {
        background: @background-color-main;
        border: 1px solid @text-color-soft2;
        border-bottom-left-radius: 4px;
        border-bottom-right-radius: 4px;
        color: @text-color-highlight;
        position: absolute;

        .ProseMirror-menu-active {
            background: @background-color-secondary;
            border-left: 2px solid @info;
            opacity: 1 !important;
            padding: 4px 7px 4px 5px;
        }
    }

    .ProseMirror-menu-dropdown-menu {
        margin-top: 2px;
        min-width: 6em;
        z-index: 15;
    }

    .ProseMirror-menu-dropdown-item {
        cursor: pointer;
    }

    .ProseMirror-menu-dropdown-item div[title],
    .ProseMirror-menu-dropdown-item a.ProseMirror-menu-trigger,
    .ProseMirror-menu-submenu-wrap {
        display: block;
        padding: 4px 7px;
    }

    .ProseMirror-menu-dropdown-item:hover {
        background: @background-color-secondary;
    }

    .ProseMirror-menu-submenu-wrap {
        position: relative;
    }

    .ProseMirror-menu-submenu-label:after {
        border-top: 4px solid transparent;
        border-bottom: 4px solid transparent;
        border-left: 4px solid currentColor;
        content: "";
        opacity: .6;
        position: absolute;
        right: 4px;
        top: calc(50% - 4px);
    }

    .ProseMirror-menu-submenu {
        background: @background-color-main;
        border-top-right-radius: 4px;
        display: none;
        min-width: 4em;
        left: 100%;
        top: 0;
    }

    .ProseMirror-menu-disabled {
        opacity: .5;
    }

    .ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu,
    .ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu {
        display: block;
    }

    .ProseMirror-icon {
        border: 1px solid transparent;
        border-radius: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
        padding: 0 5px;

        &.ProseMirror-menu-active {
            border-color: @text-color-soft3;
        }

        &.ProseMirror-menu-tableOption,
        &.ProseMirror-menu-insertEmoji {
            svg {
                padding-top: 1px;
                padding-left: 1px;
            }
        }
    }

    .ProseMirror-menu-disabled.ProseMirror-icon {
        cursor: default;
    }

    .ProseMirror-icon svg {
        fill: currentColor;
        height: 20px;
    }

    .ProseMirror-icon span {
        vertical-align: text-top;
    }

    .ProseMirror-editor-source {
        border: 2px solid @background-color-page;
        border-radius: 0 4px 4px 4px;
        box-sizing: border-box;
        display: block;
        min-height: 36px;
        resize: none;
        overflow: auto;
        outline: none;
        padding: 7px 12px;
        width: 100%;
    }

    .ProseMirror-editor-source:focus {
        border: 2px solid @info;
    }
}

/**
 * Static plain editor style
 */
.ProsemirrorEditor.plainMenu {
    .ProseMirror {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-top-width: 1px !important;
        min-height: 100px;
    }

    .ProseMirror-menu-group,
    .ProseMirror-menuitem .ProseMirror-menu-group {
        padding: 2px;
    }

    .ProseMirror-menubar ~ .ProseMirror-focused {
        border-color: @info !important;
    }

    .ProseMirror-textblock-dropdown {
        min-width: 3em;
    }

    .ProseMirror-menubar-wrapper {
        z-index: 8;
    }

    .ProseMirror-menubar {
        background: white;
        border: 1px solid @background3;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        box-sizing: border-box;
        color: @text-color-soft;
        position: relative;
        min-height: 1em;
        overflow: visible;
        padding: 2px 0;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }
}

/**
 * Editor style attached at the top of input only visible on focus
 */
.ProsemirrorEditor.focusMenu {
    .form-control:focus {
        border-top-left-radius: 0 !important;
    }

    .ProseMirror-menubar {
        background: white;
        border: 1px solid @text-color-soft2;
        border-bottom: 0;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        box-sizing: border-box;
        color: @text-color-soft;
        float: left;
        margin-top: -27px;
        min-height: 1em;
        overflow: visible;
        padding: 2px 0;
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }
}

.ProsemirrorEditor {
    .ProseMirror {
        position: relative;
        word-wrap: break-word;
        white-space: pre-wrap;
        font-variant-ligatures: none;
    }

    .ProseMirror ul, .ProseMirror ol {
        cursor: default;
    }

    .ProseMirror pre {
        white-space: pre-wrap;
    }

    .ProseMirror li {
        position: relative;
    }

    .ProseMirror img {
        max-width: 100%;
    }

    .ProseMirror-hideselection *::selection {
        background: transparent;
    }

    .ProseMirror-selectednode {
        outline: 2px dashed lighten(@info, 30%);
    }

    /* Make sure li selections wrap around markers */

    li.ProseMirror-selectednode {
        outline: none;
    }

    li.ProseMirror-selectednode:after {
        content: "";
        position: absolute;
        left: -32px;
        right: -2px;
        top: -2px;
        bottom: -2px;
        border: 2px solid lighten(@info, 30%);
        pointer-events: none;
    }

    .ProseMirror-textblock-dropdown {
        min-width: 3em;
    }

    .ProseMirror-menu {
        margin: 0 -4px;
        line-height: 1;
    }

    .ProseMirror-tooltip .ProseMirror-menu {
        width: fit-content;
        white-space: pre;
    }

    .ProseMirror-gapcursor {
        display: none;
        pointer-events: none;
        position: absolute;
    }

    .ProseMirror-gapcursor:after {
        content: "";
        display: block;
        position: absolute;
        top: -2px;
        width: 20px;
        border-top: 1px solid black;
        animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
    }

    @keyframes ProseMirror-cursor-blink {
        to {
            visibility: hidden;
        }
    }

    .ProseMirror-focused .ProseMirror-gapcursor {
        display: block;
    }

    /* Add space around the hr to make clicking it easier */

    .ProseMirror-example-setup-style hr {
        padding: 2px 10px;
        border: none;
        margin: 1em 0;
    }

    .ProseMirror-example-setup-style hr:after {
        content: "";
        display: block;
        height: 1px;
        background-color: silver;
        line-height: 2px;
    }

    .ProseMirror-example-setup-style img {
        cursor: default;
    }

    .ProseMirror p {
        margin-top: 1.2em;
    }

    // Prevent first paragraph to stetch the input
    // Note: this is also applied for li p
    .ProseMirror p:first-child {
        margin: 0;
    }

    // Make sure next block after first child does have a margin
    .ProseMirror > p:first-child + * {
        margin-top: 1.2em;
    }

    .ProsemirrorEditor {
        position: relative;

        .ProseMirror {
            padding-right: 12px !important;
        }
    }

    .ProsemirrorEditor img {
        max-width: 100%;
    }

    .ProseMirror h1:first-child,
    .ProseMirror h2:first-child,
    .ProseMirror h3:first-child,
    .ProseMirror h4:first-child,
    .ProseMirror h5:first-child,
    .ProseMirror h6:first-child {
        margin-top: 10px;
    }

    .ProseMirror [data-mention] {
        color: @link;
    }

    .ProseMirror {
        outline: none;
    }

    .ProseMirror [data-oembed] {
        font-size: 0;
    }

    .ProseMirror iframe {
        pointer-events: none;
        display: block;
    }

    .ProseMirror p {
        margin-bottom: 1em;
    }

    .ProseMirror-textblock-dropdown {
        min-width: 3em;
    }

    .ProseMirror .placeholder {
        padding: 0 !important;
        pointer-events: none;
        height: 0;
    }

    .ProseMirror:focus .placeholder {
        display: none;
    }

    .ProseMirror .tableWrapper {
        overflow-x: auto;
    }

    .ProseMirror .column-resize-handle {
        background-color: lighten(@info, 40%);
        pointer-events: none;
        position: absolute;
        right: -2px;
        top: 0;
        bottom: 0;
        width: 4px;
        z-index: 20;
    }

    .ProseMirror.resize-cursor {
        cursor: ew-resize;
        cursor: col-resize;
    }

    /* Give selected cells a blue overlay */
    .ProseMirror .selectedCell:after {
        background: rgba(200, 255, 255, 0.4);
        content: "";
        pointer-events: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 2;
    }

    .ProseMirror-menubar-wrapper {
        position: relative;
        outline: none;
    }

    .ProseMirror table {
        margin: 0;
    }

    .ProseMirror .tableWrapper {
        margin: 1em 0;
    }
}

.ProseMirror-prompt {
    background: white;
    border: 1px solid silver;
    border-radius: 3px;
    box-shadow: -.5px 2px 5px rgba(0, 0, 0, .2);
    padding: 5px 10px 5px 15px;
    position: fixed;
    min-width: 300px;
    z-index: 999999;

    h5 {
        font-weight: bold;
        font-size: 100%;
        margin: 15px 0;
    }

    input {
        margin-bottom: 5px;
    }
}

.ProseMirror-prompt-close {
    background: transparent;
    color: @text-color-soft;
    padding: 0;
    position: absolute;
    left: 2px;
    top: 1px;
    border: none;
}

.ProseMirror-prompt-close:after {
    content: "✕";
    font-size: 12px;
}

.ProseMirror-invalid {
    background: lighten(@warning, 40%);
    border: 1px solid lighten(@warning, 10%);
    border-radius: 4px;
    padding: 5px 10px;
    position: absolute;
    min-width: 10em;
}

.ProseMirror-prompt-buttons {
    margin: 15px 0;
    text-align: center;
}

.atwho-view .cur {
    border-left: 3px solid lighten(@info, 30%);
    background-color: @background-color-secondary !important;
}

.atwho-user,
.atwho-space,
.atwho-input a {
    color: @link;
}

.atwho-input a:hover {
    color: @link;
}

.atwho-view strong {
    background-color: lighten(@warning, 40%);
}

.atwho-view .cur strong {
    background-color: lighten(@warning, 40%);
}

[data-emoji-category] {
    max-height: 200px;
    display: block;
    position: relative;
    overflow: auto;

    .atwho-emoji-entry {
        width: 24px;
        height: 28px;
        overflow: hidden;
    }

    .atwho-emoji-entry.cur {
        background-color: @background-color-page !important;
    }
}

.emoji-nav {
    padding-top: 10px;

    .emoji-nav-item {
        border-top: 2px solid @background-color-highlight;
    }

    .emoji-nav-item.cur {
        border-left: 0;
        border-top: 2px solid @info;
    }
}

[data-ui-markdown],
[data-ui-richtext] {
    overflow-x: auto;
    overflow-wrap: break-word;

    a {
        color: @link
    }
}

#wallStream {
    [data-ui-markdown],
    [data-ui-richtext] {
        overflow-wrap: initial;
        word-break: initial;
        hyphens: initial;
    }
}

@media screen and (max-width: 460px) {
    .ProsemirrorEditor .ProseMirror-menu-dropdown-right {
        right: 0;
    }
}

@media screen and (max-width: 768px) {
    .ProsemirrorEditor.focusMenu {
        .form-control:focus {
            border-top-right-radius: 0 !important;
        }

        .ProseMirror-menubar {
            min-height: 1em;
            margin-top: 0;
        }
    }

    .ProsemirrorEditor.focusMenu {
        .humhub-ui-richtext {
            margin-top: 0;
        }
    }
}
