/*
author: David den Uyl (djdenuyl@gmail.com)
date: 2023-09-17
*/
:root {
    @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@700&display=swap');
    font-family: 'Open Sans', sans-serif;

    --white: #ffffe2;
	--black: #2e3d44;
	--blue: #264653;
	--teal:	#2A9D8F;
	--yellow: #E9C46A;
	--orange: #F4A261;
    --red: #E76F51;

    --messages-width: 40%;
    --user-input-width: 30%;
}

html, body {
    padding: 0;
    margin: 0;
    overflow: hidden;
}

#app-container {
    width: 100vw;
    height: 100vh;

    background: var(--blue);
    color: var(--white);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
}

.user-name {
    all: unset;
    width: 100%;
    height: 2rem;
    text-align: center;
    font-size: 1.5rem;
    padding-top: 0.5rem;
}

.user-input {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;

    height: 2rem;
    width: var(--user-input-width);

    border-radius: 10px;
    background: var(--teal);

    padding-left: 1rem;
}

.message-field {
    all: unset;
    height: 1.5rem;
    padding-top: 0.5rem;
}

.send-button {
    all: unset;

    position: absolute;
    right: 0;

    height: 100%;
    width: 20%;

    background: var(--yellow);
    cursor: pointer;

    display: grid;
    place-items: center;
    color: var(--black);

    border-radius: 0 10px 10px 0;
}

.messages {
    width: var(--messages-width);
    height: 50%;
    background: var(--teal);
    border-radius: 10px;
    padding: 1rem;

    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-snap-type: y proximity;
}

.messages > div:last-child {
    scroll-snap-align: end;
}

::-webkit-scrollbar-button {
    background: var(--blue);
}

@media (max-aspect-ratio: 1/1) {
    :root {
        --messages-width: 60%;
        --user-input-width: 45%;
    }
}

.message {
    background: var(--orange);
    padding:0.2rem 0.5rem 0.2rem 0.5rem;
    border-radius: 5px;
    width: fit-content;
    max-width: 100%;
    color: var(--black);

    display: flex;
    flex-direction: column;
}

.message-sender {
    color: grey;
    font-weight: bold;
    font-size: 0.5rem;
}

.message-content {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: flex-end;
    justify-content: space-between;
    overflow-x: hidden;
}

.message-time {
    color: grey;
    font-size: 0.5rem;
}

.you {
    background: var(--red);
    margin-left: auto;
    color: var(--white);
}

.clients-header {
    font-weight: bold;
    color: var(--yellow);
}

.clients {
    display: flex;
    flex-direction: column;
    align-items: center;
}