/* Вкладка «Telegram» в чатах: ответы людей на бот-рассылку.
   Собственных цветов и размеров тут почти нет — всё берётся из chat.css, чтобы вкладка
   ощущалась тем же экраном, а не пристройкой. Своё только то, чего в обычных чатах нет:
   переключатель источника, чип бота, баннеры состояний и заглушки вложений. */

/* ----- ПЕРЕКЛЮЧАТЕЛЬ ИСТОЧНИКА ----- */
.chat-source-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 12px 0;
}
.chat-source-tab {
    flex: 1;
    background: transparent;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #888;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.chat-source-tab:hover { color: #E8E8E8; border-color: #383838; }
.chat-source-tab.active {
    color: #00E599;
    border-color: rgba(0, 229, 153, 0.45);
    background: rgba(0, 229, 153, 0.08);
}
.tg-tab-badge {
    background: #00E599;
    color: #0F0F0F;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ----- ЧИП БОТА -----
   Цвет закреплён за аккаунтом навсегда (см. botChipClass в frontend/tg-chats.js): глаз узнаёт
   цвет быстрее, чем читает подпись, а путать, от чьего лица идёт разговор, нельзя. */
.tg-bot-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid currentColor;
    white-space: nowrap;
    flex-shrink: 0;
}
.tg-bot-chip span { opacity: 0.75; font-weight: 500; }
.tg-chip-0 { color: #00E599; }
.tg-chip-1 { color: #4DA3FF; }
.tg-chip-2 { color: #FFB347; }
.tg-chip-3 { color: #C792EA; }
.tg-chip-4 { color: #FF7A9C; }
.tg-chip-5 { color: #5FD3C4; }
.tg-chip-6 { color: #E0C76A; }
.tg-chip-7 { color: #8FB8FF; }

.chat-item-bottom .tg-bot-chip { margin-left: auto; }

/* ----- ШАПКА ДИАЛОГА ----- */
.tg-header-sub {
    font-size: 0.7rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.tg-header-sub a { color: #00E599; text-decoration: none; }
.tg-header-sub a:hover { text-decoration: underline; }

/* ----- БАННЕРЫ СОСТОЯНИЙ -----
   Всегда с причиной и, если он есть, с запасным путём. У собеседника без юзернейма запасного
   пути не существует вовсе: ссылка tg://user?id= из личного Telegram не открывается,
   access_hash есть только у бота. */
.tg-banner {
    margin: 0 16px 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.45;
    border: 1px solid #333;
    background: #141414;
    color: #C8C8C8;
}
.tg-banner strong { color: #E8E8E8; font-weight: 600; }
.tg-banner a { color: #00E599; }
.tg-banner.warn { border-color: rgba(255, 179, 71, 0.4); background: rgba(255, 179, 71, 0.07); }
.tg-banner.danger { border-color: rgba(255, 51, 85, 0.4); background: rgba(255, 51, 85, 0.07); }

/* ----- ВЛОЖЕНИЯ -----
   Автоматически ничего не качаем: скрины инвентаря летят пачками, а трафик прокси дорог.
   Поэтому вместо картинки — заглушка с кнопкой, и загрузка идёт по явному клику. */
.tg-media-stub {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #141414;
    border: 1px dashed #333;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: #AAA;
}
.tg-media-stub button {
    background: rgba(0, 229, 153, 0.12);
    border: 1px solid rgba(0, 229, 153, 0.35);
    color: #00E599;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
}
.tg-media-stub button:hover { background: rgba(0, 229, 153, 0.2); }
.tg-media-stub button:disabled { opacity: 0.5; cursor: default; }
.tg-media-stub.failed { border-color: rgba(255, 51, 85, 0.35); color: #ff8ba0; }

/* ----- СТАТУС ОТПРАВКИ ----- */
.tg-msg-status { font-size: 0.62rem; color: #888; }
.tg-msg-status.sent { color: #00E599; }
.tg-msg-status.failed { color: #ff3355; cursor: pointer; text-decoration: underline dotted; }

/* ----- ССЫЛКИ ОТ НЕЗНАКОМЦЕВ -----
   Доверенные домены подсвечиваем спокойно, ПОХОЖИЕ на них — тревожно. Именно так уводят
   инвентари: человек ждёт ссылку на обмен и кликает не глядя. */
.tg-link { color: #00E599; text-decoration: underline; }
.tg-link.external { color: #FFB347; }
.tg-link.lookalike { color: #ff3355; font-weight: 600; }
.tg-link-note {
    display: block;
    margin-top: 5px;
    font-size: 0.66rem;
    color: #FFB347;
}
.tg-link-note.danger { color: #ff3355; }

/* ----- ПОДПИСЬ ПЕРСОНЫ У ПОЛЯ ВВОДА -----
   Владелец ни на секунду не должен забывать, от чьего лица говорит. */
.tg-compose-as {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px 0;
    font-size: 0.7rem;
    color: #888;
}
.tg-compose-as b { color: #E8E8E8; font-weight: 600; }

.tg-archive-toggle {
    width: calc(100% - 24px);
    margin: 4px 12px 10px;
    background: transparent;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #888;
    font-family: inherit;
    font-size: 0.74rem;
    padding: 7px;
    cursor: pointer;
}
.tg-archive-toggle:hover { color: #E8E8E8; border-color: #383838; }

.tg-dup-note {
    font-size: 0.66rem;
    color: #FFB347;
    padding: 2px 0 0;
}

/* .chat-list и .chat-search задают свой display, а он перебивает браузерный [hidden].
   Без этого скрытый список продолжал бы занимать место в сайдбаре. */
.chat-list[hidden],
.chat-search[hidden] { display: none !important; }

/* Стикер меньше обычной картинки и без фона — он и есть «эмодзи покрупнее». */
.tg-sticker { max-width: 160px; max-height: 160px; background: transparent; object-fit: contain; }
.tg-video-poster { display: block; margin-bottom: 6px; }
.tg-audio { width: 240px; max-width: 100%; height: 36px; }
