/* Общие настройки страницы */
body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Контейнер сообщений */
#messages {
    height: 450px;
    overflow-y: auto;
    background: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

/* Базовый стиль сообщения */
.msg {
    padding: 8px 15px;
    border-radius: 18px;
    width: fit-content;
    max-width: 75%;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    word-wrap: break-word;
    animation: fadeInUp 0.2s ease-out forwards;
}

/* Мои сообщения (справа) */
.msg-mine {
    background: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Чужие сообщения (слева) */
.msg-theirs {
    background: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Индикатор прочитанного (галочки) */
.bi-check2-all {
    margin-left: 5px;
    font-size: 0.85rem;
    color: #e0e0e0;
}

/* Точка онлайн-статуса */
.online-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}
.bg-success { background-color: #28a745 !important; } /* Онлайн */
.bg-secondary { background-color: #adb5bd !important; } /* Офлайн */

/* Индикатор "Печатает..." */
#typingStatus {
    font-style: italic;
    color: #6c757d;
    font-size: 0.85rem;
    padding: 5px 20px;
    height: 25px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    transition: all 0.2s ease;
}

/* Плавное появление чата */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-fade-in {
    animation: fadeInUp 0.3s ease-out forwards;
}

/* Кастомизация скроллбара */
#messages::-webkit-scrollbar {
    width: 6px;
}
#messages::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* Заглушка, когда чат не выбран */
#noChatPlaceholder {
    color: #adb5bd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 550px;
    background: white;
    border-radius: 8px;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .msg {
        max-width: 90%;
    }
    #messages {
        height: 350px;
    }
}

/* Стиль скроллбара в списке контактов */
.list-group::-webkit-scrollbar {
    width: 4px;
}
.list-group::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

/* Время сообщения */
.msg small.text-muted {
    font-size: 0.65rem;
    white-space: nowrap;
}
.group-controls-hidden {
    display: none !important;
}

#loadingIndicator {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    font-size: 0.85rem;
    color: #6c757d;
    border-radius: 20px;
    margin: 5px auto;
    width: 80%;
}