:root{
    --clr-gray: gray;
    --clr-gray-light: lightgray;
    --clr-chat-color: #CC7C5E;
    --clr-chat-color2: #AC431B;
    --clr-message-tsbot-bg: rgba(57, 192, 237,.2);
    --clr-message-user-bg: rgba(0, 0, 0, .05);
    --clr-input-bg: rgba(255,255,255, 0.03);
}

*,
*::before,
*::after{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    padding: 30px;
    font-family: 'Helvetica Neue', sans-serif;
}

#tschat{
    position: relative;
    display: flex;
    flex-direction: column;

    container-type: inline-size;
    container-name: tschat;

    width: 100%;
    max-width: 800px;
    height: 100%;
    min-height: max-content;
    max-height: 800px;
    margin: 15px;

    border-radius: 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

#tschat #messages img.avatar{
    width: 45px;
    height: 45px;
    box-shadow: 5px 5px 15px rgba(0,0,0,.2);
    border-radius: 100vmax;
}

#tschat .tschat_top{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    max-height: 80px;
    border-radius: 15px 15px 0 0;
    background-color: transparent;
    background-image: linear-gradient(180deg, var(--clr-chat-color) 40%, var(--clr-chat-color2) 100%);
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);

        p{
            color: white;
            font-weight: bold;
        }
}

#tschat .tschat_messages{
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;    
    height: 100%;
    min-height: 100px;    
    padding: 24px 20px 24px 10px;
    overflow: auto;
}

#tschat .tschat_messages .message_tsbot{
    display: grid;
    grid-template-columns: 45px 1fr;
    gap: 16px;
        p{
            width: fit-content;
            max-width: 50%;
            padding: 10px;
            background-color: var(--clr-message-tsbot-bg);
            border-radius: 0 15px 15px 15px;
            margin-right: auto;
            hyphens: auto;
        }
}
#tschat .tschat_messages .message_user{
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    width: 100%;
        p{
            width: fit-content;
            max-width: 50%;
            padding: 10px;
            background-color: var(--clr-message-user-bg);
            border-radius: 15px 0 15px 15px;
            hyphens: auto;
        }
        .message_file{
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            width: 100%;
        }
        .message_file img{
            width: 100%;
            max-width: 150px;
        }
}

#tschat .tschat_input{
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: start;    
    width: 100%;
    height: auto;
    bottom: 0;
    left: 0;
    padding: 10px;
    background-color: var(--clr-input-bg);
    border-top: 1px solid var(--clr-gray-light);
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}
#tschat .tschat_input img.arrow_send_message{
    position: relative;
    right: 12px;
    height: 50px;
    width: 50px;
    background-image: linear-gradient(135deg, white, #dfdfdf);
    box-shadow: 5px 5px 15px rgba(0,0,0,.2);
    padding: 7px;
    border-radius: 100vmax;
    cursor: not-allowed;
}
#tschat #message:not(:placeholder-shown) + img + img.arrow_send_message{
    background-image: linear-gradient(135deg, var(--clr-chat-color), #004b7c);
    cursor: pointer;
}
#tschat textarea {  
    font-family: 'Helvetica Neue', sans-serif;  
    font-size: 20px;
    width: 100%;
    height: 50px;
    overflow-y: auto;   
    border-radius: 100vmax;
    box-shadow: inset 0 0 15px rgba(0,0,0,.1);
    border: unset;
    background-image: linear-gradient(135deg, white, #dfdfdf);
    padding: 10px 25px 10px 25px;
    resize: none;
} 
#tschat textarea:focus {
    outline: none;
    border: none;
} 


#sendmessage{
    position: relative;
    display: flex;
    align-items: center;
    column-gap: 20px;
    width: 100%;
    height: auto;
}


#image-preview{
    position: relative;
    width: 55px;
    height: 55px;
    margin-bottom: 20px;
}

#tschat .tschat_input #image-preview img{
    position: relative;
    top: 5px !important;
    left: 5px !important;
    width: 55px;
    height: 55px;
    cursor: pointer;
    transform: unset !important;
    object-fit: cover;
    object-position: center center;
    box-shadow: 5px 5px 15px rgba(0,0,0,.2);
}
#tschat .tschat_input #remove-preview img{
    display: block;
    position: absolute;
    top: -5px !important;
    left: 45px !important;
    width: 25px;
    height: 25px;
    border-radius: 100vmax;
}


.tschat_message_options{
    display: flex;
    align-items: center;
    column-gap: 30px;
    width: 100%;
    height: auto;
    padding-block: 15px;
    padding-left: 10px;
}
#tschat .tschat_input img.paper_clip{
    display: block;
    position: relative;
    width: 30px;
    height: 30px;
    left: 0;
}





@container tschat (width < 700px) {
    .message_user p,
    .message_tsbot p{
        max-width: 90% !important;
    }
}
@container tschat (width < 400px) {
    .message_tsbot,
    .message_user {
        grid-template-columns: 1fr !important;
    }
    .message_user {
        display: flex !important;
        flex-direction: column-reverse;
        & img{
            margin-left: auto;
        }
    }
}