:root {
    --border-1: 1px solid #ccc;
    --border-1__darker: 1px solid #aaa;

    --boxShadow-1: 0 1.2rem 4rem rgb(74 74 74 / 20%), 0 .2rem .8rem rgba(186, 186, 186, 0.08);
    --boxShadow-2: 0 1.2rem 4rem rgba(0, 0, 0, 0.2), 0 .2rem .8rem rgba(0, 0, 0, 0.08);

    --color-white: white;
    --color-black: black;
    --color-black__pale: rgba(0,0,0, .35);

    --color-grey__dark: #666;
    --color-grey__darker:#b8b8b8;
    --color-grey__light:#ccc;
    --color-grey__lighter:#dde0ec;
    --color-grey__lightest: #f5f5f5;
    --color-grey__lightest-1: #efefef;

    --color-green__lightest: #dcf8c6;

    --color-blue__light: #4f7cff;
    --color-blue__dark: #3d68e0;
    --color-blue__lighter: deepskyblue;
    --color-blue__darker: #21388f;
    --color-blue__lightest: rgb(150, 229, 255);
    --color-blue__darkest: #000041b5;

    --color-purple__darkest: #36188a;
    --color-purple__lightest: #ae96ff4d;

    --color-red: #ff0000;
    --color-red__lightest: rgb(174 150 255 / 19%);

    --gap-small: 0.5rem;
    --gap-medium: 1rem;
    --gap-large: 1.6rem;
}

*, *::after, *::before {
   margin:0;
   padding: 0; 
   box-sizing: inherit;
}

html {
    font-size: 62.5%;
}

body {
    font-family: "Nunito", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;

    display: flex;
    justify-content: space-evenly;
    box-sizing: border-box;
    padding: 1.6rem 1.6rem 0;
    height: 100vh;
}

h1,h2,h3,h4,h5,h6 {
    margin: 1.5rem 0;
}

h2 {
    font-size: 2.5rem;
}

h4 {
    font-weight: lighter;
    font-size: 1.8rem;
}

p {
    font-size: 1.6rem;
}

button {
    border: none;
    cursor: pointer;
}

input {
    font-size: 1.3rem;
}

input:focus {
    outline: none;
    box-shadow: var(--boxShadow-1);
}

.username-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;

    background: var(--color-black__pale);
    backdrop-filter: blur(.8rem);
    -webkit-backdrop-filter: blur(.8rem);

    z-index: 9999;
}


.username-dialog {
    width: min(50rem, 90vw);
    padding: 3.2rem;
    background: var(--color-white);
    border-radius: 1.6rem;
    box-shadow: var(--boxShadow-2);
    display: flex;
    flex-direction: column;
    gap: var(--gap-large);
}

.username-dialog p {
    margin: 0;
    color: var(--color-grey__dark);
}

.username-dialog input {
    padding: 1.2rem 1.6rem;
    font-size: 1.6rem;

    border: var(--border-1);
    border-radius: .8rem;
    outline: none;
}

.username-dialog input:focus {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px var(--color-red__lightest);
}

.username-dialog button {
    padding: 1.2rem 1.6rem;
    font-size: 1.6rem;

    border-radius: .8rem;

    background: var(--color-blue__light);
    color: var(--color-white);
}

.username-dialog button:hover {
    background: var(--color-blue__dark)
}


.message-container {
    width: 75%;
}

.message-box {
    display: flex;
    flex-direction: column;
    gap: var(--gap-large);
    height: 100%
}

.user-details {
    border: var(--border-1);
    background-color: transparent;
    border-radius: 3rem;
    padding: 0.5rem;
    width: 25%;
    display: flex;
    align-items: center;
    gap: var(--gap-small);
    cursor: pointer;
}

.user-image {
    background-image: url("images/user-img.svg");
    background-size: cover;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
}

.user-name{
    font-size: 1.6rem;
}

.separator {
    align-self: stretch;
    width: 1px;
    background: var(--color-grey__light);
    margin: 0 0.25rem;
}

.list-container {
    width: 20%;
    height: 45rem;
    display: flex;
    flex-direction: column;
}

.list-container__title {
    border-bottom: 1px solid var(--color-grey__light);
}

.list-container__inner {
    flex: 1;
    max-height: 50%;
    overflow-y: auto;
}

.list-container__inner::-webkit-scrollbar {
    width: 4px;
    visibility: hidden;
}

.list-container__inner:hover::-webkit-scrollbar {
    visibility: visible;
}

.list-container__inner:hover::-webkit-scrollbar-thumb {
    background: var(--color-grey__darker);
    border-radius: 4px;
}

.list {
    overflow-y: auto;
    min-height: 0;
}

#users div.active {
    border: 1px solid var(--color-blue__light);

    background-color: var(--color-white);
}

#groups div.active {
    border: 1px solid var(--color-blue__light);
    background-color: var(--color-white);
}

.online-item {
    height: 5rem;
    display:flex;
    font-weight: bold;
    font-size: 1.3rem;
    position: relative;
    padding: 0.6rem;
    border-radius: .5rem;
    background-color: var(--color-grey__lightest-1);
    overflow-x: auto;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color .1s ease-out;
}

.online-item:hover {
    background-color: var(--color-grey__lightest);
}

.online-blinker-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 1rem;
}

.online-item:not(.online-item:first-of-type) {
    margin-top: 1rem;
}

.online-blinker {
    width: 1rem;
    height: 1rem;
    border-radius: 100%;
    animation: pulse 1s ease-in-out infinite alternate;
}

.online-item.went-offline .online-blinker{
    animation: none;
    border: 1px solid var(--color-grey__darker);
}


.online-item-title-container {
    display: flex;
    justify-content: space-between;
}
.last-message-preview__time {
    font-weight: normal;
    font-size: 0.9rem;
    align-self: center;
}


.online-item-title__text {
    width: calc(80%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message-preview-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    overflow: hidden;
}

.last-message-preview {
    display: flex;
    justify-content: space-between;
    font-weight: normal;
    font-size: 0.9rem;
}

.last-message-preview__text {
    width: calc(85%);
    text-overflow: ellipsis;
    display: inline-block;
    overflow: hidden;
    text-wrap: nowrap;
}

.unread-count {
    font-size: 1rem;
    align-self: center;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--color-white);
    background-color: var(--color-blue__darkest);
    transition: background-color .2s ease-out;
    text-align: center;
    border-radius: 100%;
}

.message-form {
    display:flex;
    position: relative;
    margin: auto 0 1.6rem;
}

.message-form > button {
    align-self: self-end;
    margin-left: 1rem;
}

.btn {
    background-color: var(--color-blue__light);
    color: var(--color-white);
    position: absolute;
    right: 0.5%;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 100%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease-out;
}

.btn.disabled {
    border: 1px solid var(--color-blue__light);
    background-color: var(--color-white);
    color: var(--color-black);
}

.btn.disabled svg{
    fill: var(--color-blue__light);
    background-color: var(--color-white);
}

.btn:not(.disabled):hover {
    background-color: var(--color-blue__dark);
}

.btn svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: var(--color-white);
    margin-right: .3rem;
}

.messages {
    padding: 2rem;
    height: 30rem;
    overflow-y: auto;
    background-color: var(--color-grey__lighter);
    border-radius: 1rem;
    flex: 1;
    border: var(--border-1);
}

.message {
    font-size: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: var(--gap-small);
    position: relative;
    max-width: 65%;
    padding: 1rem 1.4rem;
    border-radius: 1.8rem;
    line-height: 1.4;
    word-wrap: break-word;
    width: fit-content;
    min-width: 10rem;
    margin-bottom: 1.6rem;
}

.message:last-of-type{
    margin-bottom: 0;
}

.message.admin {
    background-color: var(--color-white);
    margin: 0 auto 1.6rem auto;
}

/* Received */

.message.received {
    background: var(--color-white);
    border-bottom-right-radius: .4rem;
    margin-left: auto;
}

.message.received::after {
    content: "";
    position: absolute;
    right: -.8rem;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 1rem solid var(--color-white);
    border-top: 1rem solid transparent;
}

/* Sent */

.message.sent {
    background: var(--color-green__lightest);
    border-bottom-left-radius: .4rem;
}

.message.sent::after {
    content: "";
    position: absolute;
    left: -.8rem;
    bottom: 0;
    width: 0;
    height: 0;
    border-right: 1rem solid var(--color-green__lightest);
    border-top: 1rem solid transparent;
}

.message-time {
    font-size: .77rem;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: .3rem;
}

.message-checkmark-container {

}

.message-checkmark {
    background-clip: text !important;
    color: transparent;
    -webkit-text-fill-color: transparent;
    background: linear-gradient(45deg, blue, red);
}

.message-checkmark:nth-of-type(2) {
    margin-left: -.5rem;
}

.message-input {
    background-color: transparent;
    border: var(--border-1);
    border-radius: 3rem;
    padding: 1.5rem;
    padding-right: 4rem;
    width: 100%;
    transition: box-shadow 0.1s ease-out;
}

.message-input:focus {
    border: var(--border-1__darker);
}

.message-input:focus + button {
    transform: translateY(-50%) scale(1.02);
}

.unread-ribbon {
    font-size: 1.4rem;
    margin-bottom: 1.6rem;
    background-color: var(--color-purple__lightest);
    text-align : center;
    border-radius : .5rem;
    color: var(--color-purple__darkest);
    border: 1px solid var(--color-purple__lightest);
    padding: 0.3rem;
}

.notifications-container {
  position : absolute;
  bottom : 10px;
  right : 10px;
  height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
}

.notification-container::-webkit-scrollbar {
  display: none;
}

.notifications {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}


.notification {
  height : 15rem;
  width : 45rem;
  padding : 2rem 4rem;
  background : #767676;
  border-radius : 5px;
  color : white;
  border : 1px solid #7c7ca9;
  animation: notification 5s ease-in-out forwards;
  cursor: pointer;
  margin-bottom: 1.6rem;
}

.notification-title {
    font-weight: bold;
    margin-bottom: 1.6rem;
}

.notification-message {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

@keyframes pulse {
    from {
        background-color: var(--color-blue__lighter);
    }
    to {
        background-color: var(--color-blue__lightest);
    }
}

@keyframes notification {
    0% {
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    75% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@media (max-width: 1480px) {
    html {
        font-size: 58%;
    }
}

@media (max-width: 1280px) {
    html {
        font-size: 54%;
    }
}

@media (max-width: 1000px) {
    html {
        font-size: 50%;
    }
}

@media (max-width: 850px) {
    html {
        font-size: 45%;
    }
}

@media (max-width: 690px) {
    html {
        font-size: 40%;
    }
}

@media (max-width: 500px) {
    html {
        font-size: 35%;
    }
}
