[action-livechat] {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    color: var(--PrimarySecondary);
    height: calc(100vh - 270px);
    min-height: 480px;

    & .chat_user_role {
        background: var(--ProfileBadgeColor);
        border-radius: .125em;
        font-size: .75em;
        color: var(--ProfileBadgeFontColor);
        padding: .25em .5em;
        letter-spacing: .06em;
    }

    & .users_list {
        display: flex;
        flex-direction: column;

        width: 400px;
        border-radius: var(--BorderRadius);
        height: 100%;
        
        & > .user_primary {
            margin-bottom: 1rem;
        }

        & .user_primary {
            display: flex;
            flex-direction: row;
            gap: .5rem;

            & > .user_avatar {
                & > a > img {
                    width: 60px;
                    height: 60px;
                    border-radius: 50%;
                }
            }

            & > .user_info {
                display: flex;
                flex-direction: column;
                justify-content: space-evenly;
                gap: 4px;
            }
        }

        & > .user_others {
            display: flex;
            flex-direction: column;
            flex: 1;
            gap: .5rem;
            overflow: auto;

            & > .no_users_online {
                font-size: 14px;
                text-align: center;
            }
        }

        & > .separator {
            font-size: 14px;
            margin-bottom: 1rem;
        }
    }

    & > .end {
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: .5rem;
        border: 1px solid var(--HeaderBorderColor);
        background: var(--BlockColor);
        border-radius: var(--BorderRadius);

        & > .chat_container {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            position: relative;
            padding-right: 8px;
            margin: 1rem;
            overflow-y: auto;
            flex: 1;

            & > span.no_messages {
                font-size: 14px;
                text-align: center;
            }

            & > .chat_message {
                display: flex;
                flex-direction: row;
                gap: .5rem;

                & > .chat_user {
                    display: flex;
                    flex-direction: row;
                    gap: .5rem;

                    & > .chat_user_image {
                        & > a > img {
                            width: 44px;
                            height: 44px;
                            border-radius: 50%;
                        }
                    }
                }

                & > .chat_content {
                    display: flex;
                    flex-direction: column;

                    & > .chat_user_name {
                        margin-bottom: .2rem;
                    }

                    & > .chat_content_item {
                        display: flex;
                        flex-direction: column;
                        gap: 4px;

                        & > .chat_content_message {
                            white-space: normal;
                            word-wrap: break-word;
                            word-break: break-word;
                        }

                        & > .chat_content_date {
                            font-size: 12px;
                        }
                        
                        &:not(:last-child) {
                            margin-bottom: .5rem;
                        }
                    }
                }
            }
        }

        & > form {
            margin-top: auto;
        }
    }
}

.user_primary.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.user_primary.animate-out {
    animation: fadeOutDown 0.4s ease forwards;
}

#chat-notifier {
    transform: scale(1) rotateZ(0deg);
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
    color: white;
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    font-weight: 500;
    z-index: 9999;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.4s ease, transform 0.4s ease;
    animation: popIn 0.6s ease forwards;

    & > a {
        display: flex;
        align-items: center;
        gap: .5rem;
        color: #fff;
    }
}

#chat-notifier.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

#chat-notifier .close-btn {
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.8;
}

.light-chat-preview {
    position: relative;
    cursor: pointer;
    border: 1px solid var(--HeaderBorderColor);
    background: var(--BlockColor);
    border-radius: var(--BorderRadius);
    overflow: hidden;
    max-height: 250px;
    min-height: 120px;
    margin-bottom: 4rem;;
}

.light-chat-preview .chat_container {
    padding: 1rem;
    overflow-y: auto;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.light-chat-preview .chat_message {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

.light-chat-preview .chat_user_image img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.light-chat-preview .chat_content {
    display: flex;
    flex-direction: column;
}

.light-chat-preview .chat_content_message {
    font-size: 14px;
    color: var(--PrimaryTextColor);
    word-break: break-word;
}

.light-chat-preview .chat_content_date {
    font-size: 12px;
    color: var(--MutedTextColor);
}


@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

@keyframes popIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0px);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    [action-livechat] {
        flex-direction: column;
        height: auto;
        min-height: unset;
    }

    [action-livechat] .users_list {
        width: 100%;
        height: auto;
        max-height: 300px;
        overflow-y: auto;
    }

    [action-livechat] .users_list .user_primary {
        flex-direction: row;
        align-items: center;
    }

    [action-livechat] > .end {
        flex: none;
        height: auto;
        max-height: calc(100vh - 300px);
        margin-bottom: 2rem;
    }

    [action-livechat] .chat_container {
        margin: 1rem .5rem;
        gap: .75rem;
    }

    [action-livechat] .chat_message {
        flex-direction: row;
        align-items: flex-start;
    }

    [action-livechat] form {
        margin: 0.5rem;
    }

    [action-livechat] .chat_user_image img {
        width: 36px;
        height: 36px;
    }

    [action-livechat] .chat_content_item {
        gap: 2px;
    }

    [action-livechat] > .end > .chat_container {
        margin: 10px;
        padding-right: 8px;
    }

    #chat-notifier {
        left: 20px;
    }
}