/* public/css/call/call-chat.css */
.in-call-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--call-participant-panel-bg, rgba(30, 30, 47, 0.95));
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--call-glass-border);
}

.in-call-chat .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.in-call-chat .chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.in-call-chat .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.in-call-chat .close-btn:hover {
    opacity: 1;
}

/* Область сообщений */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ========================================================= */
/* ПЕРЕОПРЕДЕЛЯЕМ ВСЕ СТИЛИ СООБЩЕНИЙ С МАКСИМАЛЬНОЙ СИЛОЙ */
/* ========================================================= */

/* Само сообщение – горизонтальный flex */
.in-call-chat .chat-messages .message {
    display: flex !important;
    flex-direction: row !important;
    max-width: 85% !important;
    width: auto !important;
    gap: 10px !important;
    align-items: flex-start !important;
    margin-bottom: 4px !important;
}

/* Своё сообщение – аватар справа и выравнивание вправо */
.in-call-chat .chat-messages .message.own {
    flex-direction: row-reverse !important;
    align-self: flex-end !important;
}

/* Чужое сообщение – аватар слева */
.in-call-chat .chat-messages .message:not(.own) {
    align-self: flex-start !important;
}

/* Аватар */
.in-call-chat .chat-messages .message .message-avatar {
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    color: white !important;
    cursor: pointer !important;
    box-shadow: var(--shadow-sm) !important;
    margin: 0 !important;
}

/* Пузырь сообщения – ширина по содержимому */
.in-call-chat .chat-messages .message .message-bubble {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 22px !important;
    padding: 10px 16px !important;
    word-break: break-word !important;
    max-width: 100% !important;
    width: fit-content !important;
    box-sizing: border-box !important;
    box-shadow: var(--shadow-sm) !important;
}

.in-call-chat .chat-messages .message.own .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    color: white !important;
}

/* Текст и мета-информация – в одной строке */
.in-call-chat .chat-messages .message .message-text-inline {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.in-call-chat .chat-messages .message .message-content-text {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    line-height: 1.45 !important;
    font-size: 14px !important;
    flex: 1 1 auto !important;
}

.in-call-chat .chat-messages .message .message-meta-inline {
    flex-shrink: 0 !important;
    font-size: 10px !important;
    opacity: 0.7 !important;
    color: inherit !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    align-self: flex-end !important;
}

/* Для медиа-контента – убираем фон пузыря */
.in-call-chat .chat-messages .message:has(.custom-video-player) .message-bubble,
.in-call-chat .chat-messages .message:has(.voice-container) .message-bubble,
.in-call-chat .chat-messages .message:has(.image-message-container) .message-bubble,
.in-call-chat .chat-messages .message:has(.document-preview) .message-bubble,
.in-call-chat .chat-messages .message:has(.file-preview-card) .message-bubble,
.in-call-chat .chat-messages .message:has(.text-preview) .message-bubble {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Скрываем лишние элементы, которые могут мешать */
.in-call-chat .chat-messages .message .message-meta {
    display: none !important;
}

/* Панель ввода */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-group input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 30px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.input-group input::placeholder {
    color: rgba(255,255,255,0.5);
}

.input-group button {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.input-group button:hover {
    background: rgba(255,255,255,0.2);
}

.files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.file-chip {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Светлая тема */
body.light-theme .in-call-chat {
    background: rgba(255, 255, 255, 0.95);
    color: #1e2a3a;
}
body.light-theme .in-call-chat .chat-header {
    border-bottom-color: rgba(0,0,0,0.1);
}
body.light-theme .in-call-chat .close-btn {
    color: #1e2a3a;
}
body.light-theme .in-call-chat .chat-messages .message .message-bubble {
    background: rgba(0, 0, 0, 0.05);
}
body.light-theme .in-call-chat .chat-messages .message.own .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    color: white !important;
}
body.light-theme .in-call-chat .input-group input {
    background: rgba(0, 0, 0, 0.05);
    color: #1e2a3a;
}