$chat-font-size: 0.9rem;
@media screen and (min-width: $tablet - 1px) {
    $chat-width: 280px;
    $chat-height: 385px;
    $chat-color: $primary;
    $chat-header-height: 40px;
    $chat-input-height: 40px;
    .chat-wrapper {
        font-size: $chat-font-size;

        .tabs.is-toggle li.is-active a {
            background-color: $primary;
            border-color: $primary;
            color: $white;
        }
    }
    .chat-list {
        right: 0;
        margin-right: 0.5em;

        &.is-close {
            bottom: -($chat-height) + ($chat-header-height);
        }
    }

    .active-chats-wrapper {
        right: $chat-width;
        position: fixed;
        bottom: 0;
        display: flex;
        flex-direction: row-reverse;
        z-index: 30;
        width: calc(100% - #{$chat-width});
        pointer-events: none;
        border-top-left-radius: $radius;
        border-top-right-radius: $radius;

        .extra-chats-bubble {
            width: 50px;
            position: relative;
            cursor: pointer;
            display: flex;
            align-items: flex-end;
            pointer-events: all;
        }

        .hidden-chats-list {
            position: absolute;
            left: 0;
            z-index: 100;
            width: 10rem;
            margin-top: 0.5rem;
            padding: 0;
            font-size: 0.8rem;
            bottom: 2.5rem;

            li {
                padding: 0.5rem;
                cursor: pointer;
                background-color: $white-ter;

                &:hover {
                    background-color: $primary;
                    color: $white
                }
            }
        }

        .number {
            align-items: center;
            background-color: $white-ter;
            display: inline-flex;
            font-size: 1rem;
            justify-content: center;
            width: 1.7rem;
            height: 1.7rem;
            color: $primary;
            font-weight: 900;
            margin: 0;
        }
    }

    .active-chat {
        width: 100%;
        max-width: $chat-width;
        height: $chat-height;
        margin-right: 0.5rem;
        background-color: $white;
        z-index: 30;
        pointer-events: all;
    }

    .chat-list {
        width: $chat-width;
        height: $chat-height;
        position: fixed;
        bottom: 0;
        background-color: $white;
        z-index: 30;
        border-top-left-radius: $radius;
        border-top-right-radius: $radius;
    }

    .chat-header {
        background-color: $chat-color;
        padding: 0.7em;
        display: flex;
        justify-content: space-between;
        height: $chat-header-height;
        border-top-left-radius: $radius;
        border-top-right-radius: $radius;

        &, a {
            color: $white;
        }

        a {
            user-select: none;
        }
    }

    .close-chat {
        display: inline-block;
        padding-left: 0.5em;
        padding-right: 0.5em;
    }

    .chat-content {
        height: calc(100% - #{$chat-header-height});
        overflow-y: auto;
        border: 1px solid #E6E7EA;

        .tabs li {
            width: 100%;
            font-size: $chat-font-size;

            a {
                border-radius: 0 !important;
            }

        }

        .notification {
            padding: 0.5rem;
            border-radius: 0;
            font-size: 0.9rem;
        }
    }

    .chat-list-item {
        display: flex;
        align-items: center;
        cursor: pointer;
        border-bottom: 1px solid #E6E7EA;
        user-select: none;
        padding: 0.4em;

        .media-content {
            display: flex;
            justify-content: space-between;
            align-items: center;

        }

        .media-left {
            position: relative;
        }

        .has-unread-messages {
            background-color: $red;
            width: 0.7em;
            height: 0.7em;
            border-radius: 50%;
            position: absolute;
            top: 0;
            right: 0;
        }

        .is-online {
            background-color: $success;
            width: 0.7em;
            height: 0.7em;
            border-radius: 50%;
            flex-shrink: 0;
        }
    }

    .incoming-call {
        color: #F35B57;
        position: absolute;
        right: 2em;
    }

    .chat-username {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-actions {
        margin-right: 0.5em;
        font-size: 1rem;

        a {
            padding-right: 0.5em;
            padding-left: 0.5em;

            &:hover {
                color: darken($chat-color, 30%);
            }
        }
    }

    .close-chat {
        border-left: 1px solid rgba($white, 0.5);
    }

    .chat-history {
        height: calc(100% - #{$chat-header-height} - #{$chat-input-height});
        overflow-y: auto;
        border: 1px solid #E6E7EA;
    }

    .chat-input {
        height: $chat-input-height;


        .chat-contenteditable {
            height: $chat-input-height;
            width: 100%;
            padding: 0.3em;
            overflow: auto;
            outline: 0;
            border: 1px solid $grey-light;
            resize: none;
            font-family: NotoColorEmoji, sans-serif;
        }

        .button {
            padding: 0.3em 0.9em;
            border-radius: 0;
            height: 100%;
        }
    }

    .chat-message {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        font-family: NotoColorEmoji, sans-serif;

        .media-right {
            margin-left: 0.3rem;
        }

        .media-left {
            margin-right: 0.3rem;
        }

        .media-content {
            padding: 0.4rem 0.8rem;
            border-radius: 20px;
            flex: inherit;

            &.system-msg {
                font-size: 0.8rem;
                font-style: italic;
                text-align: center;
                width: 100%;
                color: #807f7f;
            }
        }

        .date {
            width: 100%;
            font-size: 80%;
            margin-bottom: 5px;
            text-align: right;
        }

        &.partner-message {
            .media-content {
                background-color: #eeeeee;
            }

            .media {
                justify-content: flex-start;
            }

            .date {
                text-align: left;
            }
        }

        &.my-message {
            .media-content {
                background-color: lighten($chat-color, 15%);
                color: $white;
            }

            .media {
                justify-content: flex-end;
            }
        }
    }

    .video-chat {
        position: fixed;
        z-index: 200;
        background: rgba(0, 0, 0, 0.9);
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;

        .partner-video {
            width: 100%;
            height: 60vh;

            .avatar-placeholder {
                width: 400px;
                height: 400px;
                background-repeat: no-repeat;
                background-size: contain;
                background-position: center;
                background-color: #000;
            }

            .video-wrapper {
                width: 100%;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
            }
        }

        .video-buttons {
            width: 100%;
            text-align: center;
            align-self: flex-start;
            flex: 1;
        }

        .my-video {
            position: absolute;
            width: 200px;
            height: 200px;
            bottom: 0;
            right: 0;

            .video-wrapper {
                width: 100%;
                height: 100%;
            }

            .avatar-placeholder {
                width: 100%;
                height: 100%;
                background-size: cover;
                background-repeat: no-repeat;
                background-position: center;
                background-color: #000;
            }

        }

        #remoteVideo {
            height: 90vh;
            width: 90vw;
            position: absolute;
            top: 0;
            bottom: 0;
            margin: auto;
        }

        #localVideo {
            height: 20vh;
            width: 20vw;
            position: absolute;
            right: 0;
            bottom: 0;
        }
    }

    .incoming-call-notification {
        position: fixed;
        z-index: 300;
        background: rgba(0, 0, 0, 0.9);
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        color: $white;

        .avatar {
            margin-left: auto;
            margin-right: auto;
        }

        .call-notification-container {
            text-align: center;
        }

        .call-notification-buttons {
            margin-top: 1em;
        }
    }

}

.chat-options {
    .control {
        label {
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding: .5rem;
            font-size: $chat-font-size;

            span::before {
                content: "";
                display: inline-block;
                width: 0.75rem;
                height: 0.75rem;
                border-radius: 50%;
                margin-right: .5rem;
            }
        }

        &.available span::before {
            background-color: $success;
        }

        &.busy span::before {
            background-color: $red;
        }

        &.away span::before {
            background-color: $warning;
        }

        &.invisible span::before {
            background-color: #999;
        }
    }

    .control + .control {
        border-top: 1px solid #ccc;
    }
}

.chat-list-item .is-online.available {
    background-color: $green
}

.chat-list-item .is-online.busy {
    background-color: $red
}

.chat-list-item .is-online.away {
    background-color: $warning
}
