#chat-button{
    position: absolute;
    aspect-ratio: 1;
    width: 5rem;
    background: var(--ui-bittersweet-100);
    right: -7rem;
    bottom: 0;
    border-radius: 100%;
    box-shadow: -2px 2px 0 var(--ui-fg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

#chat-button.disabled{
    background: var(--ui-dark-gray-100);
    cursor: not-allowed; 
}

#chat-button i{
    color: white;
}

#chat{
    display: flex;
    flex-direction: column;
    position: absolute;
    width: 300px;
    height: 350px;
    background: white;
    right: 50%;
    bottom: calc(100% + 25px);
    border-radius: 1rem 1rem 0 1rem;
    border-top: 2px solid var(--ui-fg-color);
    border-left: 2px solid var(--ui-fg-color);    
}

#chat::after{
    content: "";
    width: 0;
    height: 0;
    border-style: solid solid solid none;
    border-width: 20px 20px 20px;
    border-color: transparent white transparent transparent;
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translateY(50%);
}

#chat .chat-top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3rem;
    background: var(--ui-bg-color);
    border-radius: 13px 13px 0 0;
    padding: 0.25rem 0.75rem;
    box-sizing: border-box;
    color: white;
}

#chat .chat-top .material-icons {
    cursor: pointer;
}

#chat .chat-messages{
    flex-grow: 2;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.message {
    max-width: 75%;
    min-width: 33%;
    width: fit-content;
    font-size: 0.9rem;
    white-space: break-spaces;
    padding: 0.5rem;
    margin: 0.5rem;
    background: var(--ui-light-gray-100);
    border-radius: 1rem 1rem 1rem 0;
    border-right: 2px solid var(--ui-light-gray-300);
    border-bottom: 2px solid var(--ui-light-gray-300);
}

.message.message-right {
    align-self: flex-end;
    border-radius: 1rem 1rem 0 1rem;
    background: var(--ui-sunflower-100);
    border-right: none;
    border-left: 2px solid var(--ui-light-gray-300);
}

.sender {
    font-weight: bold;
    font-size: small;
    margin: 0;
}

.content {
    padding-right: 1.75rem;
}

.time {
    font-size: xx-small;
    color: var(--ui-dark-gray-200);
    text-align: right;
    margin-top: -1em;
}

#chat .chat-bottom{
    height: 20%;
    border-top: 1px solid var(--ui-dark-gray-100);
    display: flex;
    justify-content: space-between;
    position: relative;
}

#chat .chat-bottom input {
    background: transparent;
    border: none;
    padding: 0.75rem;
    box-sizing: border-box;
    font-size: 1rem;
    width: 85%;
}

#chat .chat-bottom input:focus {
    outline: none;
}

#chat .chat-bottom .send {
    background: transparent;
    border: none;
    padding: 0.75rem;
}

#chat .chat-bottom .send .material-icons {
    color: var(--ui-bittersweet-100);
}

#chat .chat-top, #chat .chat-messages, #chat .chat-bottom {
    cursor: default;
}

.emoji-container {
    display: flex;
    position: relative;
}

.emoji-container .material-icons {
    color: var(--ui-dark-gray-100);
    cursor: pointer;
    padding: 0 0.3rem 0 0.5rem;
    margin: auto;
}

.emoji-container .emojis {
    display: grid;
    overflow: auto;
    padding: 0.2rem;
    border-radius: 10px;
    border: 1px solid var(--ui-dark-gray-100);
    grid-template-columns: repeat(6,1fr);
    grid-template-rows: auto;
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: white;
    margin-bottom: 24px;
}

.emoji-container .emojis span {
    font-size: 1.5rem;
}

.emoji-datalist {
    position: absolute;
    height: 2rem;
    left: 3rem;
    border: 1px solid var(--ui-dark-gray-100);
    border-radius: 5px;
    top: -3rem;
    padding: 0.25rem;
    background: white;
}

.emoji-datalist .overflow-wrapper {
    position: relative;
    display: flex;
    column-gap: 0.5rem;
    align-items: center;
    max-width: 180px;
    overflow-x: auto;
    overflow-y: hidden;
}

.emoji-datalist.more::after {
    content: "";
    background: linear-gradient(to left, white, transparent);
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    box-sizing: border-box;
}

.emoji-datalist span {
    padding: 0.25rem;
}

.emoji-datalist span, .emoji-container .emojis span {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.emoji-datalist span:hover, .emoji-datalist span.highlight, .emoji-container .emojis span:hover {
    background: var(--ui-light-gray-200);
}

/* laut google aktuell die größten Tablets auf dem Mark, es gibt größere aber das sind die
std. Versionen und damit die meist genutzten! */
@media (max-width: 1133px) or (max-height: 680px) {
    #chat{
        position: fixed;
        height: 100dvh;
        width: 100dvw;
        top:0;
        left:0;
        border: none;
        border-radius: 0;
        z-index: 1;
    }

    #chat .chat-top {
        border-radius:  0;
        height: 5rem;
    }

    #chat .chat-bottom {
        height: 10%;
    }

    #chat .emoji-container .emojis {
        width: 100vw;
        height: 200px;
        background: white;
        margin-bottom: 0;
        border: none;
        border-top: 1px solid var(--ui-dark-gray-100);
        border-radius: 0;
        left: 0;
        bottom: 100%;
        grid-template-columns: repeat(14,1fr);
    }
}

@media (max-width: 1380px) or (max-height: 680px) {
    #chat-button {
        right: 1rem;
        bottom: 1rem;
        width: 3.5rem;
    }

    #chat-button .material-icons {
        font-size: 20px;
    }
}

@media (max-width: 880px) {
    #chat-button {
        position: fixed;
    }
}
