/* ========================================================================= */
/* ===                 ВСЕ СТИЛИ ДЛЯ РЕЖИМА "ЧАТ"                      === */
/* ========================================================================= */
/* Этот файл содержит стили для всех компонентов чата: боковой панели с    */
/* участниками, основного окна с сообщениями, самих сообщений, реакций      */
/* и формы отправки.                                                       */
/* ========================================================================= */


/* === БЛОК 1: ЛЕВАЯ ПАНЕЛЬ - СПИСОК УЧАСТНИКОВ (ДЕСКТОП) === */

#chat-participants-view { 
    display: none;
    flex-direction: column; 
    flex-grow: 1;
    min-height: 0;
}

.chat-sidebar-content { 
    overflow-y: auto;
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 0.75rem; 
    padding-right: 10px; 
}
.participant-item { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
    padding: 0.5rem; 
    border-radius: 0.375rem; 
    transition: background-color 0.2s ease; 
}
.participant-item:hover { 
    background-color: var(--bg-main); 
}
.participant-avatar { 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    object-fit: cover; 
    flex-shrink: 0;
}
.participant-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.participant-name { 
    font-weight: 500; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.participant-rating {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.participant-rating svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.participant-level {
    flex-shrink: 0;
    margin-left: auto;
    width: 28px;
    height: 28px;
    background-color: var(--bg-panel);
    border: 1px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary);
}


/* === БЛОК 2: ЦЕНТРАЛЬНАЯ ОБЛАСТЬ - ОСНОВНОЕ ОКНО ЧАТА === */

#chat-view { 
    display: none;
    flex-direction: column; 
    flex-grow: 1;
    position: relative;
    min-height: 0; 
    height: 100%;
    overflow: hidden;
}

/* 1. Контейнер сообщений должен занимать всё свободное место */
#chat-messages-container { 
    flex-grow: 1;
    overflow-y: auto; 
    padding: 1rem 1.5rem;
    display: flex; 
    flex-direction: column; 
    gap: 1rem;
    scrollbar-width: none;
    height: 0; 
    min-height: 0; 
}
#chat-messages-container::-webkit-scrollbar {
    display: none;
}


/* === БЛОК 3: СТИЛИ ДЛЯ ОДНОГО СООБЩЕНИЯ === */

.chat-message { 
    display: flex; 
    align-items: flex-start; 
    gap: 0.75rem; 
    max-width: 75%; 
    width: fit-content; 
}
.chat-message-avatar { 
    width: 30px; 
    height: 30px; 
    border-radius: 50%; 
    object-fit: cover; 
    flex-shrink: 0; 
    margin-top: 2px; 
    border: 1px solid var(--primary);
}
.chat-message-content { 
    background-color: var(--bg-panel); 
    padding: 0.75rem 1rem; 
    border-radius: 1rem; 
    position: relative; 
    cursor: pointer;
}
.chat-message-header { 
    font-weight: 700; 
    font-size: 0.8rem; 
    margin-bottom: 0.10rem; 
    color: var(--primary); 
}
.chat-message-text { 
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-message-attachment { 
    margin-top: 0.5rem; 
}
.chat-message-attachment img { 
    max-width: 100%; 
    max-height: 300px; 
    border-radius: 0.5rem; 
    cursor: pointer;
    transition: opacity 0.2s ease; 
}
.chat-message-attachment img:hover { 
    opacity: 0.8; 
}

/* Стили для собственных сообщений */
.chat-message.is-own { 
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-message.is-own .chat-message-content {
    background-color: var(--bg-message); 
}
.chat-message.is-own .chat-message-header { 
    color: #bae6fd;
}


/* === БЛОК 4: РЕАКЦИИ И КНОПКА УДАЛЕНИЯ === */

.chat-reactions-container { 
    margin-top: 0.5rem; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.3rem; 
}
.reaction-btn { 
    background-color: var(--background-primary); 
    border: 1px solid var(--border-color); 
    border-radius: 1rem; 
    padding: 0.1rem 0.5rem; 
    font-size: 0.8rem; 
    cursor: pointer; 
    transition: all 0.2s ease; 
}
.reaction-btn:hover { 
    transform: scale(1.1); 
}
.reaction-btn.is-active { 
    background-color: var(--accent-color); 
    border-color: var(--accent-color); 
    color: #000; 
    font-weight: bold; 
}
.reaction-count { 
    margin-left: 0.25rem; 
    font-weight: 500; 
    font-size: 0.75rem; 
}

/* Всплывающее окно для выбора реакций */
.reaction-picker { 
    position: absolute; 
    bottom: 100%; 
    left: 0; 
    margin-bottom: 5px; 
    background-color: var(--bg-main); 
    border: 1px solid var(--border-color); 
    border-radius: 1rem; 
    padding: 0.75rem; 
    display: none;
    gap: 0.5rem; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); 
    z-index: 10; 
    flex-wrap: wrap; 
    width: 250px; 
}
.reaction-picker.is-visible { 
    display: flex; 
}
.reaction-picker .reaction-btn { 
    font-size: 1.2rem; padding: 0.2rem 0.4rem; background-color: transparent; border-color: transparent; 
}
.reaction-picker .reaction-btn:hover { 
    background-color: var(--background-tertiary); 
}
.reaction-picker .reaction-count { 
    display: none; 
}

/* Кнопка удаления сообщения */
.chat-delete-btn {
    position: absolute; top: -10px; right: -10px; z-index: 11;
    width: 28px; height: 28px;
    background-color: #3e2723;
    color: #bcaaa4;
    border: 1px solid #5d4037;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease-in-out;
}
.chat-message.is-own:hover .chat-delete-btn {
    opacity: 1;
    transform: scale(1);
}
.chat-delete-btn:hover {
    background-color: #dc3545;
    color: white;
    transform: scale(1.1) rotate(15deg);
}


/* === БЛОК 5: ФОРМА ОТПРАВКИ СООБЩЕНИЯ (СТИЛЬ ИИ-ЧАТА) === */

#chat-send-form { 
    flex-shrink: 0;          
    flex-grow: 0;            
    height: auto;            
    display: flex; 
    align-items: flex-end;
    gap: 10px; 
    padding: 10px 16px; 
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 20;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

#chat-message-input { 
    flex-grow: 1; 
    background-color: transparent;
    border: none; 
    padding: 8px 0; 
    height: auto; 
    min-height: 24px;
    max-height: 120px;
    color: #fff;
    font-family: inherit;
    outline: none;
    resize: none; 
    padding: 8px 0 54px 0; 
}

#chat-message-input:focus { 
    box-shadow: none;
}

#chat-message-input::placeholder {
    color: #666;
}

#chat-attach-btn, 
#chat-send-form button[type="submit"] { 
    flex-shrink: 0; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 0; 
    border: none; 
    background-color: transparent; 
    color: var(--text-secondary); 
    transition: all 0.2s ease; 
    margin-bottom: 46px;
}

#chat-attach-btn:hover { 
    color: #fff; 
    background-color: rgba(255,255,255,0.05); 
}

/* Уникальный стиль для кнопки "Отправить" как в ИИ-чате */
#chat-send-form button[type="submit"] { 
    background-color: var(--primary);
    color: #000; 
}

#chat-send-form button[type="submit"]:hover { 
    transform: scale(1.05); 
    box-shadow: 0 0 10px rgba(250, 191, 60, 0.4); 
}

#chat-send-form button[type="submit"]:disabled {
    background-color: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}


/* === БЛОК 6: КНОПКА ЗАГРУЗКИ ИСТОРИИ === */

.chat-load-more-container {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 1rem 0;
    width: 100%;
}

.chat-load-more-btn {
    border-radius: 20px;
    font-size: 0.8rem;
    padding: 0.3rem 1rem;
    background-color: var(--background-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.chat-load-more-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
}

.chat-load-more-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* === БЛОК 7: ВРЕМЯ И КНОПКА "ВНИЗ" === */

/* Время сообщения */
.chat-message-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 2px;
    margin-right: -4px;
    opacity: 0.8;
}

/* Цвет времени для своих сообщений */
.chat-message.is-own .chat-message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Плавающая кнопка "Вниз" */
.chat-scroll-down-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--bg-panel);
    border: 1px solid var(--primary);
    border-radius: 50%;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.chat-scroll-down-btn:hover {
    background-color: var(--primary);
    color: #000;
}

.chat-scroll-down-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==========================================================================
   SUPPORT CHAT STYLES (CYBER-GLASS UI)
   ========================================================================== */

/* Контейнер сообщений: эффект глубины и матового стекла */
#user-support-chat-messages,
#admin-support-chat-messages {
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.8) 0%, rgba(10, 10, 12, 0.9) 100%);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 450px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.3);
    scroll-behavior: smooth;
}

/* Кастомный элегантный скроллбар */
#user-support-chat-messages::-webkit-scrollbar,
#admin-support-chat-messages::-webkit-scrollbar {
    width: 6px;
}
#user-support-chat-messages::-webkit-scrollbar-track,
#admin-support-chat-messages::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 0;
}
#user-support-chat-messages::-webkit-scrollbar-thumb,
#admin-support-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(250, 191, 60, 0.2);
    border-radius: 10px;
    transition: background 0.3s;
}
#user-support-chat-messages::-webkit-scrollbar-thumb:hover,
#admin-support-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(250, 191, 60, 0.5);
}

/* --- СООБЩЕНИЯ --- */
.support-chat-message {
    display: flex;
    align-items: flex-end; /* Аватар прижимается к низу сообщения */
    gap: 12px;
    max-width: 88%;
    animation: chatPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: bottom center;
}

@keyframes chatPopIn { 
    0% { opacity: 0; transform: translateY(15px) scale(0.95); } 
    100% { opacity: 1; transform: translateY(0) scale(1); } 
}

/* Аватарка */
.support-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px; /* Более современный скругленный квадрат */
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* Пузырь сообщения */
.support-chat-content {
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0; /* Предотвращает вылезание длинного текста */
}

.support-chat-text {
    padding: 12px 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* Имя и время */
.support-chat-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-left: 4px;
    letter-spacing: 0.3px;
}

.support-chat-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
    font-family: var(--font-mono);
}

/* Правильное отображение прикрепленных картинок в чате */
.chat-image-wrapper {
    display: block;
    line-height: 0; /* Убивает лишние отступы снизу */
}

.chat-image-wrapper img {
    max-width: 100%;
    max-height: 280px; /* Ограничиваем вертикальные картинки, чтобы не были огромными */
    width: auto;
    object-fit: contain; /* Картинка сохранит пропорции и не обрежется */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-image-wrapper img:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

/* Если сообщение состоит ТОЛЬКО из картинки (пустой текст), убираем лишние отступы */
.support-chat-text:empty {
    display: none;
}

/* --- ВХОДЯЩИЕ (СЛЕВА) --- */
.support-chat-message:not(.is-own) {
    align-self: flex-start;
}
.support-chat-message:not(.is-own) .support-chat-text {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Асимметричный радиус как в мессенджерах */
    border-radius: 18px 18px 18px 4px; 
}
.support-chat-message:not(.is-own) .support-chat-time {
    text-align: left;
    margin-left: 4px;
}

/* --- ИСХОДЯЩИЕ (СПРАВА) --- */
.support-chat-message.is-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.support-chat-message.is-own .support-chat-sender {
    text-align: right;
    margin-right: 4px;
    color: var(--primary);
}
.support-chat-message.is-own .support-chat-text {
    background: linear-gradient(135deg, rgba(250, 191, 60, 0.15) 0%, rgba(250, 191, 60, 0.05) 100%);
    border: 1px solid rgba(250, 191, 60, 0.3);
    color: #fff;
    /* Асимметричный радиус */
    border-radius: 18px 18px 4px 18px; 
    box-shadow: 0 4px 20px rgba(250, 191, 60, 0.08);
}
.support-chat-message.is-own .support-chat-time {
    text-align: right;
    margin-right: 4px;
    color: rgba(250, 191, 60, 0.6);
}

/* --- ОБЛАСТЬ ВВОДА (СКРЕПКА + ИНПУТ) --- */
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 8px 14px;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.chat-input-wrapper:focus-within {
    border-color: rgba(250, 191, 60, 0.5);
    box-shadow: 0 0 20px rgba(250, 191, 60, 0.15), 0 8px 25px rgba(0, 0, 0, 0.3);
    background: rgba(25, 25, 25, 0.9);
}

/* Кнопка скрепки */
.btn-attach {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    padding: 0;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-attach:hover {
    color: var(--primary);
    background: rgba(250, 191, 60, 0.1);
    border-color: rgba(250, 191, 60, 0.3);
    transform: translateY(-1px);
}

/* Поле ввода */
.chat-input-field {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 10px 0;
    font-family: var(--font-family);
    font-size: 0.95rem;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
}

.chat-input-field::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Кнопка отправки */
.btn-send-chat {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-bottom: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(250, 191, 60, 0.3);
}

.btn-send-chat:hover {
    background: #ffcf54;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 15px rgba(250, 191, 60, 0.5);
}

.btn-send-chat svg, .btn-send-chat i {
    margin-left: -2px; /* Визуальная центровка иконки Send */
    margin-top: 2px;
    font-size: 1.1rem;
}

.btn-send-chat:disabled {
    background: #333;
    color: #666;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* Превью прикрепленного файла */
.attachment-preview-area {
    display: flex;
    gap: 12px;
    padding: 12px 0 0 0;
    flex-wrap: wrap;
}

.chat-attachment-preview {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 15px rgba(250, 191, 60, 0.2);
    animation: popIn 0.3s ease;
}

@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chat-attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-attachment-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.2);
}

.chat-attachment-remove:hover {
    background: var(--bs-danger);
    transform: scale(1.1);
}

/* --- Стили для панели админа (список тикетов) --- */
#admin-support-ticket-list {
    overflow-y: auto;
}
.ticket-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}
.ticket-item:hover { background-color: var(--background-secondary); }
.ticket-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.ticket-info { flex-grow: 1; }
.ticket-username { font-weight: 500; }
.ticket-date { font-size: 0.8rem; color: var(--text-secondary); }
.ticket-unread-badge { background-color: var(--accent-color); color: #000; font-size: 0.75rem; font-weight: bold; padding: 0.2rem 0.5rem; border-radius: 1rem; }


/* --- Кнопка в профиле (без изменений) --- */
.support-button-wrapper { position: relative; }
.support-badge { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; background-color: var(--bs-danger); border-radius: 50%; border: 2px solid var(--panel-bg); display: none; }
.support-badge.visible { display: block; }

#admin-support-chat-view {
    display: flex;          /* 1. Делаем этот блок flex-контейнером для его детей */
    flex-direction: column; /* 2. Располагаем его детей (хедер, сообщения, футер) в столбик */
    flex-grow: 1;           /* 3. Заставляем его занять всё доступное место в .modal-body */
    height: 100%;           /* 4. Убеждаемся, что он использует всю высоту родителя */
    min-height: 0;          /* 5. Flexbox-трюк для корректной работы прокрутки внутри */
}

/* === БЛОК 1 (ДОПОЛНЕНИЕ): СТИЛИ ДЛЯ VIP УЧАСТНИКОВ === */

/* Обертка для аватара, чтобы сделать красивое свечение */
.participant-avatar-wrapper {
    position: relative;
    width: 32px; 
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;       /* Скругляем саму обертку */
    overflow: hidden;         /* Обрезаем все, что вылезает (длинный текст alt) */
    background-color: #2b2d31; /* Цвет фона, пока картинка грузится или если она битая */
}

/* Сама картинка */
.participant-avatar { 
    width: 100%; 
    height: 100%; 
    border-radius: 50%; 
    object-fit: cover; 
    display: block; /* Убираем нижние отступы строчных элементов */
}

/* --- VIP СТИЛИ --- */

/* Золотая рамка и свечение для VIP аватара */
.is-vip-participant .participant-avatar {
    border: 2px solid #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Строка с именем и короной */
.participant-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Имя VIP-пользователя тоже можно сделать золотым (по желанию) */
.is-vip-participant .participant-name {
    color: #FFD700;
    font-weight: 700;
}

/* Значок PRO (вместо короны) */
.participant-vip-badge {
    background: linear-gradient(45deg, #FFD700, #FFA500); /* Золотой градиент */
    color: #000; /* Черный текст для контраста */
    font-size: 0.55rem;
    font-weight: 900;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    margin-left: 4px;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.4); /* Золотое свечение */
    display: inline-block;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* Легкая анимация парения короны */
@keyframes float-crown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.chat-media-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    background: #000;
}

.chat-media-audio {
    width: 100%;
    min-width: 250px;
    height: 40px;
    border-radius: 20px;
}

.chat-message-attachment.video,
.chat-message-attachment.audio {
    margin-top: 8px;
}

/* --- ЛОАДЕР ЧАТА (FIX) --- */
.chat-loader-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    
    /* УБРАЛИ ЖЕСТКИЙ ЧЕРНЫЙ ФОН И ДОБАВИЛИ ЭФФЕКТ СТЕКЛА */
    background: transparent; 
    backdrop-filter: blur(4px); /* Легкое размытие фона, если под ним уже есть старые сообщения */
    
    z-index: 500; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.chat-loader-spinner {
    position: relative;
    width: 80px; 
    height: 80px;
    margin-bottom: 10px;
}

/* Внешнее кольцо */
.chat-spinner-outer {
    position: absolute;
    top: 0; left: 0;
    width: 80%; height: 80%;
    animation: spin-slow 8s linear infinite;
    object-fit: contain;
}

/* Внутреннее ядро (логотип) */
.chat-spinner-core {
    position: absolute;
    top: 0%; left: 0%;
    width: 80%; /* Чуть меньше, чтобы было внутри кольца */
    height: 80%;
    object-fit: contain;
    animation: pulse-logo 2s infinite ease-in-out;
}

.chat-loader-text {
    font-family: 'Bowler', monospace;
    color: var(--neon-main);
    font-size: 0.8rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Анимации */
@keyframes spin-slow { 100% { transform: rotate(2600deg); } }

/* Скрытие контейнера сообщений (чтобы не было видно прыжков) */
#chat-messages-container {
    opacity: 1;
    transition: opacity 0.5s ease-in-out; /* Плавное появление */
    will-change: opacity;
}

#chat-messages-container.is-hidden {
    opacity: 0 !important;
    overflow: hidden !important; /* Блокируем скролл пока грузится */
}

#chat-messages-container.is-loading {
    opacity: 0 !important; /* Скрыт при загрузке */
}
