@import url('/assets/fonts/connect.css');
@import url('/assets/css/ui.css');

@import url('/assets/css/fontello-codes.css');
.icon {
    font-family: 'Lain Icons';
    font-style: normal;
    font-weight: 400;
}


.btn, .iconbtn, .tab-btn, .chatlist-chat, .chats-title-text, input::placeholder {
    user-select: none;
}

.hide {
    display: none !important;
    width: 0;
    height: 0;
    opacity: 0;
}

.clr-red {
    color: var(--danger-color) !important;
}

.span, div, h1, h2, h3, h4, h5, h6, p {
    color: var(--text-color);
}

.no-scroll {
    overflow: hidden; /* Скрывает прокрутку */
    touch-action: none; /* Блокирует все стандартные жесты пальцами */
}

/* Variables */
:root {
    --accent-color: #3390ec;
    --accent-color-selected: var(--accent-color);
    --accent-color-primary: #338fec1c;
    --border-radius: 22px;
    --sidebar-width: 350px;
    --link-color: var(--accent-color);

    
    --danger-color: rgb(255, 48, 60);
    --danger-bg: rgba(255, 48, 60, 0.4);

    --warn-color: rgb(230, 200, 0);
    --warn-bg: rgba(230, 200, 0, 0.4);

    --success-color: rgb(50, 170, 80);
    --success-bg: rgba(50, 170, 80, 0.4);

    --info-color: rgb(70, 100, 200);
}

body[data-theme="light"] {
    --bg: rgb(250, 250, 250);
    --bg-darker: rgb(230, 230, 230);
    --bg-secondary: rgb(210, 210, 210);
    --bg-primary: rgb(200, 200, 200);

    --bg-blanker: rgb(210, 230, 240);

    --border-color: rgb(220, 220, 220);

    --loader-color: rgb(90, 90, 90);

    --ctx-bg: rgb(240, 240, 240, 0.8);

    --btn-bg-color: var(--accent-color);
    --btn-color: rgb(255,255,255);
    --btn-bg-color-disabled: rgb(70, 70, 70);

    --btn-primary-color: rgb(70, 70, 70);

    --text-color: rgb(10, 10, 10);
    --text-color-primary: rgb(90, 90, 90);

    --input-bg-color: rgba(10, 10, 10, 0.05);

    --hover-bg-color: rgb(20, 20, 20, 0.04);
    --ripple-bg: rgba(10, 10, 10, 0.05);

    --bubble-peer-color: #074861;
    --bubble-bg: rgb(255, 255, 255);
    --bubble-mine-bg: rgb(220, 230, 245);

    --chat-bg: linear-gradient(125deg, #99d5d7, #468efa);

    --link-color: rgb(20, 90, 200);
}

body[data-theme="dark"] {
    --accent-color: rgb(100, 105, 110);
    --accent-color-selected: rgb(190, 195, 210);
    --accent-color-primary: rgba(4, 4, 5, 0.1);

    --bg: rgb(35, 35, 40);
    --bg-darker: rgb(40, 40, 45);
    --bg-secondary: rgb(45, 45, 50);
    --bg-primary: rgb(50, 50, 55);

    --bg-blanker: var(--bg-darker);

    --border-color: #44484e;

    --loader-color: #44484e;

    --ctx-bg: #f0f0f04d;

    --btn-bg-color: var(--accent-color);
    --btn-color: rgb(240, 240, 240);
    --btn-bg-color-disabled: rgb(70, 70, 70);

    --btn-primary-color: rgb(110, 110, 120);

    --text-color: rgb(230, 230, 230);
    --text-color-primary: rgb(150, 150, 150);

    --input-bg-color: rgba(213, 213, 213, 0.05);

    --hover-bg-color: rgb(200, 200, 200, 0.04);
    --ripple-bg: rgba(210, 210, 210, 0.05);

    --bubble-peer-color: rgb(130, 140, 150);
    --bubble-bg: var(--bg-darker);
    --bubble-mine-bg: var(--bg-primary);

    --chat-bg: linear-gradient(125deg, rgb(20, 20, 30), rgb(25, 30, 35));

    --link-color: rgb(200, 210, 230);
}


#loadOverlay {
    display: grid;
    place-items: center;
    position: fixed;
    width: 100vw;
    height: 100dvh;
    background-color: var(--bg);
    z-index: 10001;
}

*::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
*::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background-color: rgba(50, 50, 50, 0.5);
    opacity: 0.5;
}
*::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}

/* Default */
* {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    border: 0;
    outline: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
input, div {
    box-sizing: border-box;
}
.hid {
    display: none;
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.scroll-y {
    overflow-y: scroll;
}


.app {
    overflow: hidden;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100dvh;
    background-color: var(--bg);
    color: var(--text-color);
}

.rainbow {
    animation: rainbowRecolor 5s infinite linear;
}

@keyframes rainbowRecolor {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}


@keyframes ctx-menu {
    0% {
        opacity: 0.5;
        translate: -10px -10px;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        translate: 0 0;
        transform: scale(1);
    }
}

.cctx-menu {
    animation: ctx-menu 0.1s cubic-bezier(0.075, 0.82, 0.165, 1);
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: var(--bg);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgb(0, 0, 0, 0.2);
    padding: 6px 0;
    z-index: 100;
}
.cctx-item {
    padding: 10px 12px;
    width: 100%;
    color: var(--text-color);
    text-align: left;
    font-size: 16px;
    background-color: transparent;
}
.cсtx-item:hover {
    background-color: var(--hover-bg);
}
.cсtx-icon {
    margin-right: 4px;
}


.nameplate {
    display: flex;
    gap: 4px;
    height: max-content;
}
.nameplate .icon {
    position: relative;
    color: rgb(50, 110, 220);
}
.nameplate .icon::after {
    content: "";
    position: absolute;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background-color: rgb(255, 255, 255);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    z-index: -1;
}

/* Link */
a {
    color: var(--link-color);
    text-decoration: underline;
}

.column {display: flex;flex-direction: column;}

/* SIDEBAR */
.left-column {
    position: sticky;
    background-color: var(--bg);
    display: flex;
    flex-direction: row;
    z-index: 10;
    max-width: 350px;
    width: 100vw;
    height: 100vh;
    border-right: 1px solid var(--border-color);
}

.lc-tab {
    position: relative;
    height: 100%;
    width: 100%;
}
.lc-tab:not(.active) {
    display: none;
}

.tabs {
    display: flex;
    flex-direction: row;
    background-color: var(--bg);
    border-top: 1px solid var(--border-color);
    border-radius: 10px 10px 0 0;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    background-color: transparent;
    color: var(--btn-primary-color);
    font-size: 20px;
}
.tab-btn-label {
    display: inline;
    font-size: 12px;
    color: currentColor;
    opacity: 0.8;
}
.tab-btn.h {
    color: var(--accent-color-selected);
}

.left-column {
    flex-direction: column-reverse;
}

.header {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 0;
}
.chatlist-container {
    height: 100%;
    overflow: hidden;
}
.chatlist-container .header {
    display: flex;
    justify-content: unset;
    align-items: center;
    flex-direction: row;
}
.chats-title-text {
    display: flex;
    font-size: 24px;
    font-weight: 600;
    height: 26px;
}
.header .smol {
    font-size: 14px;
    opacity: 0.6;
}

.search-bar {
    min-width: 0;
    width: 100%;
}

.upload-clip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
}
.upload-clip label {
    width: 100%;
    height: 100px;
}

.clip-video {
    position: absolute;
    width: 100vw;
    height: 100dvh;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    background-color: rgb(0,0,0);
    z-index: 999999999999999999999;
    overflow: hidden;
}
.clip-video:not(.active) {
    display: none;
}
.clip-video .close {
    color: #fff !important;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
}
.clip-video video {
    width: 100vw;
    height: 100vh;
    aspect-ratio: 9 / 16;
    background-color: rgb(0,0,0);
}
.chatlist-clips {
    display: grid;
    padding: 0 8px;
    padding-top: 2px;
    gap: 6px;
    user-select: none;
    grid-template-columns: repeat(auto-fill, 74px);
    grid-auto-flow: column;
    overflow-x: auto !important; 
    overflow-y: hidden;
}
.clip-preview {
    position: relative;
    display: flex;
    min-width: 70px;
    border-radius: 10px;
    overflow: visible;
    background-color: rgba(0,0,0,0.4);
    cursor: pointer;
    aspect-ratio: 9/16;
}
.clip-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    overflow: hidden;
    border-radius: 10px;
}
.clip-preview .avatar {
    position: absolute;
    top: 100%;
    left: 50%;
    translate: -50% -50%;
    outline: 2px var(--bg) solid;
}

.chatlist-notification {
    background-color: var(--accent-color-primary);
    padding: 8px;
    display: flex;
    gap: 6px;
    user-select: none;
}
.chatlist-notification .icon {
    width: 40px;
    height: 40px;
    background-color: var(--accent-color);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    border-radius: 45%;
}
.chatlist-notification .info {
    display: flex;
    flex-direction: column;
    margin-right: auto;
    font-size: 16px;
}
.chatlist-notification .info .title {
    font-weight: 600;
}
.chatlist-notification .info .main {
    font-weight: 500;
}

/* CHAT-LIST */
.chat-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    height: 100%;
    padding-bottom: 60px;
}
.chatlist-chat {
    display: flex;
    min-width: 0;
    flex: 0;
    min-height: max-content;
}
.chatlist-chat.active {
    background-color: var(--accent-color-primary);
}

.new-plus-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background-color: var(--accent-color);
    color: #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 18px;
    padding: 14px;
}

.main-column {
    display: flex;
    width: 100%;
    height: 100dvh;
    background: var(--chat-bg);
}

.mc-tab:not(.active) {
    display: none;
}

.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0,0,0,0.7);
    z-index: 99999999999;
    color: #c3c3c3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}
.clip-video .iconbtn.close, .image-preview-overlay .iconbtn.close {
    color: currentColor;
    width: 50px;
    height: 50px;
    font-size: 20px;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

.image-preview {
    max-width: calc(100vw - 100px);
    max-height: calc(100vh - 100px);
    z-index: 1;
}
.image-preview-img {
    max-width: calc(100vw - 100px);
    max-height: calc(100vh - 100px);
    transition: transform 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
}

@media screen and (max-width: 750px) {
    .image-preview {
        max-width: 100vw;
        max-height: calc(100vh - 80px);
    }
    .image-preview-img {
        max-width: 100vw;
        max-height: calc(100vh - 80px);
    }
}

.chatlist-chat .about {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.chatlist-chat .about .top-row {
    display: flex;
    font-size: 18px;
    font-weight: 500;
    width: 100%;
    min-width: 0;
}

.chatlist-chat .about .top-row .nameplate {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.chatlist-chat .about .top-row .nameplate .name {
    display: block;
    white-space: nowrap;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}


@keyframes popup {
    from {
        opacity: 0.5;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.popup {
    display: none;
    position: fixed;
    width: 100vw;
    max-width: 350px;
    height: 100dvh;
    max-height: 100dvh;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: var(--bg);
}
.popup[open] {
    display: unset;
    animation: popup 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
}
dialog::backdrop {
    background-color: #0000004f;
}

.popup-content.notify {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.popup-content.notify img {
    width: 100%;
}

.popup-content.profile {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-darker);
}
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    gap: 8px;
}
.profile-user-avatar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 10px;
}
.profile-avatars, .profile-user-name {
    display: flex;
    justify-content: center;
}
.profile-user-name {
    font-size: 20px;
    font-weight: 600;
}
.profile-user-description {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.8;
}

.cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border-radius: 16px;
    text-align: left !important;
    width: 100%;
    background-color: var(--bg);
}

.cell.ct-btns {
    flex-direction: row;
    gap: 4px;
    width: 100%;
    padding: 4px;
}

.cell-title {
    font-size: 12px;
    opacity: 0.6;
    user-select: none;
}

.cell-content {
    font-size: 16px;
    color: var(--text-color);
}

.cell-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    gap: 4px;
    font-size: 14px;
    border-radius: 14px;
    min-height: 60px;
    background-color: var(--bg-darker);
    color: var(--text-color);
    cursor: pointer;
}
.cell-btn .icon {
    font-size: 20px;
    color: var(--accent-color);
}

.profile-avatar-edit-btn {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    font-size: 22px;
    text-shadow: rgb(0,0,0) 0 0 20px;
    color: #fff;
    background-color: transparent;
    display: grid;
    place-items: center;
    z-index: 5;
}

#profileEditForm {
    gap: 6px;
}

#profileClips {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px;
}

.popup-title {
    display: flex;
    position: relative;
    padding: 8px;
    gap: 6px;
}

.popup-title .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    user-select: none;
    display: flex;
    align-items: center;
    padding-left: 6px;
}

.popup-title .close {
    margin-left: auto;
}

.centered-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    width: calc(100vw - 20px);
    box-shadow: 0 0 10px rgb(0, 0, 0, 0.2);
    max-width: 400px;
    background-color: var(--bg);
    border-radius: 16px;
    z-index: 99999999999999999999999999999;
}

form.add-contact-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    padding-top: 0;
}

.popup-content.alert {
    padding: 18px;
    gap: 14px;
}

.alert-btns-container {
    display: flex;
    gap: 8px;
}

.alert-btns-container button {
    width: 100%;
}

form.new-chat {
    padding: 16px;
    padding-top: 0;
    gap: 8px;
}
.new-chat > h3 {
    margin-bottom: 10px;
}
.new-chat > .btn[type="submit"] {
    margin-top: 10px;
}

.sidebar-back-button {
    display: none;
}


.toast-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    width: var(--sidebar-width);
    position: fixed;
    bottom: 0;
    left: 50%;
    translate: -50% 0;
    padding: 14px;
    z-index: 99999999;
    pointer-events: none;
    gap: 4px;
}

.toast {
    display: flex;
    width: 100%;
    padding: 14px;
    background-color: rgba(30, 35, 40, 0.8);
    backdrop-filter: blur(2px);
    color: #fff;
    font-weight: 500;
    border-radius: 10px;
    box-shadow: 0 0 4px rgb(0, 0, 0, 0.2);
    position: relative;

    opacity: 1;
    transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
    height: 46px;
}
.toast:not(.shown) {
    opacity: 0;
    height: 30px;
}

.contact {
    align-items: center;
}

.settings-container .itemlist .btn {
    gap: 6px;
}

@keyframes ctx-menu-mobile {
    0% {
        transform: translateY(100%);
    }
    100% {
        transform: none;
    }
}


@media screen and (max-width: 800px) {
    .left-column {
        position: fixed;
        transform: translateX(-100%);
        transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
        border-right: none;
        max-width: unset;
    }
    :root {
        --sidebar-width: 100vw;
    }
    .left-column.active {
        transform: translateX(0);
        box-shadow: 0 0 40px rgb(0, 0, 0, 0.2);
    }

    .popup {
        max-width: 100vw;
    }
    .sidebar-back-button {
        display: block;
    }
    .app {
        grid-template-columns: 1fr;
    }

    .alert-btns-container {
        flex-direction: column;
    }
    .cctx-menu {
        position: relative;
        top: unset !important;
        bottom: 0 !important;
        left: 0 !important;
        translate: 0 !important;
        width: 100vw;
        border-radius: 20px 20px 0 0;
        padding: 10px;
        gap: 10px;
        box-shadow: 0 0 50px rgb(0, 0, 0, 0.8);
        animation: ctx-menu-mobile 0.2s cubic-bezier(0.075, 0.82, 0.165, 1);
    }
    .cctx-menu::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        width: 40px;
        height: 6px;
        background-color: var(--bg-primary);
        translate: -50% 0;
        border-radius: 3px;
    }
    .cctx-item {
        padding: 14px;
    }
    .cctx-item:active {
        background-color: var(--);
    }

    .image-preview, .image-preview-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}

