* {
    box-sizing: border-box;
}

body {
    font-family: "Poppins", sans-serif;
    font-weight: 400;
    font-style: normal;
    background: url("../img/udom_utawala_front.jpg") #c7c4c4 no-repeat;
    background-size: cover;
}

.container {
    margin: 1% 5% 1% 5%;
}

.container > h1 {
    text-align: center;
}

.container-glass {
    background-color: #494747;
    opacity: 0.9;
    height: 750px;
    margin-top: 1%;
    padding: 3% 10% 3% 25%;
    border-radius: 20px;
}

.chatform {
    color: white !important;
    border: 2px solid gray;
    border-radius: 20px;
    padding: 1% 0 0 0;
    font-size: 18px;
    width: 450px;
    height: 655px;
    float: right;
    clear: both;
    background-color: white;
}

.chat-box-title {
    text-align: center;
    font-weight: bold;
    font-size: 30px;
    color: #502f8d;
}

.chatbox {
    padding: 15px;
    list-style: none;
    overflow-y: auto;
    height: 400px;
}

.chatbox li {
    margin-bottom: 15px;
}

.chat p {
    padding: 10px;
    margin: 1%;
    border-radius: 10px;
    max-width: 90%;
    word-wrap: break-word; 
}

.chat-outgoing p {
    background-color: #162887;
    align-self: flex-end;
    align-self: flex-start;
    text-align: right;
    width: 75%;
    float: right;
    clear: right;
}

.chat-loading p {
    width: 75%;
    float: left;
    clear: left;
}

/* Loading indicator animation */
.chat-loading p {
    background-color: #0c0101;
    white-space: nowrap;
    border-right: 0.15em solid #a09aaa;
    float: left;
    clear: left;
    animation: typing var(--animation-steps, 40) steps(var(--animation-steps, 40), end);
}
    .chat-loading p::after {
        content: " ";
        display: inline-block;
        width: 0.8em;
        height: 0.8em;
        margin-left: 0.2em;
        border-radius: 50%;
        background: #a09aaa;
        animation: loading-bubbles 1.5s infinite;
    }

    .chat-loading p::after {
        content: "";
        display: inline-block;
        width: 0.8em;
        height: 0.8em;
        margin-left: 0.2em;
        border-radius: 50%;
        background: #a09aaa;
        animation: loading-bubbles 1s infinite;
    }
        @keyframes loading-bubbles {
            0%, 80%, 100% {
                opacity: 0;
            }
            40% {
                opacity: 1;
            }
        }

.chat-incoming p {
    background-color: #0c0101;
    align-self: flex-start; 
    border-right: 0.15em solid #a09aaa;
    width: 85%;
    float: left;
    clear: left;
}

.chat-input {
    border-top: 1px solid #ccc;
}

.chat-input textarea {
    width: 100%;
    height: 100px;
    padding: 10px 0 10px 0;
    border: 1px solid #ccc;
    border-radius: 7px;
    resize: none;
    outline: none;
    overflow-y: scroll;
    background-color: #dcdcdc85;
    font-size: 20px;
    color: black;
    font-weight: 600;
}

.chatbox .chat p.error {
    color: #ffffff;
    background-color: #ff3737e8;
}

#sendBTN {
    width: 100%;
    padding: 12px;
    outline: none;
    border-top-right-radius: 7px;
    border-top-left-radius: 7px;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    font-size: 20px;
    font-weight: 600;
    background-color: #502f8d;
    cursor: pointer;
    color: white;
    margin-top: 3px;
}

#sendBTN:hover {
    background-color: #162887;
}

/* .lastMessage {
    margin-top: 50px;
    font-size: 35px;
    font-weight: 600;
    color: darkgreen;
    margin-left: 550px;
} */

footer {
    text-align: center;
    margin-top: 1%;
    font-weight: 600;
}


/* Media queries for responsive design */
@media screen and (max-width: 768px) {
    picture {
        display: none;
    }
    .container {
        margin: 1% 2%;
    }

    .container-glass {
        padding: 3% 5%;
    }

    .chatform {
        width: 100%;
        height: 650px;
        float: none;
        clear: both;
        padding: 2%;
        font-size: 16px;
    }

    .chatbox {
        height: 430px;
    }

    .chat-input textarea {
        height: 80px;
        font-size: 18px;
    }

    .chat-box-title {
        font-size: 24px;
    }

    #sendBTN {
        padding: 10px;
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    .container-glass {
        padding: 3% 3%;
    }

    .chatform {
        font-size: 14px;
        padding: 2%;
    }

    .chatbox {
        height: 470px;
    }

    .chat-input textarea {
        height: 60px;
        font-size: 16px;
    }

    .chat-box-title {
        font-size: 20px;
    }

    #sendBTN {
        padding: 8px;
        font-size: 16px;
    }
}

