/* Общие стили */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Контейнеры */
.container-fluid {
    height: 100%;
}

/* Список контактов */
.contact-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact-item:hover {
    background-color: #e9ecef;
}

.active-contact {
    background-color: #cfe2ff;
    border-left: 4px solid #25D366;
}

/* Область сообщений */
#messagesArea {
    background-color: #e5ddd5;
    background-image: url('https://www.transparenttextures.com/patterns/dark-dotted-2.png');
    height: calc(100vh - 130px);
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

/* Блоки сообщений */
.message {
    display: flex;
    margin-bottom: 12px;
    width: 100%;
}

.message.mine {
    justify-content: flex-end;
}

.message.theirs {
    justify-content: flex-start;
}

/* Пузырьки сообщений */
.message-bubble {
    max-width: 70%;
    word-wrap: break-word;
    border-radius: 18px;
    padding: 8px 12px;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}

.message.mine .message-bubble {
    background-color: #dcf8c5;
    border-bottom-right-radius: 4px;
}

.message.theirs .message-bubble {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-bottom-left-radius: 4px;
}

/* Изображения внутри сообщений */
.message-bubble img {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 5px;
}

/* Заголовок чата */
#chatHeader {
    background-color: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
}

/* Кнопка очистки */
#clearChatBtn {
    font-size: 14px;
    padding: 4px 10px;
}

/* Панель ввода */
#messageInput:disabled,
#sendBtn:disabled,
#attachBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Модальное окно */
.modal-content {
    border-radius: 12px;
}

/* Адаптив для мобильных устройств */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 85%;
    }
    #messagesArea {
        height: calc(100vh - 120px);
    }
    .contact-item {
        padding: 12px;
    }
}

/* Стили для скроллбара (опционально, для красоты) */
#messagesArea::-webkit-scrollbar {
    width: 6px;
}
#messagesArea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
#messagesArea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}
#messagesArea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}



/* Галочки прочтения */
.message-bubble .small {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}
.message-bubble .small span {
    font-size: 12px;
}



.contact-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
#userAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.2s;
}
#userAvatar:hover {
    opacity: 0.8;
}