[data-close-chat] {
    display: none;
}

@media (max-width: 992px) {
    [data-close-chat] {
        &.show {
            display: block;
        }

        &.hide {
            display: none;
        }
    }
}

.chat-block {
    height: calc(100vh - (#{$header-height} + 1.5rem * 2 + 52px));
    display: flex;

    .chat-sidebar {
        height: 100%;
        display: flex;
        flex-direction: column;
        width: 400px;

        .chat-sidebar-content {
            flex: 1;
            height: 100%;
            display: flex;
            flex-direction: column;
            overflow: auto;
            padding: 0 1px;

            .list-group {
                .list-group-item {
                    border: none;
                    border-radius: $border-radius;
                    background-color: white;
                    margin-bottom: 15px;

                    .badge {
                        width: 30px;
                        height: 30px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                    }
                }
            }

            .chat-lists {
                padding: 1px 0;

                .list-group {
                    .list-group-item {
                        cursor: pointer;

                        &:not(.active):hover {
                            background: darken(white, 5%);
                        }

                        &.active {
                            position: relative;
                            color: black;
                            margin-top: 0;
                            box-shadow: 0 0 0 1px $primary !important;
                        }

                        &.unread-message {
                            font-weight: bold;

                            p {
                                color: $success;
                            }
                        }
                    }
                }
            }
        }
    }

    .empty-chat-wrapper {
        .chat-header, .messages, .chat-footer {
            display: none !important;
        }

        .empty-chat {
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
        }
    }

    .chat-content {
        display: flex;
        flex: 1;
        flex-direction: column;
        height: 100%;
        padding-left: 30px;

        .mobile-chat-close-btn {
            display: none;
        }

        .messages {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            flex: 1;
            overflow-x: hidden;

            .message-item {
                margin-bottom: 20px;
                display: flex;
                align-items: center;
                position: relative;

                .time {
                    margin-left: 1rem;
                }

                img {
                    max-width: 30%;
                    border-radius: $border-radius;
                }

                .message-item-content {
                    max-width: 75%;
                    background-color: white;
                    padding: 10px 20px;
                    line-height: 1.5rem;
                    border-radius: $border-radius;
                    position: relative;
                    z-index: 2;
                }

                &.me {
                    flex-direction: row-reverse;
                    margin-left: auto;
                    padding-left: 0;

                    .time {
                        margin-left: 0;
                        margin-right: 1rem;
                    }

                    .message-item-content {
                        background-color: lighten($primary, 30%);
                        border-color: transparent;
                    }
                }

                &.message-item-divider {
                    width: 100%;
                    display: flex;

                    span {
                        @extend .small;
                        @extend .text-muted;
                        padding: 0 10px;
                        user-select: none;
                    }

                    &:before, &:after {
                        content: '';
                        display: block;
                        height: 1px;
                        background-color: #f0f0f0;
                        flex: 1;
                    }
                }
            }
        }

        .chat-footer {
            padding-top: 30px;

            .mb-3 {
                margin: 0;
                position: relative;
                display: flex;
                align-items: center;

                .form-control {
                    margin: 0 15px;
                    border-radius: 50px;
                    padding-left: 20px;
                }
            }
        }
    }
}
