/* --- СТИЛИ --- */
body {
    font-family: "Arial", "Helvetica", sans-serif;
    background-color: #f7f7f7;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

header {
    background-color: var(--mfc-brown);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 4px solid var(--mfc-red);
    min-height: 60px;
    box-sizing: border-box;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-box {
    background-color: white;
    color: var(--mfc-brown);
    padding: 5px 10px;
    font-weight: bold;
    font-size: 20px;
    border-radius: 2px;
}

.site-title {
    font-size: 14px;
    line-height: 1.2;
    max-width: 400px;
}

.container {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 20px auto 20px;
    gap: 20px;
    padding: 0 15px;
    flex: 1;
    box-sizing: border-box;
}

aside {
    flex: 1;
    min-width: 250px;
    background: white;
    border: 1px solid #ddd;
    padding: 20px;
    height: fit-content;
    transition: opacity 0.3s, visibility 0.3s;
}

aside h3 {
    color: var(--mfc-brown);
    font-size: 15px;
    margin-top: 0;
    border-bottom: 2px solid var(--mfc-beige);
    padding-bottom: 10px;
    text-transform: uppercase;
}

.doc-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.doc-list li {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.doc-list a {
    color: var(--mfc-brown);
    text-decoration: none;
    font-size: 13px;
    display: block;
}

.doc-list a:hover {
    color: var(--mfc-red);
}

.doc-icon {
    margin-right: 5px;
    color: #999;
}

/* === ОСНОВНОЙ БЛОК ЧАТА (DESKTOP) === */
main {
    flex: 3;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 85vh;
    min-height: 500px;
    transition: all 0.3s ease;
}

main.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    z-index: 9999;
    border: none;
    margin: 0;
}

.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.fullscreen-overlay.active {
    display: block;
}

body.fullscreen-active {
    overflow: hidden;
}

body.fullscreen-active aside {
    opacity: 0;
    visibility: hidden;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal-box {
    background: white;
    padding: 25px;
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    border-top: 4px solid var(--mfc-red);
}

.modal-box h3 {
    margin-top: 0;
    color: var(--mfc-brown);
    font-size: 18px;
    margin-bottom: 10px;
}

.modal-box p {
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 2px;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.modal-btn-cancel {
    background: #e5e5e5;
    color: #333;
}

.modal-btn-cancel:hover {
    background: #d4d4d4;
}

.modal-btn-confirm {
    background: var(--mfc-red);
    color: white;
}

.modal-btn-confirm:hover {
    background: #a82e1f;
}

.alert-box {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    padding: 10px 15px;
    font-size: 13px;
    border-left: 4px solid #ffc107;
    margin: 0;
}

.chat-header {
    background-color: var(--mfc-beige);
    padding: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    position: relative;
}

.operator-info h2 {
    margin: 0;
    font-size: 16px;
    color: var(--mfc-brown);
    text-transform: uppercase;
}

.operator-status {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.operator-status.searching {
    color: #ff9800;
}

.operator-status.online {
    color: green;
}

.operator-status.completed {
    color: #2e7d32;
    font-weight: bold;
}

.operator-status.blocked {
    color: #cf3a28;
    font-weight: bold;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: pulse 1.5s infinite;
}

.operator-status.searching .status-dot {
    background: #ff9800;
}

.operator-status.online .status-dot {
    background: green;
    animation: none;
}

.operator-status.completed .status-dot {
    background: #2e7d32;
    animation: none;
}

.operator-status.blocked .status-dot {
    background: #cf3a28;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.chat-window {
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    min-height: 0;
    scroll-behavior: auto;
}

.message {
    max-width: 80%;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.4s forwards;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.msg-system {
    background-color: #f2f2f2;
    align-self: flex-start;
    border-left: 4px solid var(--mfc-brown);
    color: #444;
    max-width: 90%;
}

.msg-operator {
    background-color: var(--mfc-beige);
    align-self: flex-start;
    border: 1px solid #e0e0e0;
}

.msg-user {
    background-color: #eef6fc;
    align-self: flex-end;
    border: 1px solid #dbeafe;
    text-align: right;
}

.msg-time {
    display: block;
    font-size: 10px;
    color: #888;
    margin-top: 5px;
}

.msg-author {
    font-weight: bold;
    font-size: 11px;
    color: var(--mfc-brown);
    margin-bottom: 4px;
    display: block;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 15px;
    background-color: var(--mfc-beige);
    border-radius: 4px;
    width: fit-content;
    align-self: flex-start;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #888;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.input-area {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* === ОБНОВЛЕННЫЕ СТИЛИ ДЛЯ ПОЛЯ ВВОДА И КНОПКИ === */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 0;
    position: relative;
    width: 100%;
}

/* Контейнер поля ввода (стиль без скруглений, 2px радиус) */
.input-wrapper {
    display: flex;
    align-items: center; /* Центрируем иконку по высоте */
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
    width: 100%;
    padding: 5px;
    box-sizing: border-box;
    position: relative;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--mfc-brown);
}

textarea {
    flex: 1;
    padding: 10px 10px 10px 15px;
    border: none;
    border-radius: 0;
    resize: vertical;
    min-height: 44px;
    max-height: 150px;
    font-family: inherit;
    box-sizing: border-box;
    min-width: 0;
    background: transparent;
    outline: none;
}

textarea:disabled {
    background-color: transparent;
    cursor: not-allowed;
    color: #999;
}

.phone-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 0;
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
    min-width: 0;
    outline: none;
    display: none;
    background: transparent;
}

.phone-consent-row {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}
.phone-consent-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Кнопка отправки - иконка */
button.send-btn {
    background-color: transparent;
    color: var(--mfc-red);
    border: none;
    padding: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
}

button.send-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

button.send-btn:hover:not(:disabled) {
    background-color: #f0f0f0;
    color: #a82e1f;
}

button.send-btn:disabled {
    color: #ccc;
    background-color: transparent;
    cursor: not-allowed;
}

/* === КНОПКИ УПРАВЛЕНИЯ === */
.call-operator-btn {
    background-color: #4e3b31;
    color: white;
    border: none;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 12px;
    border-radius: 2px;
    transition: background 0.2s, opacity 0.2s;
}

.call-operator-btn:hover {
    background-color: #3a2d24;
}

.call-operator-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.end-chat-btn {
    background-color: #666;
    color: white;
    border: none;
    padding: 8px 15px;
    font-weight: normal;
    cursor: pointer;
    font-size: 12px;
    border-radius: 2px;
    transition: background 0.2s;
}

.end-chat-btn:hover {
    background-color: #444;
}

.fullscreen-btn {
    background-color: transparent;
    color: var(--mfc-brown);
    border: 1px solid var(--mfc-brown);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 2px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
}

.fullscreen-btn:hover {
    background-color: var(--mfc-brown);
    color: white;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === МОБИЛЬНАЯ ВЕРСИЯ (Объединенный блок) === */
@media (max-width: 768px) {
    /* 1. Базовые настройки для обычного режима */
    html, body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .container {
        display: flex;
        flex-direction: column;
        margin: 5px auto 0;
        padding: 0 5px;
        width: 100%;
        min-height: calc(100vh - 80px);
    }

    .chat-header {
        position: sticky;
        top: 0;
        z-index: 101;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 15px;
    }
    .operator-info {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding-right: 40px;
    }
    .operator-info-text { flex: 1; }
    .operator-info h2 { font-size: 14px; margin-bottom: 2px; }
    .operator-info #appealNumber { font-size: 11px; }

    .fullscreen-btn {
        position: absolute;
        top: 10px;
        right: 15px;
        padding: 4px;
        font-size: 16px;
        min-width: 28px;
        height: 28px;
        z-index: 10;
    }

    .header-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .call-operator-btn, .end-chat-btn {
        width: 100%;
        padding: 10px;
        font-size: 12px;
        order: 1;
    }
    .operator-status {
        font-size: 10px;
        justify-content: center;
        text-align: center;
        width: 100%;
        padding: 0;
        background: none !important;
        border-radius: 0;
        margin-top: 5px;
        order: 2;
    }
    .status-dot { width: 6px; height: 6px; }

    /* 4. MAIN в обычном режиме */
    main {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 85vh; /* Фиксированная высота блока */
        max-height: 85vh; /* Жесткое ограничение */
        overflow: hidden; /* Скрываем внешний скролл самого блока */
        min-height: 400px;
        border: 1px solid #ddd;
        position: relative;
        margin-bottom: 20px;
    }

    /* Внутренний скролл сообщений */
    .chat-window {
        flex: 1;
        overflow-y: auto; /* Скролл только здесь */
        padding: 10px;
        height: 100%;
    }

    /* Поле ввода */
    .input-area {
        flex-shrink: 0;
        padding: 10px;
        background: #f9f9f9;
        padding-bottom: 10px;
    }

    /* Стили полей ввода */
    .input-row { flex-direction: row; }
    .input-wrapper { border-radius: 2px; }
    textarea { padding: 10px 10px 10px 15px; font-size: 14px; }

    /* Логика кнопки для телефона */
    textarea[style*="none"] ~ button.send-btn,
    textarea[style*="display: none"] ~ button.send-btn {
        width: auto;
        padding: 12px;
        font-size: 12px;
        margin-left: 0;
        border-radius: 0 0 2px 2px;
    }
    .input-row:has(textarea[style*="none"]) { flex-direction: column; }
    .input-row:has(textarea[style*="none"]) .input-wrapper {
        border: none; padding: 0; background: transparent; flex-direction: column; gap: 10px;
    }
    .input-row:has(textarea[style*="none"]) .phone-input {
        background: #fff; border: 2px solid var(--mfc-red); border-radius: 2px; display: block; width: 100%;
    }
    .input-row:has(textarea[style*="none"]) button.send-btn {
        width: 100%; margin-left: 0; border-radius: 2px;
    }

    aside { display: none; }

    /* === 5. КРИТИЧЕСКИЕ ПРАВКИ ДЛЯ FULLSCREEN === */

    /* Когда класс fullscreen-active есть на BODY */
    body.fullscreen-active {
        overflow: hidden !important;
        height: 100dvh !important;
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
    }

    /* Когда класс fullscreen-mode есть на MAIN */
    main.fullscreen-mode {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0;
        border: none;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Тоже важно */
    }

    main.fullscreen-mode .input-area {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    main.fullscreen-mode .alert-box { display: none; }

    body.fullscreen-active footer { display: none; }

    textarea:disabled {
        pointer-events: none;
    }

    /* Fallback (перенесен) */
    textarea[style*="none"] ~ .phone-input {
        background: #fff;
        border: 2px solid var(--mfc-red);
        border-radius: 2px;
        margin-bottom: 10px;
    }
}

footer {
    background-color: #333;
    color: #999;
    padding: 20px;
    font-size: 12px;
    text-align: center;
    margin-top: auto;
    flex-shrink: 0;
}

/* === ПРИВЕТСТВЕННЫЙ ЭКРАН === */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
    color: #555;
    animation: fadeIn 0.5s ease-out;
}

.start-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.start-screen h3 {
    color: var(--mfc-brown);
    margin: 0 0 10px 0;
    font-size: 18px;
    text-transform: uppercase;
}

.start-screen p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 5px 0;
    max-width: 300px;
}

.start-hint {
    color: #888;
    font-size: 13px !important;
    margin-bottom: 20px !important;
}

.start-btn-big {
    background-color: var(--mfc-red);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(207, 58, 40, 0.2);
    transition: transform 0.2s, background-color 0.2s;
    animation: pulse-btn 2s infinite;
}

.start-btn-big:hover {
    background-color: #a82e1f;
    transform: translateY(-2px);
}

.start-btn-big:active {
    transform: translateY(0);
}

@keyframes pulse-btn {
    0% { box-shadow: 0 0 0 0 rgba(207, 58, 40, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(207, 58, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(207, 58, 40, 0); }
}

/* Скрываем приветствие на мобильном при открытой клавиатуре, если места мало */
@media (max-height: 500px) {
    .start-icon { display: none; }
    .start-screen { justify-content: flex-start; padding-top: 40px; }
}

/* Всплывающее уведомление (Toast) - ЦЕНТР ЧАТА */
.toast-notification {
    position: absolute; /* <--- ГЛАВНОЕ ИЗМЕНЕНИЕ (было fixed) */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    
    /* Фирменные цвета */
    background-color: #ffffff; /* Коричневый фон */
    border: 2px solid #cf3a28; /* Красная рамка */
    color: #4e3b31; /* Белый текст */
    
    padding: 20px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 10px 40px rgba(78, 59, 49, 0.4);
    
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-out;
    z-index: 1000;
    pointer-events: none;
    
    width: max-content; /* Оптимальная ширина под текст */
    max-width: 90%;     /* Чтобы не вылезало за края на мобильном */
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Кнопка "Новое сообщение" снизу */
.scroll-down-badge {
    position: absolute;
    bottom: 90px; /* Чуть выше поля ввода */
    right: 20px;
    
    background-color: var(--mfc-brown); /* Фирменный коричневый */
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 900; /* Ниже тоста, но выше чата */
    display: flex;
    align-items: center;
    gap: 5px;
}

.scroll-down-badge span {
    font-size: 16px;
}

.scroll-down-badge:hover {
    background-color: #3a2d24;
}

.scroll-down-badge.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-down-badge::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background-color: var(--mfc-red);
    border-radius: 50%;
    border: 2px solid white;
}

/* Анимация пульсации для привлечения внимания */
@keyframes attention-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.7); /* Оранжевый цвет */
        border-color: #ff6600;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 102, 0, 0);
        border-color: #ff6600;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0);
        border-color: #ccc; /* Возврат к обычному цвету */
    }
}

/* Класс, который мы будем добавлять через JS */
.highlight-input {
    animation: attention-pulse 2s infinite;
    border: 2px solid #ff6600 !important; /* Принудительно красим рамку */
}

/* --- ВАЖНОЕ ИСПРАВЛЕНИЕ ДЛЯ КЛИКОВ --- */
textarea:disabled, 
input:disabled, 
button:disabled {
    pointer-events: none; /* Клик проходит сквозь элемент */
}

.input-wrapper {
    cursor: not-allowed; /* Показывать значок запрета при наведении */
    position: relative;  /* Чтобы ловить клики */
    z-index: 10;
}

/* === СТИЛИ ДЛЯ РЕЖИМА ТЕЛЕФОНА (КЛАСС .phone-mode) === */
.input-wrapper.phone-mode {
    border: none !important;
    background: transparent !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 0 !important;
    box-shadow: none !important; /* Убираем тени и пульсацию с общего блока */
    animation: none !important;
}

/* Жестко скрываем текстовое поле */
.input-wrapper.phone-mode textarea {
    display: none !important; 
}

/* Показываем поле телефона */
.input-wrapper.phone-mode .phone-input {
    display: block !important; 
    background: #fff !important;
    border: 2px solid var(--mfc-red) !important;
    border-radius: 4px !important;
    width: 100% !important;
    padding: 12px 15px !important;
    box-sizing: border-box !important;
}

/* === ИСПРАВЛЕНИЕ КНОПКИ (ДЕЛАЕМ ЕЁ ВИДИМОЙ) === */
.input-wrapper.phone-mode button.send-btn {
    background-color: var(--mfc-red) !important; /* Принудительно красный фон */
    color: white !important;                     /* Принудительно белый текст */
    width: 100% !important;
    height: auto !important;
    min-width: auto !important;
    padding: 12px 20px !important;
    border-radius: 4px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    font-size: 13px !important;
    margin-left: 0 !important;
    opacity: 1 !important;
    display: block !important;
    cursor: pointer !important;
    border: none !important;
}

.input-wrapper.phone-mode button.send-btn:hover:not(:disabled) {
    background-color: #a82e1f !important;
}

/* Скрываем иконку SVG, если она вдруг осталась */
.input-wrapper.phone-mode button.send-btn svg {
    display: none !important; 
}

/* === МОРГАНИЕ ТОЛЬКО ДЛЯ ПОЛЯ ВВОДА === */
/* Переносим пульсацию с общего блока на сам инпут */
.input-wrapper.phone-mode.highlight-input .phone-input {
    animation: attention-pulse 2s infinite;
    border-color: #ff6600 !important; /* Оранжевый акцент при моргании */
}

/* --- WIDGET: ОПЕРАТОРЫ НА ЛИНИИ --- */
.online-operators-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease-out;
}

.avatars-stack {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    padding-left: 15px; /* Компенсация отрицательного отступа */
}

.operator-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    
    /* --- НОВЫЕ СТИЛИ ДЛЯ ФОТО --- */
    background-size: cover; /* Масштабирует фото, чтобы заполнить круг */
    background-position: center top; /* Центрирует фото, чуть выше середины (лучше для лиц) */
    background-repeat: no-repeat;
    background-color: var(--mfc-beige); /* Цвет на случай, если фото не загрузится */
    /* --------------------------- */

    /* УБИРАЕМ СТИЛИ ТЕКСТА, ОНИ БОЛЬШЕ НЕ НУЖНЫ */
    /*
    color: var(--mfc-brown);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    */
    
    /* ОСТАВЛЯЕМ ПОЗИЦИОНИРОВАНИЕ И АНИМАЦИЮ */
    margin-left: -15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    animation: avatar-float 3s ease-in-out infinite;
}

/* Сдвиг анимации для каждого кружка, чтобы они двигались не синхронно */
.operator-avatar:nth-child(1) { animation-delay: 0s; z-index: 3; background-color: #e8e6e1; }
.operator-avatar:nth-child(2) { animation-delay: 0.5s; z-index: 2; background-color: #dedbd5; }
.operator-avatar:nth-child(3) { animation-delay: 1s; z-index: 1; background-color: #d4d1cb; }

/* Зеленая точка на последнем (верхнем) аватаре */
/* Зеленая точка для КАЖДОГО аватара */
.operator-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #4caf50; /* Зеленый цвет */
    border: 2px solid #fff;     /* Белая обводка, чтобы точка не сливалась с фото */
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    z-index: 10; /* Гарантируем, что точка будет поверх фото */
}

.online-text-badge {
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #4caf50;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes avatar-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    70% { box-shadow: 0 0 0 5px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* --- ПЛАВАЮЩИЙ ИНДИКАТОР ПЕЧАТИ --- */
.sticky-typing-indicator {
    position: absolute;
    bottom: 80px; /* Чуть выше поля ввода */
    left: 50%;
    transform: translateX(-50%) translateY(20px); /* Смещаем для анимации */
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px); /* Для Safari */
    border: 1px solid rgba(0,0,0,0.05);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
    border: 1px solid #eee;
    z-index: 100;
    
    /* Скрыто по умолчанию */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none; /* Чтобы сквозь него можно было кликнуть, если что */
}

/* Класс для показа */
.sticky-typing-indicator.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Анимация точек внутри плашки */
.typing-animation {
    display: flex;
    gap: 3px;
}

.typing-animation span {
    width: 4px;
    height: 4px;
    background-color: var(--mfc-brown); /* Твой фирменный цвет */
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-animation span:nth-child(1) { animation-delay: -0.32s; }
.typing-animation span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}