/* ============================================================
   WorkLine 1.11.7 — патч исправлений
   1) анти-мерцание всплывающих списков (custom-select pop)
   2) выделение сообщений: свои справа, последнее/отправляемое как все
   7) скрыто поле быстрого ввода задач навсегда
   9) архив чатов (кнопка свайпа + строка-вход по свайпу вниз)
   11) прозрачность списка чатов
   ============================================================ */

/* ---- (1) Анти-мерцание: pop-оверлей не должен мигать фоном ---- */
.custom-select-overlay.pop {
    transition: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.custom-select-overlay.pop .custom-select-box {
    transition: none !important;
    animation: wlPopIn .16s cubic-bezier(.2,.8,.2,1) !important;
}
/* Обои на своём композиторном слое — не перерисовываются при открытии оверлеев */
html[data-wallpaper]:not([data-wallpaper="none"]) body::before,
html[data-wallpaper]:not([data-wallpaper="none"]) body::after {
    will-change: transform;
    transform: translateZ(0);
}

/* ---- (2) Выделение сообщений: свои остаются справа ---- */
.chat-selecting #chat-messages .chat-msg.own {
    justify-content: flex-start; /* flex-direction:row-reverse сам вытолкнет пузырь вправо */
}
/* одинаковая геометрия у всех сообщений, включая последнее и отправляемые */
.chat-selecting #chat-messages .chat-msg {
    align-self: stretch;
}

/* ---- (7) Поле быстрого ввода задач убрано при любых темах/прозрачностях ---- */
#tasks-quick-add {
    display: none !important;
}
body.task-add-open #tasks-quick-add {
    display: none !important;
}

/* ---- (9) Архив: кнопка свайпа «Архив» вместо «Удалить» ---- */
.chat-swipe-arch {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: calc(var(--rev, 0) * 1px);
    background: #64748b;
    color: #fff;
    border: 0;
    opacity: 0;
    transition: opacity .15s ease;
    cursor: pointer;
}
.chat-swipe.sw-on .chat-swipe-arch { opacity: 1; }
.chat-swipe-arch .chat-swipe-in {
    width: 92px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
}
.chat-swipe-arch .chat-swipe-in svg { display: block; }

/* Строка входа в архив (появляется при свайпе вниз сверху списка) */
.chat-arch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    margin: 0 0 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border-width: 0;
    opacity: 0;
    transition: max-height .2s ease, opacity .18s ease, padding .2s ease, margin .2s ease, border-width .2s ease;
}
.chat-arch-row.show {
    max-height: 64px;
    opacity: 1;
    padding: 12px 14px;
    margin: 0 0 8px;
    border-width: 1px;
}
.chat-arch-row .chat-arch-ico {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .14);
    color: rgb(var(--primary-rgb));
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.chat-arch-row .chat-arch-t { font-weight: 600; flex: 1 1 auto; text-align: left; }
.chat-arch-row .chat-arch-n {
    font-size: 12px;
    color: var(--muted);
    background: rgba(var(--primary-rgb), .12);
    border-radius: 999px;
    padding: 2px 9px;
}

/* Плашка-заголовок режима архива */
.chat-list-head-arch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

/* ---- (11) Прозрачность списка чатов ---- */
#chat-list .chat-swipe {
    background: var(--card) !important;
}
#chat-list .chat-swipe .chat-li {
    background-color: var(--card) !important;
}
