@import url('/assets/fonts/connect.css');
@import url('/assets/css/ui.css');


.btn, .iconbtn, .tab-btn, .chatlist-chat, .chats-title-text, input::placeholder {
    user-select: none;
}


.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-primary: #3390ec34;
    --border-radius: 10px;
    --sidebar-width: 350px;
}

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, #79bbe2, #89bccc, #4971ae);


    --danger-color: rgb(255, 48, 60);
    --warn-color: rgb(230, 160, 50);
    --success-color: rgb(30, 150, 60);
    --info-color: rgb(70, 100, 200);


}

body[data-theme="dark"] {
    --bg: rgb(30, 30, 30);
    --bg-darker: rgb(40, 40, 40);
    --bg-secondary: rgb(55, 55, 55);
    --bg-primary: rgb(65, 65, 65);

    --bg-blanker: rgb(5, 5, 5);

    --border-color: rgb(50, 50, 50);

    --loader-color: rgb(60, 60, 60);

    --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(240, 240, 240);

    --text-color: rgb(255, 255, 255);
    --text-color-primary: rgb(150, 150, 150);

    --input-bg-color: rgba(255, 255, 255, 0.05);

    --hover-bg-color: rgb(250, 250, 250, 0.04);
    --ripple-bg: radial-gradient(circle, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));

    --bubble-peer-color: rgb(255, 255, 255);
    --bubble-bg: rgb(30, 30, 30);
    --bubble-mine-bg: linear-gradient(45deg, rgb(10, 70, 200), rgb(50, 100, 200));

    --chat-bg: rgb(5, 5, 5);


    --danger-color: rgb(210, 80, 80);
    --warn-color: rgb(230, 200, 15);
    --success-color: rgb(30, 150, 60);
    --info-color: rgb(70, 100, 200);


}

#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;
}
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);
}

@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;
}


/* Link */
a {color: var(--accent-color);}

.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;
    border-right: 1px solid var(--border-color);
}

.lc-tab {
    height: 100%;
    min-width: 0;
    width: 100%;
}
.lc-tab:not(.active) {
    display: none;
}

.tabs {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-darker);
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 70px;
    height: 60px;
    background-color: transparent;
    color: var(--btn-primary-color);
    font-size: 20px;
}
.tab-btn-label {
    display: inline;
    font-size: 12px;
    color: currentColor;
}

.header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 0;
}
.chats-title-text {
    display: flex;
    font-size: 24px;
    font-weight: 600;
    height: 26px;
}

.search-bar {
    min-width: 0;
    width: 100%;
}

/* CHAT-LIST */
.chatlist {
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 2px;
    width: 100%;
}
.chatlist-chat {
    display: flex;
    border-radius: 10px;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    width: 100%;
}
.chatlist-chat.active {
    background-color: var(--bg-darker);
}

.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;
}

.main-column {
    display: flex;
    width: 100%;
    height: 100dvh;
}

.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;
}
.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);
    }
}

.avatar {
    display: grid;
    place-content: center;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 600;
    width: 40px;
    height: 40px;
}
.avatar.in-list {
    width: 50px;
    height: 50px;
}

.avatar.big {
    width: 90px;
    height: 90px;
}

.avatar-gradient {
    color: #fff;
    font-weight: 500;
    background-image: linear-gradient(to bottom, var(--g-color-1), var(--g-color-2));
}
.avatar-gradient[data-color='green'] {
    --g-color-1: rgb(160, 200, 10);
    --g-color-2: rgb(10, 200, 50);
}

.avatar-gradient[data-color='purple'] {
    --g-color-1: rgb(150, 150, 250);
    --g-color-2: rgb(100, 100, 200);
}

.avatar-gradient[data-color='red'] {
    --g-color-1: rgb(250, 100, 100);
    --g-color-2: rgb(150, 50, 50);
}

.avatar-gradient[data-color='orange'] {
    --g-color-1: #e9a30c;
    --g-color-2: #d55620;
}


.chatlist-chat .about {
    display: flex;
    flex: 1;
    min-width: 0;
}

.chatlist-chat .about .top-row {
    display: flex;
    font-size: 18px;
    font-weight: 500;
    width: 100%;
    flex: 1;
}
.chatlist-chat .about .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-size-adjust: 100%;
}

@keyframes popup {
    from {
        opacity: 0.5;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.popup {
    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] {
    animation: popup 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
}
dialog::backdrop {
    background-color: #0000004f;
}
.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-info > .avatar {
    border: 1px solid var(--border-color);
}
.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-title {
    font-size: 12px;
    opacity: 0.6;
    user-select: none;
}

.cell-content {
    font-size: 16px;
    color: var(--text-color);
}

.popup-title {
    display: flex;
    justify-content: flex-end;
    padding: 6px;
}


.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;
}

.popup-content.add-contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.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: opacity 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
}
.toast:not(.shown) {
    opacity: 0;
}

@keyframes ctx-menu-mobile {
    0% {
        transform: translateY(100%);
    }
    100% {
        transform: none;
    }
}

@media screen and (max-width: 750px) {
    .left-column {
        position: fixed;
        transform: translateX(-100%);
        flex-direction: column-reverse;
        height: 100dvh;
        width: 100vw;
        max-width: 100vw;
        transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
    }
    .left-column.active {
        transform: translateX(0);
        box-shadow: 0 0 40px rgb(0, 0, 0, 0.2);
    }

    .tabs {
        flex-direction: row;
        background-color: var(--bg);
        box-shadow: 0 -4px 10px rgb(0, 0, 0, 0.08);
    }
    .tab-btn {
        width: 100%;
    }

    .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(--);
    }
}

