*,
::before,
::after{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
} 
:root{
    scroll-behavior: smooth;
    font-size: clamp(1rem, 1.2vmax, 3rem);
}
html, body{
    height: 100%;
}
body{
    --accent-color: #3D5AFE;
    --secondary-color: #ffac2e;
    --text-color: 17, 17, 17;
    --text-color-light: 100, 100, 100;
    --foreground-color: 255, 255, 255;
    --background-color: #efefef;
    --error-color: red;
    color: rgba(var(--text-color), 1);
    background: rgba(var(--foreground-color), 1);
    #scroll_to_bottom{
        background: rgba(var(--foreground-color), 1);
        box-shadow: 0 0.3rem 0.4rem rgba(0, 0, 0, 0.2);
    }
}
body[data-theme='dark']{
    --accent-color:#3D5AFE;
    --secondary-color: #d60739;
    --text-color: 240, 240, 240;
    --text-color-light: 170, 170, 170;
    --foreground-color: 20, 20, 20;
    --error-color: rgb(255, 106, 106);
    .initial{
        color: rgba(var(--text-color), 1) !important;
        box-shadow: 0 0.1rem 0.1rem rgba(0, 0, 0, 0.16);
    }
    .message{
        color: rgba(var(--text-color), 1);
    }
    #scroll_to_bottom{
        background: linear-gradient(rgba(var(--text-color), 0.1), rgba(var(--text-color), 0.1)), rgba(var(--foreground-color), 1);
        box-shadow: 0 0.4rem 0.4rem rgba(0, 0, 0, 0.3);
    }
}
p{
    line-height: 1.6;
}
h1{
    font-size: 3rem;
}
h2{
    font-size: 2rem;
}
h3{
    font-size: 1.5rem;
}
h4{
    font-size: 1.1rem;
}
h5{
    font-size: 0.8rem;
}
h1, h2, h3, h4, h5{
    color: rgba(var(--text-color), 1);
    font-weight: 600;
}
textarea{
    background: rgba(var(--text-color), 0.06);
    border: none;
    border-radius: 0.3rem;
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    color: rgba(var(--text-color), 1);
    resize: none;
    line-height: 1.6;
    &:focus{
        outline: none;
        box-shadow: 0 0 0 0.1rem var(--accent-color);
    }
}
strong{
    font-weight: 500;
}
.flex{
    display: flex;
}
.grid{
    display: grid;
}
.grid-2{
    grid-template-columns: auto auto;
    gap: 1em;
}
.align-center{
    align-items: center;
}
.justify-right{
    margin-left: auto;
}
.direction-column{
    flex-direction: column;
}
.rest{
    flex: 1;
}
.hide{
    opacity: 0;
    pointer-events: none;
}
.hide-completely{
    display: none !important;
}
.no-transformations{
    transform: none !important;
}
.breakable{
    overflow-wrap: break-word;
}
.text-overflow{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sticky{
    position: sticky;
    top: 1rem;
}
.light-text{
    color: rgba(var(--text-color-light), 1);
}
.accent-color{
    color: var(--accent-color);
}
.secondary-color{
    color: var(--secondary-color)
}
.fab{
    filter: drop-shadow(0 0.4rem 0.3rem rgba(0, 0, 0, 0.2));
    margin: 1.5rem;
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 1;
    --padding: 0.9rem 1.6rem;
    .icon{
        margin-left: 0 !important;
        margin-right: 0.5rem;
        height: 1.2rem;
        width: 1.2rem;
        stroke-width: 8;
        stroke: white;
    }
}
a:any-link{
    word-wrap: break-word;
    color: var(--accent-color);
    font-weight: 500;
}
.solid-background{
    background: var(--background-color) !important;
}
.normal-weight{
    font-weight: normal;
}
.warning{
    display: flex;
    background: wheat;
    color: #111;
}
.icon{
    fill: none;
    stroke-width: 6;
    stroke: rgba(var(--text-color), 1);
    height: 1.2rem;
    width: 1.2rem;
    overflow: visible;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ripple{
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: rgba(var(--text-color), 0.2);
    pointer-events: none;
}
.interact{
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
sm-input{
    --border-radius: 0.5rem;
}
sm-popup{
    sm-input + sm-input{
        margin-top: 1rem;
    }
}
.popup-header{
    padding: 0.5rem 1.5rem 0 1.5rem;
    display: flex;
    align-items: center;
    width: 100%;
    .icon{
        padding: 0.7rem;
        height: 2.4rem;
        width: 2.4rem;
        stroke-width: 8;
        transform: translateX(-0.5rem);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .back{
        transform: none;
    }
    button,
    sm-button{
        width: auto;
        margin-left: auto;
    }
}
.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    .icon {
        cursor: pointer;
        padding: 0.4rem;
        height: 1.8rem;
        width: 1.8rem;
    }
    .copy {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    h4{
        margin-bottom: 0 !important;
    }
}
#confirmation_popup,
#prompt_popup {
    flex-direction: column;
    h4 {
        font-weight: 500;
        margin-bottom: 0.5rem;
    }
    sm-button{
        margin: 0;
    }
    .flex {
        padding: 0;
        margin-top: 1rem;
        sm-button:first-of-type {
            margin-right: 0.6rem;
            margin-left: auto;
        }
    }
}
.page{
    align-items: flex-start;
    width: 100%;
    height: 100%;
}
.card{
    display: flex;
    flex-direction: column;
    margin: 1rem 0;
}
.tip{
    font-size: 0.9rem;
    color: rgba(var(--text-color), 0.8);
}
sm-button[variant="primary"]{
    --foreground-color: 255, 255, 255;
}
.danger{
    color: var(--error-color);
}
.logo-section{
    display: flex;
    position: relative;
    align-items: center;
    height: max-content;
    margin: 0.5rem 0;
    h5{
        font-size: 1.1rem !important;
        font-weight: 500;
    }
    .main-logo{
        height: 1.4rem;
        margin-right: 0.4rem;
        fill: rgba(var(--text-color), 1);
        stroke: none;
    }
    img{
        width: 2rem;
        margin-right: 0.5rem;
    }
}
.select-file{
    input[type="file"]{
        display: none;
    }
}
#landing{
    display: grid;
    border-radius: 0.6rem;
    width: 100%;
    height: 100%;
    padding: 0 1.5rem;  
    align-items: center;
    .logo-section{
        padding: 1.5rem;
        display: flex;
    }
    .title-font{
        line-height: 1.2;
        font-weight: 700;
        font-size: 2.5rem;
    }
    .left{
        display: grid;
        flex-direction: column;
        padding-bottom: 1.5rem;
        z-index: 1;
        h4{
            color: var(--accent-color);
            margin-bottom: 0.5rem;
            font-weight: 500;
        }
        sm-button{
            margin: 1.5rem 0 2rem 0;
            width: max-content;
        }
        h3{
            margin-bottom: 1rem;
            font-weight: 500;
        }
        p{
            margin-top: 1rem;
            font-size: 1.1rem;
            color: rgba(var(--text-color), 0.8);
        }
        .flex{
            sm-button:first-of-type{
                margin-right: 1rem;
            }
        }
    }
}
#landing_page{
    grid-template-rows: auto 1fr;
    overflow-y: auto;
    background: rgba(var(--foreground-color), 1);
}
.logo-section{
    padding: 1.5rem;
}
#landing_illustration{
    position: relative;
    width: 100%;
}
#sign_in{
    padding: 1.5rem;
    width: 100%;
    height: 100%;
    align-items: flex-start;
    .flex{
        width: 100%;
        flex: 1;
    }
    sm-input{
        margin: 1.5rem 0;
    }
    h2{
        margin-top: 2rem;
        font-weight: 500;
    }
    h4 {
        font-weight: 500;
        margin-bottom: 1.5rem;
    }
    h5{
        opacity: 0.8;
        font-weight: 500;
    }
    pin-input{
        margin: 1rem 0 2rem 0;
    }
    sm-button{
        width: 100%;
        --padding: 0.8rem 1.6rem;
    }
    #remove_account{
        margin-top: 1rem;
    }
    p {
        margin-bottom: 0.5rem;
        max-width: 35ch;
        margin-top: 0.5rem;
    }
}
#on_boarding_page{
}
.frame{
    height: 100%;
    display: flex;
    flex-direction: column;
    width: min(24rem, 100%);
    justify-self: center;
    padding: 1.5rem;
    .h2{
        margin-bottom: 1rem;
        font-weight: 500;
    }
    sm-button[variant="primary"]{
        margin-top: 1.5rem;
    }
}
#frame_1{
    .warning{
        margin: 1rem 0;
        padding: 1rem;
        border-radius: 0.5rem;
    }
    #generate_flo_id{
        width: 100%;
    }
    #credentials_section{
        animation: slide-down 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        margin: 2rem 0;
    }
    h4, h5{
        font-weight: 500;
    }
    .copy-row:not(:last-of-type){
        margin-bottom: 1.5rem;
    }
}
#frame_2{
    pin-input{
        margin: 1rem 0;
    }
}
@keyframes slide-down{
    from{
        transform: translateY(-1rem);
    }
    to{
        transform: none;
    }
}
#loading_page{
    height: 100%;
    display: grid;
    place-content: center;
    justify-items: center;
}
.page__loader{
    z-index: 1;
    transform-origin: bottom;
    height: 6rem;
    width: 6rem;
    animation: bounce 0.5s infinite alternate ease-in;
}
.shadow{
    margin-top: -1rem;
    width: 5rem;
    height: 2rem;
    background: rgba(var(--text-color), 0.1);
    border-radius: 50%;
    animation:  scale 0.5s infinite alternate ease-in;
    margin-left: 1rem;
}
.page__tag-line{
    margin-top: 2rem;
}
@keyframes bounce{
    0%{
        transform: scaleY(1) translateY(-4rem);
    }
    90%{
        transform: scaleY(1) translateY(0);
    }
    100%{
        transform: scaleY(0.8) ; 
    }
}
@keyframes scale{
    0%{
        transform: scale(0.5);
    }
    90%{
        transform: scale(1.05);
    }
    100%{
        transform: scale(1);
    }
}
#main_page{
    width: 100%;
    height: 100%;
}
.initial{
    position: relative;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 500;
    width: 2.8rem;
    height: 2.8rem;
    aspect-ratio: 1/1;
    color: white;
    box-shadow: 0 0.1rem 0.1rem rgba(0, 0, 0, 0.06);
    border-radius: 2rem;
    text-transform: uppercase;
    user-select: none;
}
.filled{
    fill: rgba(var(--text-color), 0.7);
    stroke: none !important;
}
.group-icon{
    height: 1.6rem;
    width: 1.6rem;
    fill: white;
    stroke: none;
}
.contact{
    position: relative;
    display: grid;
    gap: 0 1rem;
    padding: 0.8rem 1.5rem;
    align-items: center;
    flex-shrink: 0;
    user-select: none;
    overflow: hidden;
    &:not(.chat){
        grid-template-columns: auto 1fr;
        grid-template-areas: 'dp .';
    }
    &.chat,
    &.group{
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 'dp . time'
                            'dp . menu';
    }
    &.admin{
        grid-template-columns: auto 1fr auto;
    }
    &.selected{
        background-color: rgba(var(--text-color), 0.06);
    }
    .initial{
        grid-area: dp;
    }
    .name{
        width: 100%;
        font-size: 1em;
        font-weight: 500;
        color: rgba(var(--text-color), 0.8);
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }
    .last-message{
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-weight: 400;
        font-size: 0.9em;
        color: rgba(var(--text-color), 0.8);
    }
    .menu{
        grid-area: menu;
        justify-self: flex-end;
        padding: 0.2rem;
        fill: rgba(var(--text-color), 1);
    }
    .time{
        font-weight: 500;
        color: rgba(var(--text-color), 0.7);
        grid-area: time;
    }
    .admin-tag{
        padding: 0.1rem 0.6rem;
        font-size: 0.8rem;
        border: var(--accent-color) thin solid;
        border-radius: 3rem;
    }
}
.tick{
    position: absolute;
    bottom: -0.2rem;
    right: -0.2rem;
    height: 1.2rem;
    width: 1.2rem;
    .icon{
        height: 100%;
        width: 100%;
        padding: 0.4rem;
        stroke-width: 16;
        border-radius: 1rem;
        background: rgba(var(--text-color), 1);
        stroke: rgba(var(--foreground-color), 0.8);
    }
}
#selected_contacts{
    padding: 1rem 1.5rem;
    h4{
        font-weight: 500;
        font-size: 1rem;
    }
    .warning{
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
        border-radius: 0.5rem;
        margin: 1rem 0;
        line-height: 1.5;
    }
    sm-button{
        margin-bottom: 0;
    }
}
#selected_contacts_container{
    display: flex;
    overflow: auto hidden;
    &:not(:empty){
        margin-top: 1.5rem;
    }
    .contact-preview{
        display: flex;
        flex-shrink: 0;
        align-items: center;
        cursor: pointer;
        margin-right: 0.5rem;
        background: rgba(var(--text-color), 0.1);
        padding: 0.4rem 0.5rem;
        border-radius: 2rem;
        .initial{
            width: 1.6rem;
            height: 1.6rem;
            font-size: 0.9rem;
        }
        .name{
            font-size: 0.9rem;
            color: rgba(var(--text-color), 0.8);
            margin-left: 0.5rem;
        }
        .tick{
            position: relative;
            bottom: auto;
            right: auto;
            margin-left: 0.5rem;
        }
    }
}
#contact_details_popup{
    --body-padding: 0 0 1.5rem 0;
    .popup-section{
        margin: 1.5rem;
    }
    h5{
        font-weight: 500;
        opacity: 0.8;
    }
    .copy-row{
        h4{
            font-weight: 400;
        }
    }
    .group-icon{
        padding: 0.2rem !important;
        height: 3rem;
        width: 3rem;
    }
    #contact_initial{
        height: 4.6rem;
        width: 4.6rem;
        font-size: 2.4rem;
        border-radius: 4rem;
        margin-top: 3rem;
        margin-bottom: 0.5rem;
    }
    #contact_name{
        margin: 0.6rem 1.5rem;
        &::part(text){
            font-size: 1.2rem;
            font-weight: 500;
        }
    }
    .option{
        .icon{
            padding: 0;
            width: 1.2rem;
            background: none;
        }
    }
}
#warn_no_encryption, .date-card, .group-event-card{
    padding: 0.4rem 0.8rem;
    font-weight: 500;
    background-color: rgba(var(--text-color), 0.04);
    border-radius: 0.5rem;
    color: rgba(var(--text-color), 0.8);
    margin: 1rem 0;
    justify-self: center;
    align-self: center;
    text-align: center;
}
.group-event-card{
    font-size: 0.8rem;
    font-weight: 400;
}
#warn_no_encryption{
    background: rgb(255, 253, 141);
    color: #111;
}
.contact .initial::after,
.mail-card .initial::after{
    content: '';
    position: absolute;
    bottom: -0.1rem;
    right: -0.1rem;
    height: 1rem;
    width: 1rem;
    background: var(--accent-color);
    border-radius: 100%;
    border: solid rgba(var(--foreground-color), 1) 1px;
    transform: scale(0);
    transition: transform 0.3s;
}
.contact.unread .initial::after,
.mail-card.unread .initial::after{
    transform: scale(1);
}
.mail-card.unread,
.contact.unread{
    .time, .date{
        color: var(--accent-color);
    }
    h4{
        color: rgba(var(--text-color), 1);
    }
    h4, h5 ,p{
        font-weight: 700;
    }
}
.mail-card{
    position: relative;
    display: grid;
    gap: 0 1rem;
    padding: 0.8rem 1.5rem;
    align-items: center;
    flex-shrink: 0;
    user-select: none;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'dp sender date'
                         'dp subject subject'
                         'dp desc desc' ;
    .initial{
        grid-area: dp;
        align-self: flex-start;
        height: 2rem;
        width: 2rem;
        font-size: 1rem;
    }
    .sender{
        width: 100%;
        font-size: 0.8rem;
        font-weight: 500;
        color: rgba(var(--text-color), 0.8);
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }
    .date{
        grid-area: date;
        margin-left: auto;
        font-weight: 500;
        white-space: nowrap;
    }
    .subject{
        grid-area: subject;
        font-size: 1em;
        margin-top: 0.3rem;
        font-weight: 500;
    }
    .description{
        grid-area: desc;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;  
        overflow: hidden;
        font-size: 0.9em;
        margin-top: 0.2rem;
        color: rgba(var(--text-color), 0.8);
    }
}
@keyframes slide{
    from{
        opacity: 0;
        transform: translateX(-1rem);
    }
    to{
        opacity: 1;
        transform: none;
    }
}
#mail_container{
    width: 100%;
}
.mail{
    position: relative;
    &:not(:first-of-type){
        margin-top: 2rem;
        padding-inline-start: 1rem;
    }
    &:not(:first-of-type)::before{
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 0.2rem;
        height: 100%;
        background: rgba(var(--text-color), 0.2);
    }
    .mail-header{
        align-self: start;
        margin-bottom: 1rem;
        padding: 1.5rem;
    }
    .sender-name{
        font-weight: 500;
        margin-bottom: 0.5rem;
    }
    .flo-id{
        font-weight: 400;
        max-width: 90%;
    }
    .flex:first-of-type{
        margin-bottom: 1rem;
    }
    .back{
        margin: 0 0 0 -0.5rem;
    }
    .mail-subject,
    .mail-content{
        padding: 0 1.5rem;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    .mail-subject{
        margin-bottom: 0.4em;
    }
    .mail-content{
        height: max-content;
        max-width: 60ch;
        white-space: pre-wrap;
    }
}
.logo-section{
    display: grid;
    grid-template-columns: auto 1fr;
}
.option{
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    user-select: none;
    .icon{
        height: 1.4rem;
        width: 1.4rem;
        margin-right: 1rem;
        stroke: rgba(255, 255, 255, 0.8);
    }
}
#main_navbar{
    position: fixed;
    flex-direction: column;
    height: 100%;
    bottom: 0;
    top: 0;
    padding: 0;
    width: max(16rem, 60vw);
    background: rgba(var(--foreground-color), 1);
    .logo-section{
        padding: 0 1rem;
    }
    .active{
        background: var(--accent-color);
        .icon{
            stroke: white;
        }
        .label{
            color: white;
        }
    }
    .label{
        font-weight: 500;
        font-size: 0.9rem;
    }
    .navbar-item{
        height: auto;
        justify-content: flex-start;
        flex-direction: row;
        flex: none;
        padding: 1rem;
        .icon{
            height: 1.2rem;
            width: 2.4rem;
            margin-right: 0.8rem;
        }
        &:last-of-type{
            margin-top: auto;
        }
        .icon{
            height: 1.2rem;
            width: 1.2rem;
        }
        &.badge::after{
            right: 0;
            top: 0;
            position: absolute;
            content: attr(data-notifications);
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0.4rem;
            line-height: 0;
            height: calc(1em + 0.4rem);
            background: #00C853;
            color: rgba(var(--foreground-color), 1);
            border-radius: 2rem;
            transition: transform 0.3s;
        }
        &.badge.active::after,
        &.badge[data-notifications="0"]::after,
        &.badge[data-notifications=""]::after{
            transform: scale(0);
        }
    }
}
#auto_complete_contact{
    position: relative;
    justify-content: flex-start;
    padding-bottom: 0;
}
#mail_contact_list{
    max-height: 40vh;
    overflow-y: auto;
    position: absolute;
    top: 100%;
    background: rgba(var(--foreground-color), 1);
    z-index: 1;
    border-radius: 0.4rem;
    box-shadow: 0 0.1rem 0.1rem rgba(0, 0, 0, 0.1), 0 0.2rem 0.5rem rgba(0, 0, 0, 0.16);
    width: 100%;
    .contact{
        grid-template-columns: auto 1fr;
        grid-template-areas: 'dp .' 'dp .';
    }
    sm-menu{
        display: none;
    }
}
#contacts{
    position: relative;
    overflow-x: hidden;
    #all_contacts,
    #group_creation_panel{
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1;
        background: rgba(var(--foreground-color), 1);
        .header{
            padding-top: 0.7rem;
        }
    }
    .scrolling-wrapper{
        height: 100%;
        flex: 1;
        overflow-y: auto;
        .empty-state{
            padding: 1.5rem;
            text-align: center;
        }
    }
    #contacts_container{
        padding-bottom: 1.5rem;
        &::before{
            display: flex;
            content: 'Contacts';
            font-size: 0.9em;
            color: rgba(var(--text-color), 0.9);
            padding: 1rem 1.5rem;
        }
    }
}
#group_creation_panel{
    .grid{
        padding: 1.5rem;
        gap: 1rem;
    }
    .group-icon{
        background: var(--accent-color);
        justify-self: center;
        height: 8rem;
        width: 8rem;
        margin-bottom: 1rem;
        padding: 2rem;
        border-radius: 50%;
        font-size: 4rem;
    }
}
#contacts, #mails{
    position: relative;
    grid-template-rows: max-content 1fr;
}
#contacts, #mails, #settings_page{
    height: 100vh;
    overflow-y: hidden;
    .header{
        padding: 1rem 1.5rem 1rem 1.5rem;
        position: relative;
        gap: 0.5rem;
        min-height: 4rem;
        .expanding-search{
            position: absolute;
            width: 100%;
            padding: 0.7rem 1.5rem;
            background: rgba(var(--foreground-color), 1);
            transform: scale(0.9);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s, transform 0.3s;
            &.expand{
                transform: none;
                opacity: 1;
                pointer-events: all;
            }
        }
        sm-input{
            margin: 0;
            width: 100%;
            --padding: 0.5rem 1rem;
        }
        h4{
            text-transform: capitalize;
            font-weight: 500;
        }
        .icon{
            -webkit-tap-highlight-color: transparent;
            margin-right: 1rem;
        }
        .flex{
            .hamburger-menu-button{
                -webkit-tap-highlight-color: transparent;
                margin-right: 1rem;
            }
            h4{
                flex: 1;
            }
            .icon{
                height: 2.2rem;
                width: 2.2rem;
                padding: 0.6rem;
                margin-left: -0.4rem;
                cursor: pointer;
            }
            sm-menu{
                margin-right: -0.7rem;
            }
        }
        sm-button{
            margin: 0;
            .icon{
                height: 0.9rem;
                width: 0.9rem;
                align-self: center;
                stroke-width: 8;
                margin-left: 0;
                margin-right: 0.5rem;
            }
        }
    }
}
#chat_page,
#mail_page,
#settings_page{
    align-items: flex-start;
    width: 100%;
    height: 100%;
}
#chat_page{
    overflow: hidden;
}
#chat_left,
#chat_details_panel{
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}
#chat_details_panel{
    background: rgba(var(--text-color), 0.04);
    padding-bottom: 1.5rem;
    .card{
        margin: 0 1rem;
        padding: 1.5rem 1rem;
        border-radius: 0.8rem;
        background: rgba(var(--text-color), 0.04);
        &:not(:last-of-type){
            margin-bottom: 1rem;
        }
        .h4{
            font-weight: 400;
            font-size: 0.9rem;
            color: rgba(var(--text-color), 0.8);
            margin-bottom: 0.5rem;
        }
        & > .flex{
            margin-bottom: 1rem;
            .h4{
                margin-bottom: 0;
            }
        }
        .tip{
            margin-bottom: 0.5rem;
        }
        .danger:not(:last-of-type){
            margin-bottom: 1rem;
        }
    }
    header{
        position: sticky;
        top: 0;
        padding: 1rem;
        min-height: 4rem;
        background-color: rgba(var(--foreground-color), 0.8);
        z-index: 1;
        .icon{
            height: 2.3rem;
            width: 2.3rem;
            padding: 0.7rem;
            cursor: pointer;
        }
    }
    .contact{
        padding: 0.5rem 0;
    }
    #chat_profile{
        display: grid;
        place-items: center;
        margin-top: 5.5rem;
        padding-bottom: 1.5rem;
        .initial{
            margin-top: -5.5rem;
            margin-bottom: 1rem;
            height: 8rem;
            width: 8rem;
            border-radius: 50%;
            font-size: 4rem;
            .icon{
                height: 4rem;
                width: 4rem;
            }
        }
        #chat_name{
            font-weight: 500;
            font-size: 1.2rem;
        }
        #last_interaction_time{
            color: rgba(var(--text-color), 0.7);
            font-size: 0.9rem;
            margin-top: 0.5rem;
        }
    }
    .copy{
        font-weight: 400;
    }
}
#group_members_list{
    max-height: 50vh;
    overflow-y: auto;
}
#chat{
    position: relative;
    grid-template-columns: 1fr;
}
.message{
    position: relative;
    display: flex;
    flex-wrap: wrap;
    width: auto;
    font-size: 0.92rem;
    max-width: max-content;
    margin-bottom: 0.2rem;
    margin-top: 0.8rem;
    padding: 0.6em 1em;
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    .sender-name{
        font-size: 0.85rem;
        font-weight: 500;
        margin-bottom: 0.3rem;
    }
    .message-body{
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-all;
        word-break: break-word;
        -moz-hyphens: auto;
        -webkit-hyphens: auto;
        hyphens: auto;
        white-space: pre-wrap;
        line-height: 1.5;
        a{
            color: inherit;
        }
        .text-emoji{
            align-self: center;
            font-size: 1.4em;
            letter-spacing: 0;
        }
    }
    .time{
        white-space: nowrap;
        font-size: 0.8em;
        opacity: 0.8;   
        justify-self: flex-end;
        padding-left: 1rem;
        align-self: flex-end;
        margin-top: 0.2rem;
        margin-left: auto;
    }
}
.sent{
    margin-left: auto;
    color: #efefef;
    background: var(--accent-color);
    border-radius: 0.8rem 0 0.8rem 0.8rem;
    &::after{
        content: '';
        position: absolute;
        left: 100%;
        top: 0;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0.5em 0.3em 0 0;
        border-color: var(--accent-color) transparent transparent transparent;
    }
}
.received{
    margin-right: auto;
    background: rgba(var(--text-color), 0.1);
    border-radius: 0 0.8rem 0.8rem 0.8rem;
    &::after{
        content: '';
        position: absolute;
        left: -0.5em;
        top: 0;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 0.5em 0.5em 0;
        border-color: transparent rgba(var(--text-color), 0.1) transparent transparent;
    }
}
.sent + .sent,
.received + .received{
    margin-top: 0;
}
.sent + .sent::after,
.received + .received::after{
    display: none;
}
.sent + .sent,
.received + .received{
    border-radius: 0.8rem;
}
.distinct-sender{
    display: grid;
    border-radius: 0 0.8rem 0.8rem 0.8rem !important;
    margin-top: 0.8rem !important;
    &::after{
        display: flex !important;
        content: '';
        position: absolute;
        left: -0.5em;
        top: 0;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 0.5em 0.5em 0;
        border-color: transparent rgba(var(--text-color), 0.1) transparent transparent;
    }
}
.unconfirmed{
    opacity: 0.7;
    transform-origin: left;
    animation: pop .3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop{
    0%{
        transform: rotate(5deg) translate(-0.5rem, 1rem)
    }
    100%{
        transform: rotate(0) translate(0, 0)
    }
}
#chat_header{
    padding: 0 1rem;
    min-height: 4rem;
    grid-template-columns: 1fr auto;
    .flex{
        height: 100%;
    }
    .back-button{
        height: 2rem;
        width: 2rem;
        padding: 0.5rem;
        stroke-width: 8;
        margin-right: 0.5rem;
        stroke: rgba(var(--text-color), 0.8);
    }
    .initial{
        cursor: pointer;
        margin-right: 1rem;
        height: 2.2rem;
        width: 2.2rem;
        flex-shrink: 0;
    }
    #receiver_name{
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
#scroll_to_bottom{
    position: absolute;
    display: flex;
    right: 0;
    bottom: 4rem;
    border-radius: 4rem;
    z-index: 1;
    aspect-ratio: 1/1;
    margin: 1.5rem;
    cursor: pointer;
    transform: scale(0);
    transition: transform 0.3s;
    &.new-message::after{
        position: absolute;
        content: '';
        top: 0;
        right: 0;
        z-index: 2;
        padding: 0.5rem;
        border-radius: 50%;
        background: #00E676;
    }
    .icon{
        width: 2.6rem;
        height: 2.6rem;
        padding: 0.9rem;
        stroke-width: 8;
    }
}
#chat_footer{
    .flex{
        align-items: flex-end;
        padding: 0.5rem 1rem 0.5rem 0.5rem;
    }
    sm-textarea{
        --padding-right: 3rem;
        --border-radius: 0.5rem;
    }
}
#emoji_toggle{
    align-self: center;
    padding: 0.6rem;
    margin-right: 0.5rem;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 2rem;
    cursor: pointer;
    path{
        fill: rgba(var(--text-color), 0.5);
    }
    &.active path{
        fill: var(--accent-color);
    }
}
#send_message_button{
    position: absolute;
    right: 1.5rem;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    align-self: center;
    height: 2.4rem;
    width: 2.4rem;
    padding: 0.5rem;
    cursor: pointer;
    stroke: none;
    fill: rgba(var(--text-color), 0.4);
    margin-left: 1rem;
    transition: 0.3s;
    &.active{
        opacity: 1;
        fill: var(--accent-color);
        transform: none;
        pointer-events: all;
    }
}
#type_message{
    margin: 0;
}
.big-emoji{
    flex-direction: column;
    .message-body{
        justify-content: center;
        font-size: 2.6rem;
    }
    .text-emoji{
        font-size: 2.6rem !important;
    }
}
#chat_middle{
    flex: 1;
    padding: 0 1rem;
}
#emoji_picker{   
    --background: rgba(var(--text-color), 0.06);
    --border-size: 0;
    --input-border-color: none;
    --input-padding: 0.4rem 1rem;
    --outline-color: var(--accent-color);
    --input-font-color: var(--text-color);
    --input-placeholder-color: rgba(var(--text-color), 0.6);
    --indicator-color: var(--accent-color);
    --button-hover-background: rgba(var(--text-color), 0.2);
    user-select: none;
    width: 100%;
    max-height: 40vh;
}
.emoji{
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 0.6rem;
    user-select: none;
    text-align: center;
}
#new_conversation, #no_mails{
    height: 100%;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    p{
        margin-top: 0.8rem;
    }
}
#no_mails{
    .new-conversation{
        height: 7rem;
        margin-bottom: 1rem;
    }
}
.new-conversation{
    height: 8rem;
    width: 8rem;
    align-self: center;
    stroke-width: 16;
    stroke: rgba(var(--text-color), 0.4);
}
#chat_middle,
#chat_container,
#inbox_mail_container,
#sent_mail_container,
#mail{
    width: 100%;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}
.observe-empty-state:empty{
    display: none;
}
.observe-empty-state:not(:empty) ~ .empty-state{
    display: none;
}
#chat_container{
    padding-bottom: 6rem;
}
#contacts_popup{
    --body-padding: 0;
    .popup-header{
        padding: 1.5rem;
    }
    .warning{
        padding: 0.5rem 1.5rem;
    }
}
.mail-container{
    height: 100%;
    flex-direction: column;
    overflow-y: auto;
}

#inbox_mail_container,
#sent_mail_container
{
    gap: 0.2rem;
    padding-bottom: 6rem;
}
.has-bg-image{
    .received, 
    .group-event-card,
    .date-card{
        background: rgba(var(--foreground-color), 0.8);
    }
    .received::after{
        border-color: transparent rgba(var(--foreground-color), 0.6) transparent transparent;
    } 
    #emoji_picker{
        --background: rgba(var(--foreground-color), 0.6);
    }
    #emoji_toggle{
        path{
            fill: rgba(var(--text-color), 0.8);
        }
    }
    sm-textarea{
        --background: rgba(var(--foreground-color), 0.6);
    }
    #chat_details_panel{
        background: rgba(var(--foreground-color), 0.8);
    }
}
#mail{
    height: 100vh;
    align-items: flex-start;
    & > .flex{
        padding: 0 1.5rem;
        margin-top: 2rem;
        sm-button:first-of-type{
            margin-right: 0.5rem;
        }
    }
}
#compose_mail_popup{
    sm-input{
        margin-bottom: 1rem;
    }
}
.sidebar-item{
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    text-transform: capitalize;
    font-weight: 500;
    opacity: 0.9;
    .icon{
        margin-right: 1em;
        width: 1em;
    }
}
.back{
    padding: 0.7rem;
    height: 2.4rem;
    width: 2.4rem;
    margin-left: -0.5rem;
    cursor: pointer;
    stroke-width: 8;
    opacity: 0.8;
    -webkit-tap-highlight-color: transparent;
    &:hover{
        opacity: 1;
    }
}
#settings_page{
    #settings_sidebar header{
        padding: 1rem 1.5rem;
    }
    .flex sm-button{
        margin: 0;
        margin-left: 1rem;
    }
    sm-switch{
        padding: 1rem 1.5rem;
        display: flex;
        margin-bottom: 1rem;
        width: min(60ch, 100%);
        .flex{
            margin-right: 1rem;
        }
        h4{
            margin-bottom: 0.5rem;
        }
    }
    sm-button{
        width: 100%;
    }
    #settings_title{
        text-transform: capitalize;
    }
    #settings_sidebar{
        height: 100%;
    }
    #settings_panel{
        overflow-y: auto;
        height: 100%;
    }
    section{
        padding: 1rem 1.5rem;
        width: min(60ch, 100%);
        display: grid;
        gap: .3rem;
        sm-button{
            margin-top: 0.5rem;
            margin-bottom: 0;
        }
        &:not(:last-of-type){
            margin-bottom: 1rem;
        }
    }
    #sign_out::part(button){
        color: var(--error-color);
    }
    color-grid{
        margin: 0.5rem 0 1.5rem 0;
        width: min(60ch, 100%);
    }
    #chat_preview{
        margin-top: 1rem;
        padding: 1rem;
        border-radius: 0.5rem;
    }
    #bg_preview_container{
        padding: 1rem 0;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .bg-preview{
        position: relative;
        display: grid;
        place-items: center;
        height: 8rem;
        width: 8rem;
        cursor: pointer;
        border-radius: 1rem;
        overflow: hidden;
        background: rgba(var(--text-color), 0.1);
        &--selected::after{
            content: '';
            position: absolute;
            height: 100%;
            width: 100%;
            box-shadow: 0 0 0 0.5rem rgba(var(--text-color), 0.8) inset;
        }
    }
    .bg-preview__image{
        object-fit: cover;
        height: 100%;
        width: 100%;
    }
}
#video_call_page{
    position: relative;
    display: grid;
    video{
        position: fixed;
        object-fit: cover;
        object-position: center;
    }
}
#their_video{
    height: 100%;
}
#my_video{
    width: max(20vh, 12rem);
    bottom: 0;
    right: 0;
    border-radius: 1rem;
    border: solid;
    margin: 1.5rem;
}
#call_controls{
    padding: 1.5rem;
    margin-top: auto;
    justify-self: center;
}
#pick_up_call{
    color: #00C853;
}
.circular-button{
    align-items: center;
    .filled{
        height: 3rem;
        width: 3rem;
        padding: 1rem;
    }
    --padding: 0;
    --border-radius: 50%;
}
@media screen and (max-width: 640px){
    sm-popup{
        --border-radius: 1rem 1rem 0 0;
    }
    .hide-on-mobile{
        position: fixed;
        max-height: 0;
        opacity: 0;
        pointer-events: none;
    }
    #landing{
        grid-template-areas: 'illustration' '.';
        align-items: flex-start;
        .title-font{
            font-size: 2rem;
            font-weight: 500;
        }
        sm-button{
            width: 100%;
            display: flex;
            width: 100% !important;
        }
    }
    #landing_illustration{
        grid-area: illustration;
    }
    .frame,
    #sign_in{
        form{
            height: 100%;
        }
        .h2{
            margin-top: 3rem;
        }
        sm-button[variant="primary"]{
            margin-top: auto;
        }
    }
    #main_navbar{
        transform: translateX(-110%);
        transition: transform 0.3s;
        z-index: 4;
        box-shadow: 0 0 1rem rgba(0, 0, 0, 0.3);
        .logo-section{
            padding: 1rem;
        }
    }
    #navbar_backdrop{
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 2;
        transition: transform 0.3s, opacity 0.3s;
    }
    #chat_container,
    #contact_container{
        gap: 0.2rem;
    }
    #chat{
        .message{
            width: auto;
            max-width: 90%;
        }
    }
    #chat_header{
        grid-template-columns: auto 1fr auto;
    }
    #settings_page{
        overflow-x: hidden;
        #settings_header{
            position: sticky;
            top: 0;
            z-index: 1;
            padding: 1rem 1.5rem;
            margin-bottom: 0.5rem;
            background: rgba(var(--foreground-color), 1);
        }
    }
}
@media only screen and (min-width: 640px){
    .hide-on-desktop{
        display: none !important;
    }
    .page{
        padding-bottom: 0;
    }
    .popup-header{
        padding-top: 1.5rem;
    }
    .fab{
        position: absolute;
    }
    .logo-section{
        padding: 2rem 3rem 0 3rem;
        margin: 0.5rem 0;
    }
    sm-popup{
        --width: 24rem;
        --min-width: 24rem;
        --border-radius: 0.5rem;
    }
    #landing{
        align-items: center;
        gap: 4vw;
        grid-template-columns: 1fr 1fr;
        padding: 0 4vw;
    }
    #sign_in_page{
        place-content: center;
    }
    #sign_in{
        width: 24rem;
    }
    .frame{
        justify-content: center;
    }
    #main_navbar{
        position: relative;
        width: auto;
        padding-bottom: 0.5rem;
        background: rgba(var(--text-color), 0.06);
        .logo-section{
            display: flex;
            justify-content: center;
            margin: 1.5rem 0 2rem 0;
            .main-logo{
                margin: 0;
            }
        }
        .navbar-item{
            margin: 0 0.5rem;
            border-radius: 0.8rem;
            .icon{
                margin-right: 0;
            }
        }
        .label{
            display: none;
        }
    }
    #add_contact_popup{
        --min-width: 24rem;
    }
    #compose_mail_popup,
    #reply_mail_popup{
        --min-width: 36rem;
    }
    #main_page{
        grid-template-columns: auto 1fr;
    }
    #emoji_picker{
        max-height: 18rem;
    }
    #chat{
        .message{
            width: auto;
            align-self: flex-start;
            max-width: 55ch;
        }
    }
    #chat_page, #mail_page{
        grid-template-columns: 20rem 1fr;
    }
    #settings_page{
        display: grid;
        height: 100vh;
        grid-template-columns: 14rem 1fr;
        sm-button{
            width: max-content;
        }
        .active{
            background: rgba(var(--text-color), 0.1);
        }
        .panel > *:first-of-type{
            margin-top: 0.5rem;
        }
    }
    .contact.active,
    .mail-card.active{
        background: rgba(var(--text-color), 0.06);
    }
    .card{
        display: inline-flex;
        width: auto;
    }
}
@media only screen and (max-width: 1280px){
    .hide-on-medium{
        display: none !important;
    }
}
@media only screen and (min-width: 1080px){
    #chat{
        #messages_container{
            padding: 1rem 4rem;
        }
    }
}
@media only screen and (min-width: 1280px){
    #landing{
        gap: 4vw;
        padding: 0 8vw;
        .title-font{
            font-size: 3rem;
        }
    }
    #chat_page, #mail_page{
        grid-template-columns: 23rem 1fr;
    }
    #chat_details_panel{
        position: relative;
    }
    #chat{
        &.expand-side-panel{
            grid-template-columns: 1fr 24rem;
            #messages_container{
                padding: 1rem;
            }
        }
    }
    #emoji_picker{
        --num-columns: 16;
    }
    .contact.active,
    .mail-card.active{
        background: rgba(var(--text-color), 0.06);
    }
    .card{
        display: inline-flex;
        width: auto;
    }
}
@media (hover: hover){
    ::-webkit-scrollbar{
        width: 0.5rem;
        height: 0.5rem;
    }
    
    ::-webkit-scrollbar-thumb{
        background: rgba(var(--text-color), 0.3);
        border-radius: 1rem;
        &:hover{
            background: rgba(var(--text-color), 0.5);
        }
    }
    .navbar-item:hover,
    .contact:hover,
    .emoji:hover,
    .option:hover{
        cursor: pointer;
        background: rgba(var(--text-color), 0.06);
    }
    .contact{
        .menu{
            opacity: 0;
            transition: opacity 0.3s;
        }
    }
    .contact:hover{
        .menu{
            opacity: 1;
        }
    }
}
@media (hover: none){
    .contact-preview,
    .contact,
    .icon,
    .option{
        -webkit-tap-highlight-color: transparent;
    }
    .contact .menu{
        display: none;
    }
}