/*----------------------------------------*/
/*  11. Chat CSS
/*----------------------------------------*/

/*Chat App Wrap*/
.chat-app-wrap {
    position: relative;
    padding-left: 370px;
    height: 100%;
    background-color: $light-grey;
    // Chat Contacts Open Button
    & .chat-contacts-open {
        width: 40px;
        height: 40px;
        padding: 10px;
        text-align: center;
        box-shadow: 0 0px 15px 0 rgba(0, 0, 0, 0.15);
        background-color: $dark;
        color: $white;
        border: none;
        display: block;
        position: fixed;
        left: 0;
        z-index: 9;
        opacity: 0;
        visibility: hidden;
        & i {
            display: block;
            font-size: 20px;
            line-height: 20px;
        }
        &:hover {
            background-color: $primary;
        }
    }
    // Chat Contacts
    & .chat-contacts {
        height: 100%;
        max-height: 822px;
        max-width: 370px;
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        border-right: 1px solid $grey;
        background-color: $light-grey;
        padding-top: 90px;
        transition: all 0.3s ease 0s;
        z-index: 1001;
        &.show {
            visibility: visible;
            opacity: 1;
            left: 0;
            & .chat-contacts-close {
                opacity: 1;
                visibility: visible;
            }
        }
        // Chat Contacts Close Button
        & .chat-contacts-close {
            width: 40px;
            height: 40px;
            padding: 10px;
            text-align: center;
            box-shadow: 0 0px 15px 0 rgba(0, 0, 0, 0.15);
            background-color: $dark;
            color: $white;
            border: none;
            display: block;
            position: absolute;
            left: 100%;
            top: 70px;
            z-index: 9;
            opacity: 0;
            visibility: hidden;
            & i {
                display: block;
                font-size: 20px;
                line-height: 20px;
            }
            &:hover {
                background-color: $primary;
            }
        }
    }
    // Chat Contact Search Form
    & .contact-search-form {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border-bottom: 1px solid $grey;
        & form {
            display: flex;
            flex: 1 0 100%;
            position: relative;
            padding: 20px 0;
            & input {
                padding: 10px 25px;
                line-height: 30px;
                width: 100%;
                background-color: transparent;
                border: none;
                color: $body-color;
            }
        }
    }
    // Chat Contact List
    & .chat-contact-list {
        display: block;
        height: 100%;
        list-style: none;
        padding: 0;
        margin: 0;
        & li {
            & a {
                display: flex;
                flex-wrap: wrap;
                justify-content: flex-start;
                padding: 21px 25px;
                & .image {
                    width: 50px;
                    height: 50px;
                    border-radius: 50%;
                    position: relative;
                    & img {
                        border-radius: 50%;
                    }
                    & .status {
                        position: absolute;
                        right: 3px;
                        bottom: 3px;
                        display: block;
                        width: 8px;
                        height: 8px;
                        border-radius: 50%;
                        &.online {
                            background-color: $success;
                        }
                    }
                }
                & .content {
                    width: calc(100% - 50px);
                    padding-left: 15px;
                    padding-right: 15px;
                    & .name {
                        font-size: 14px;
                        font-weight: 600;
                        margin-bottom: 4px;
                    }
                    & .last-message {
                        align-self: center;
                        font-size: 13px;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                        overflow: hidden;
                    }
                }
            }
        }
    }
    // Responsive
    @media #{$tablet-device, $large-mobile} {
        padding-left: 0;
        & .chat-contacts-open {
            opacity: 1;
            visibility: visible;
        }
        & .chat-contacts {
            max-width: 300px;
            left: -300px;
            opacity: 0;
            visibility: hidden;
            position: fixed;
            top: 80px;
            & .chat-contacts-close {
                opacity: 0;
                visibility: hidden;
            }
        }
    }
    @media #{$large-mobile} {
        & .chat-contacts {
            top: 0;
            padding-top: 50px;
        }
        & .contact-search-form {
            & form {
                padding: 0;
            }
        }
        & .chat-wrap {
            max-height: 100vh;
        }
    }
    @media #{$extra-small-mobile} {
        & .chat-contacts {
            max-width: 280px;
            left: -280px;
        }
    }
}

/*Active Contact*/
.chat-active-contact {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    border-bottom: 1px solid $grey;
    padding: 15px 30px;
    & .chat-contact {
        display: flex;
        flex-wrap: wrap;
        & .image {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            overflow: hidden;
            margin-right: 20px;
        }
        & .info {
            align-self: center;
            & h5 {
                margin-bottom: 10px;
                line-height: 1;
            }
            & span {
                display: block;
                font-size: 13px;
                line-height: 1;
            }
        }
    }
    & .chat-contact-actions {
        align-self: center;
        & .button {}
    }
    @media #{$extra-small-mobile} {
        & .chat-contact-actions {
            margin-top: 15px;
        }
    }
}


/*Chat Wrap*/
.chat-wrap {
    max-height: 650px;
    padding: 30px;
}

/*Chat List*/
.chat-list {
    padding: 0;
    list-style: none;
    margin: 0;
    & li {
        & .chat {
            margin-bottom: 25px;
        }
        &:nth-child(2n) {
            & .chat {
                & .head {
                    flex-direction: row-reverse;
                    & h5 {
                        text-align: right;
                    }
                    & span {
                        margin-left: 15px;
                        margin-right: 0;
                    }
                }
                & .body {
                    flex-direction: row-reverse;
                    & .content {
                        margin-right: 15px;
                        margin-left: 0;
                        &::before {
                            right: -10px;
                            left: auto;
                            border-width: 6px 0px 6px 10px;
                            border-color: transparent transparent transparent $white;
                        }
                    }
                }
            }
        }
    }
}
            
/*Chat*/
.chat {
    // Head
    & .head {
        display: flex;
        flex: 1 0 100%;
        margin-bottom: 12px;
        position: relative;
        & h5 {
            font-size: 14px;
            line-height: 18px;
            margin: 0 0 3px;
            flex-grow: 1;
        }
        & span {
            font-size: 12px;
            line-height: 18px;
            color: $body-light;
            margin-right: 15px;
            margin-bottom: 3px;
        }
        & a {
            color: $primary;
            margin-bottom: 3px;
            & i {
                font-size: 18px;
                line-height: 18px;
                display: block;
            }
        }
    }
    // Body
    & .body {
        display: flex;
        flex: 1 0 100%;
        & .image {
            flex: 1 0 60px;
            max-width: 60px;
            & img {
                width: 100%;
                overflow: hidden;
                border-radius: 50%;
                height: auto;
            }
        }
        & .content {
            padding: 10px 15px;
            background-color: $white;
            margin-left: 15px;
            border-radius: 4px;
            position: relative;
            box-shadow: 0 0 5px rgba(24,24,24,0.05);
            &::before {
                display: none;
                content: "";
                position: absolute;
                top: 28px;
                left: -10px;
                border-width: 6px 10px 6px 0;
                border-style: solid;
                border-color: transparent $white transparent transparent;
            }
            & p {
                font-size: 13px;
                color: $body-light;
                line-height: 22px;
            }
        }
    }
    // Responsive
    @media #{$extra-small-mobile}{
        & .head {
            flex-direction: column !important;
            & h5 {
                text-align: left !important;
            }
            & span {
                margin-left: 0 !important;
                margin-right: 20px;
            }
            & a {
                position: absolute;
                right: 0;
                bottom: 0;
            }
        }
        & .body {
            flex-direction: column !important;
            & .image {
                max-width: 80px;
            }
            & .content {
                margin: 15px 0 0 !important;
            }
        }
    }
}

/*Chat Submission*/
.chat-submission {
    border-top: 1px solid $grey;
    & form {
        display: flex;
        flex: 1 0 100%;
        position: relative;
        padding: 15px 120px 15px 15px;
        & input {
            padding: 10px 15px;
            line-height: 30px;
            width: 100%;
            background-color: transparent;
            border: none;
            color: $body-color
        }
        & .buttons {
            position: absolute;
            right: 30px;
            top: 50%;
            transform: translateY(-50%);
        }
        & .file-upload {
            margin: 0;
            cursor: pointer;
            & input {
                display: none;
            }
            & i {
                transform: rotate(45deg);
            }
        }
    }
}

/*Widget Chat*/
.widget-chat-wrap {
    max-height: 429px;
    height: 100%;
    padding: 0;
    padding-right: 25px;
    margin-right: -25px;
    width: auto;
}
.widget-chat-list {
    @extend .chat-list;
}
.widget-chat {
    @extend .chat;
}
.widget-chat-submission {
    @extend .chat-submission;
    margin: 0 -25px -25px;
    & form {
        padding: 10px 85px 10px 5px;
        & .buttons {
            right: 10px;
        }
    }
}