#converse-embedded-chat,
#conversejs {
    .flyout {
        border-radius: $chatbox-border-radius;
        @media screen and (max-height: $mobile-landscape-height) {
            border-radius: 0;
        }
        @media screen and (max-width: $mobile-portrait-length) {
            border-radius: 0;
        }
        bottom: $chatbox-hover-height;
        display: block;
        position: absolute;
        @media screen and (max-height: $mobile-landscape-height) {
            bottom: 0;
        }
        @media screen and (max-width: $mobile-portrait-length) {
            bottom: 0;
        }
    }
    .chat-head {
        color: #ffffff;
        font-size: 100%;
        height: $chat-head-height;
        margin: 0;
        padding: 0.5em;
        position: relative;
        .avatar {
            margin-right: 0.5em;
            border-radius: 25%;
            float: left;
        }
        &.chat-head-chatbox {
            background-color: $chat-head-color;
        }
        .user-custom-message {
            color: white;
            font-size: 75%;
            font-style: italic;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin: 0;
            padding-top: 0.2em;
        }
    }
    .chatbox-btn {
        border-radius: 25%;
        border: none;
        color: white;
        cursor: pointer;
        display: inline-block;
        float: right;
        font-size: $box-close-font-size;
        margin: 0 0.2em;
        padding: 0.3em;
        text-decoration: none;
        &:active {
            position: relative;
            top: 1px;
        }
        &.button-on {
            background-color: white;
            color: $chat-head-color;
        }
    }
    .chatbox {
        display: block;
        text-align: left;
        float: right;
        height: $bottom-gutter-height;
        margin: 0 $chat-gutter;
        width: $chat-width;
        @media screen and (max-height: $mobile-landscape-height) {
            margin: 0;
            width: $mobile-chat-width;
        }
        @media screen and (max-width: $mobile-portrait-length) {
            margin: 0;
            width: $mobile-chat-width;
        }

        .spoiler {
            background-color: lighten($chat-head-color, 50%);
        }

        .box-flyout {
            background-color: white;
            box-shadow: 1px 3px 5px 3px rgba(0, 0, 0, 0.4);
            height: $chat-height;
            min-height: $chat-height/2;
            min-width: $chat-width;
            width: $chat-width;
            z-index: 1;
            @media screen and (max-height: $mobile-landscape-height) {
                height: $mobile-chat-height;
                width: $mobile-chat-width;
                height: 100vh;
            }
            @media screen and (max-width: $mobile-portrait-length) {
                height: $mobile-chat-height;
                width: $mobile-chat-width;
                height: 100vh;
            }
        }
        .chat-title {
            color: $chat-head-text-color;
            display: block;
            line-height: 15px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            a {
                color: $chat-head-text-color;
                width: 100%;
            }
        }
        .chat-body {
            background-color: white;
            border-bottom-left-radius: $chatbox-border-radius;
            border-bottom-right-radius: $chatbox-border-radius;
            @media screen and (max-height: $mobile-landscape-height) {
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
            }
            @media screen and (max-width: $mobile-portrait-length) {
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
            }
            border-top: 0;
            height: 289px;
            @include calc(height, '100% - #{$chat-head-height}');
            p {
                color: $text-color;
                font-size: $font-size;
                margin: 0;
                padding: 5px;
            }
            .chat-info {
                line-height: $line-height-small;
                color: $chat-head-color;
                font-size: $font-size-small;
                margin: 0.3em;
                &.chat-event {
                    clear: left;
                    font-style: italic;
                }
                &.chat-error {
                    color: $warning-color;
                    font-weight: bold;
                }
                &.chat-date {
                    display: inline-block;
                    margin-top: 1em;
                }
            }
            .chat-image {
                height: auto;
                width: auto;
                max-height: 24em;
                max-width: 100%;
            }
            .chat-action {
                font-style: italic;
            }
            .chat-message {
                &.onload {
                    animation: colorchange-chatmessage 1s;
                    -webkit-animation: colorchange-chatmessage 1s;
                }
                overflow: auto; // Ensures that content stays inside
                .chat-msg-author {
                    font-weight: bold;
                    white-space: nowrap;
                    float: left;
                    text-overflow: ellipsis;
                    overflow: hidden;
                }
                .chat-msg-them {
                    color: $message-them-color;
                }
                .chat-msg-me {
                    color: $link-color;
                }
                .chat-msg-content {
                    max-width: 100%;
                    word-wrap: break-word;

                    &.spoiler {
                        border-radius: $chatbox-border-radius;
                        padding: 0.5em;
                    }

                    .emojione {
                        margin-bottom: -6px;
                    }
                }
            }
            .delayed {
                .chat-msg-them {
                    color: lighten($message-them-color, 5%);
                }
                .chat-msg-me {
                    color: lighten($link-color, 5%);
                }
            }
        }
        .new-msgs-indicator {
            position: absolute;
            width: 100%;
            cursor: pointer;
            background-color: $chat-head-color;
            color: $light-background-color;
            padding: 0.5em;
            font-size: 0.9em;
            text-align: center;
            z-index: 20;
            white-space: nowrap;
        }
        .chat-content {
            position: relative;
            padding: 0.5em;
            font-size: 13px;
            color: $text-color;
            overflow-y: auto;
            border: 0;
            background-color: #ffffff;
            line-height: 1.3em;
            height: 206px;
            height: calc(100% - #{$toolbar-height + $chat-textarea-height +1px});

            .toggle-spoiler:before {
                padding-right: 0.25em;
                whitespace: nowrap;
            }
        }
        .chat-content-sendbutton {
            height: calc(100% - #{$toolbar-height + $chat-textarea-height + $send-button-height + 2*$send-button-margin});
        }

        .dropdown { /* status dropdown styles */
            background-color: $light-background-color;
            dd {
                margin: 0;
                padding: 0;
                position: relative;
            }
        }

        .sendXMPPMessage {
            -moz-background-clip: padding;
            -webkit-background-clip: padding-box;
            @include border-bottom-radius($chatbox-border-radius);
            background-clip: padding-box;
            border-top: 1px solid #BBB;
            border: 0;
            margin: 0;
            padding: 0;
            position: relative;
            height: #{$chat-textarea-height + $toolbar-height};
            min-width: $chat-width;
            @media screen and (max-height: $mobile-landscape-height) {
                width: 100%;
            }
            @media screen and (max-width: $mobile-portrait-length) {
                width: 100%;
            }
            .spoiler-hint {
                width: 100%;
            }

            .chat-textarea {
                @include border-bottom-radius($chatbox-border-radius);
                border: 0;
                height: $chat-textarea-height;
                padding: 0.5em;
                width: 100%;
                resize: none;
                &.spoiler {
                    height: 42px;
                }
            }
            .send-button {
                position: absolute;
                left: $send-button-margin;
                @include calc(width, '100% - #{2*$send-button-margin}');
                background-color: $chat-head-color;
                color: $inverse-link-color;
                font-size: 80%;
                height: $send-button-height;
                bottom: -$send-button-height - $send-button-margin;

            }
            .chat-toolbar {
                box-sizing: border-box;
                margin: 0;
                padding: 0.25em;
                height: $toolbar-height;
                display: block;
                background-color: lighten($chat-head-color, 10%);
                color: white;
                a {
                    color: white;
                    font-size: $font-size-large;
                    text-decoration: none;
                    text-shadow: none;
                }
                .unencrypted a,
                .unencrypted {
                    color: $text-color;
                    .toolbar-menu {
                        a {
                            color: $link-color;
                        }
                    }
                }
                .unverified a,
                .unverified {
                    color: #cf5300;
                }
                .private a,
                .private {
                    color: #4b7003;
                }
                .toggle-occupants,
                .toggle-clear,
                .toggle-otr {

                    float: right;
                }
                li {
                    cursor: pointer;
                    display: inline-block;
                    list-style: none;
                    margin-top: 1px;
                    padding: 0 3px 0 3px;
                    &:hover {
                        cursor: pointer;
                    }
                    .toolbar-menu {
                        background-color: #fff;
                        bottom: 100%;
                        box-shadow: -1px -1px 2px 0 rgba(0, 0, 0, 0.4);
                        font-size: 12px;
                        margin: 0;
                        position: absolute;
                        right: 0;
                        a {
                            color: $link-color;
                        }
                        ul {
                            &.emoji-picker {
                                height: $emoji-picker-height;
                                overflow: scroll;
                                padding: 0.5em;
                            }
                            &.emoji-toolbar {
                                /* offset-x | offset-y | blur-radius | spread-radius | color */
                                box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.4);
                            }
                            &.emoji-toolbar {
                                overflow: hidden;
                                left: 0;
                                .picked {
                                    background-color: $highlight-color;
                                }
                                li {
                                    height: $emoji_height + 2*5px;
                                    padding: 4px;
                                    z-index: 98;
                                    &.emoji {
                                        a {
                                            font-size: $font-size-huge;
                                        }
                                    }
                                }
                            }
                            li {
                                &.insert-emoji {
                                    padding: 0.3em;
                                    &:hover {
                                        background-color: $highlight-color;
                                    }
                                }
                                margin-left: 0;
                                cursor: pointer;
                                list-style: none;
                                position: relative;
                                a:hover {
                                    color: #8f2831;
                                }
                            }
                        }
                    }
                    &.toggle-toolbar-menu {
                        color: white;
                    }
                    &.toggle-smiley {
                        .emoji-toolbar {
                            .emoji-category-picker,
                            .emoji-skintone-picker {
                                li:hover {
                                    background-color: $highlight-color;
                                }
                            }
                        }
                    }
                    &.toggle-otr {
                        ul {
                            z-index: 99;
                            li {
                                &:hover {
                                    background-color: $highlight-color;
                                }
                                display: block;
                                padding: 7px;
                                a {
                                    display: block;
                                }
                            }
                        }
                    }
                }
            }
        }
        .dragresize {
            background: transparent;
            border: 0;
            margin: 0;
            position: absolute;
            top: 0;
            z-index: 20;
            &-top {
                cursor: n-resize;
                height: 5px;
                width: 100%;
            }
            &-left {
                cursor: w-resize;
                width: 5px;
                height: 100%;
                left: 0;
            }
            &-topleft {
                cursor: nw-resize;
                width: 15px;
                height: 15px;
                top: 0;
                left: 0;
            }
        }
    }
}
