:root {
    color-scheme: light dark;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Halvar-SuisseIntl',Arial,sans-serif;
    background-color: light-dark(#fffaf6, #17171b);
    /*background-image: url(/assets/img/chat-bg-pattern-light.png);*/
    /*background-size: auto;*/
}

body:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: -1;
    /*background-color: light-dark(#fff, #17171b);*/
    background-image: url(/assets/img/chat-bg-pattern-light.png);
    background-size: auto;
}

@media (prefers-color-scheme: light) {
    body:before {
        opacity: 0.4;
    }
}

@media (prefers-color-scheme: dark) {
    body:before {
        background-image: url(/assets/img/chat-bg-pattern-dark.png);
    }
}

.auth-screen {
    position: absolute;
    background: #2a9d8f;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    z-index: 100;
}

h1 {
    color: #fff;
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.auth-screen__auth-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 16px;
    width: 100%;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
}

#userInput {
    background: #66bdb3;
    color: #fff;
    min-width: 180px;
    width: inherit;
    padding: 12px;
    box-sizing: border-box;
    border-radius: 12px;
    border: none;
    outline: none;
}

#userInput::placeholder {
    color: rgb(255 255 255 / 80%);
}

button {
    font-size: 16px;
    padding: 12px 32px;
    background: #f4a261;
    color: white;
    border: none;
    border-radius: 40px;
    cursor: pointer;
}

.enable-notifications {
    display: none;
}

.chat-reload-btn {
    position: absolute;
    display: flex;
    top: 8px;
    right: 8px;
    z-index: 10000;
}

.chat-reload-btn svg {
    width: 40px;
    height: 40px;
}

.chat-reload-btn path {
    fill: light-dark(#333, #a5a5a5);
}

#messages {
    border: 0 solid light-dark(#dbdbdb, #2e2e37);
    border-bottom-width: 1px;
    padding: 10px;
    overflow-y: auto;
    margin-bottom: 10px;
    box-sizing: border-box;
}
#messages::-webkit-scrollbar {
    background: transparent;
    width: 10px;
}
#messages::-webkit-scrollbar-button {
    height: 6px;
}
#messages::-webkit-scrollbar-thumb {
    background-color: rgb(141 141 141 / 50%);
    background-clip: padding-box;
    border: 2px solid transparent;
    border-radius: 10px;
}
#messages::-webkit-scrollbar-thumb:hover {
    background-color: rgb(141 141 141 / 100%);
}
.message {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 4px;
    width: fit-content;
    max-width: 90%;
    margin-bottom: 10px;
    padding: 8px;
    text-align: left;
    background-color: light-dark(#f5f5f5, #43434b);
    border-radius: 10px;
}

.message.own {
    background: #2a9d8f;
    color: #fff;
    margin-left: auto;
    align-items: flex-end;
}

.message.own .text {
    color: light-dark(#fff, #fff);
}

.message .user {
    font-weight: bold;
    color: light-dark(#333, #a5a5a5);
}

.text-wrapper {
    display: flex;
    align-items: flex-end;
    width: 100%;
    justify-content: space-between;
}

.text {
    color: light-dark(#17171b, #fff);
}

.message .time {
    font-size: 0.8em;
    color: #999;
    margin-left: 10px;
}

.message.own .time {
    color: #fff;
    opacity: .7;
}

.pwa-status-wrap {
    font-size: 12px;
    color: #9f9f9f;
    text-align: center;
    margin-bottom: 8px;
}

.date-stamp {
    display: flex;
    flex-direction: column;
    min-height: fit-content;
}

.date-stamp-text {
    position: sticky;
    top: 0;
    display: flex;
    width: fit-content;
    background-color: light-dark(#e3e3e3, #343239);
    color: light-dark(#17171b, #d3d3d3);
    padding: 4px 8px;
    margin: 0 auto;
    margin-bottom: 10px;
    border-radius: 30px;
}

#messageForm {
    display: flex;
    gap: 10px;
    padding: 10px 10px 32px;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
}

input, textarea {
    font-size: 16px;
}
#messageForm input, #messageForm textarea {
    border: 1px solid #9b9b9b;
    border-radius: 8px;
    outline: none;
}

#messageInput {
    background-color: rgb(255 255 255 / 1%);
    backdrop-filter: blur(3px);
    width: 100%;
    flex-grow: 1;
    padding: 8px;
    font-family: 'Halvar-SuisseIntl',Arial,sans-serif;
    border: 1px solid #9b9b9b;
    border-radius: 8px;
    outline: none;
    min-height: calc((1em * 1.3) + 18px);
    max-height: calc(8em * 1.3);
    line-height: 1.3;
    font-size: 16px;
    overflow: auto;
    -webkit-user-select: text;
    user-select: text;
}

#messageInput:before {
    content: attr(data-placeholder);
    opacity: .6;
    position: absolute;
    transition: .3s ease;
}

#messageInput:not(:empty):before {
    opacity: 0;
    transform: translateX(12px);
}

#messageInput:has(br):before {
    opacity: .6 !important;
    transform: translateX(0px) !important;
}

#messageInput:has(div br):before {
    opacity: 0 !important;
    transform: translateX(12px) !important;
}

.message-send {
    width: 40px;
    height: 40px;
    background-image: url(/assets/icons/send_icon.svg);
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center 40%;
    flex-shrink: 0;
    padding: 0;
    transition: .3s ease;
}

#messageInput:empty + .message-send, #messageInput:has(br):not(:has(div br)) + .message-send {
    opacity: .6;
    pointer-events: none;
}

.private-chat-content-title {
    color: light-dark(#d3d3d3, #17171b);
}

#onlineUsersList h3 {
    color: light-dark(#d3d3d3, #17171b);
}

.online-user span {
    color: light-dark(#d3d3d3, #17171b);
}

.chat-header {
    color: light-dark(#d3d3d3, #17171b);
}

@media (min-width: 1200px) {
    button:hover {
        background-color: #fb862a;
    }
}

@media (max-width: 639px) {
    html, body {
        position: fixed;
        top: 0;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }
    
    body:before {
        background-size: 160%;
        bottom: auto;
        height: 100dvh;
        mix-blend-mode: unset;
    }
    
    .chat-container {
        position: absolute;
        width: 100%;
    }
    
    h1 {
        font-size: 28px;
    }
}