/* Чат поддержки (/support) */
.support-container .supchat {
    display: flex;
    flex-direction: column;
    max-width: 760px;
    margin-top: 18px;
    border: 1px solid #e8eaee;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.supchat__msgs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px;
    min-height: 280px;
    max-height: 52vh;
    overflow-y: auto;
    background: #f4f6f8;
}
.supchat__bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    border: 1px solid #e8eaee;
    align-self: flex-start;
}
.supchat__bubble.mine {
    align-self: flex-end;
    background: #1A7537;
    border-color: #1A7537;
    color: #fff;
}
.supchat__bubble a {
    color: #1A7537;
    text-decoration: underline;
    word-break: break-all;
}
.supchat__bubble.mine a {
    color: #fff;
}
.supchat__bubble .supchat__who {
    display: block;
    font-size: 12px;
    opacity: 0.65;
    margin-bottom: 4px;
}
.supchat__bubble img.supchat__img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    margin-top: 8px;
    cursor: zoom-in;
}
.supchat__time {
    display: block;
    font-size: 11px;
    opacity: 0.6;
    margin-top: 6px;
    text-align: right;
}
/* Новые сообщения быстро выезжают снизу */
@keyframes supSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.supchat__bubble--fresh {
    animation: supSlideUp 0.28s ease-out;
}
/* Админка — уже как у пользователя */
.admin-content .supchat {
    max-width: 600px;
    margin-left: 0;
    margin-right: auto;
}
.supchat__topics-title {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1A7537;
}
.supchat__topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 6px !important;
    border-top: 1px solid #e8eaee;
    background: #fff;
}
.supchat__topics.hide {
    display: none;
}
.supchat__topic {
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid #525252;
    background: #fff;
    color: #525252;
    font-size: 14px;
    cursor: pointer;
    animation: supTopicIn 0.3s ease-out backwards;
    /* Изоляция от глобальных button-стилей (transition/active), чтобы не дёргалось */
    transition: none;
}
@keyframes supTopicIn {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
/* Прелоадер на нажатой кнопке вместо текста */
@keyframes supSpin {
    to { transform: rotate(360deg); }
}
.supchat__topic.loading {
    position: relative;
    min-width: 64px;
    min-height: 38px;
    pointer-events: none;
}
.supchat__topic.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #525252;
    border-top-color: transparent;
    border-radius: 50%;
    animation: supSpin 0.7s linear infinite;
}
.supchat__topic:hover {
    background: #525252;
    color: #fff;
}
.supchat__topic:active {
    transform: none;
    background: #525252;
    color: #fff;
}
.supchat__topic.other {
    border-style: dashed;
}
/* Цветовые схемы кнопок топиков */
.supchat__topic.red {
    border-color: #c62828;
    color: #c62828;
}
.supchat__topic.red:hover, .supchat__topic.red:active {
    background: #c62828;
    color: #fff;
}
.supchat__topic.green {
    border-color: #1A7537;
    color: #1A7537;
}
.supchat__topic.green:hover, .supchat__topic.green:active {
    background: #1A7537;
    color: #fff;
}
.supchat__topic.blue {
    border-color: #1565c0;
    color: #1565c0;
}
.supchat__topic.blue:hover, .supchat__topic.blue:active {
    background: #1565c0;
    color: #fff;
}
.supchat__topic.back {
    border-color: #666;
    color: #666;
}
.supchat__topic.back:hover {
    background: #666;
    color: #fff;
}
/* Селектор интеграций для жалобы */
.supchat__select {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid #525252;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: supTopicIn 0.3s ease-out backwards;
}
/* Скроллящийся список интеграций (жалоба / доработка) */
.supchat__picklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-height: 230px;
    overflow-y: auto;
    padding: 2px;
    animation: supTopicIn 0.3s ease-out backwards;
}
.supchat__picklist.hide {
    display: none;
}
/* Кастомная выпадашка: поле + список */
.supchat__dd {
    width: 100%;
    animation: supTopicIn 0.3s ease-out backwards;
}
.supchat__dd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #525252;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    color: #222;
    cursor: pointer;
    transition: none;
}
.supchat__dd-head span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.supchat__dd-chev {
    flex-shrink: 0;
    color: #525252;
}
.supchat__pick {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: none;
}
.supchat__pick.sel {
    border-color: #525252;
    background: #f4f4f4;
}
.supchat__pick-who {
    font-weight: 600;
    font-size: 14px;
    color: #222;
}
.supchat__pick-title {
    font-size: 13px;
    color: #666;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.supchat__topic:disabled {
    opacity: 0.5;
    cursor: default;
}
.supchat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8eaee;
    background: #525252;
}
.supchat__composer.hide {
    display: none;
}
.supchat__composer textarea {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    resize: vertical;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
}
.supchat__clip {
    cursor: pointer;
    padding: 8px 4px;
    user-select: none;
    display: flex;
    align-items: center;
}
.supchat__clip img {
    width: 24px;
    height: 24px;
    display: block;
}
.supchat__send {
    padding: 11px 20px;
    border-radius: 12px;
    border: 1px solid #dfe3e8;
    background: #fff;
    color: #000;
    font-size: 15px;
    cursor: pointer;
}
.supchat__send:disabled {
    opacity: 0.5;
    cursor: default;
}
.supchat__send-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background-color: #fff;
    border: 0;
    border-radius: 50%;
    padding: 5px;
    cursor: pointer;
}
.supchat__send-mobile img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}
.supchat__send-mobile:disabled {
    opacity: 0.5;
    cursor: default;
}
.supchat__preview {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-top: 1px solid #e8eaee;
    background: #fff;
    font-size: 13px;
}
.supchat__preview.show {
    display: flex;
}
.supchat__preview img {
    max-height: 48px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}
.supchat__preview button {
    border: 0;
    background: none;
    color: #c62828;
    cursor: pointer;
    font-size: 14px;
}
.supchat__err {
    padding: 8px 16px;
    font-size: 13px;
    color: #c62828;
    background: #fff;
}
@media (max-width: 760px) {
    .supchat__send {
        display: none;
    }
    .supchat__send-mobile {
        display: flex;
    }
}
@media (max-width: 650px) {
    .supchat__bubble {
        max-width: 88%;
    }
}

/* Увеличенная картинка: затемнённый фон на весь экран (только страница поддержки).
   :not(.hide) — чтобы скрытая модалка не перекрывала страницу */
.img-focus.chats:not(.hide) {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    cursor: zoom-out;
}
.img-focus.chats:not(.hide) img {
    max-width: 90vw;
    max-height: 90vh;
    height: auto;
    width: auto;
    border-radius: 12px;
    cursor: default;
}
.img-focus__close {
    position: fixed;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: #fff;
    color: #000;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.img-focus.hide .img-focus__close {
    display: none;
}
