/* Изолированные стили виджетов webchat/webcall для legacy tmpl. */
/* Общие стили для кнопок */
#city-widgets-root .fixed-btn {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition:
        transform 0.3s,
        background-color 0.3s;
    /* Запрет выделения текста и emoji на кнопках */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
}

#city-widgets-root .fixed-btn:hover {
    transform: scale(1.1);
}

/* Позиционирование кнопок */
#city-widgets-root #callback-button {
    right: 20px;
    background-color: #28a745;
}

#city-widgets-root #chat-toggle-btn {
    left: 20px;
    background-color: #4caf50;
}

#city-widgets-root #chat-toggle-btn:hover {
    background-color: #3d8b40;
}

/* Форма обратного звонка */
#city-widgets-root #callback-form {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    width: 220px;
    z-index: 9998;
}

#city-widgets-root #callback-form p {
    margin: 0 0 10px;
    font-size: 14px;
}

#city-widgets-root input,
#city-widgets-root button {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#city-widgets-root #callback-form input[type="tel"],
#city-widgets-root #callback-form button {
    box-sizing: border-box;
    width: 100%;
}

#city-widgets-root #submit-callback {
    background-color: #28a745;
    color: white;
    cursor: pointer;
}

#city-widgets-root #cancel-callback {
    background-color: #dc3545;
    color: white;
    cursor: pointer;
    margin-top: 5px;
}

/* Чат виджет */
#city-widgets-root .chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

#city-widgets-root .chat-container {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 350px;
    height: 450px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    /* Запрет выделения текста и элементов */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#city-widgets-root .chat-header {
    padding: 6px 10px 6px 10px;
    background-color: #4caf50;
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 38px;
    box-sizing: border-box;
    position: relative;
}

#city-widgets-root .chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    padding-right: 35px;
}

#city-widgets-root .close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.2s ease;
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    padding: 0;
    margin: 0;
    line-height: 1;
}

#city-widgets-root .close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: translateY(-50%) rotate(90deg);
}

#city-widgets-root .close-button:active {
    transform: translateY(-50%) rotate(90deg) scale(0.95);
}

/* Форма данных пользователя */
#city-widgets-root .user-info-form {
    padding: 20px;
    background-color: #f5f5f5;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#city-widgets-root .user-info-form p {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

#city-widgets-root .form-group {
    margin-bottom: 15px;
}

#city-widgets-root .form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

#city-widgets-root .form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

#city-widgets-root .chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

/* Сообщения клиента и оператора используют общие стили ниже */

/* Метка отправителя */
#city-widgets-root .message-sender {
    font-size: 11px;
    color: #666;
    margin-bottom: 3px;
    font-weight: bold;
}

/* Очистка потока больше не нужна - используем flex */

#city-widgets-root .message-text {
    word-break: break-word;
    line-height: 1.4;
}

#city-widgets-root .chat-footer {
    padding: 10px;
    border-top: 1px solid #eee;
}


#city-widgets-root .send-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #4caf50;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    /* Запрет выделения */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Уточняем позиционирование */
    margin: 0;
    z-index: 1;
}

#city-widgets-root .send-button:hover {
    background-color: #45a049;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

#city-widgets-root .send-button:active {
    transform: translateY(-50%) scale(0.95);
    background-color: #3d8b40;
}

/* Дополнительная корректировка для точного центрирования */
#city-widgets-root .send-button:not(:hover):not(:active) {
    transform: translateY(-50%);
}

#city-widgets-root .callback-hidden-field {
    display: none;
    position: absolute;
    left: -9999px;
}

/* Статус операторов в заголовке чата */
#city-widgets-root .operators-status {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    margin-left: 5px;
    max-width: 20px;
    overflow: hidden;
}

/* Компактный индикатор статуса - только зеленая точка */
#city-widgets-root .status-indicator {
    font-size: 10px;
    color: #4caf50;
    animation: city-widgets-status-pulse 2s infinite;
    display: inline-block;
    line-height: 1;
}

@keyframes city-widgets-status-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

#city-widgets-root .green-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #4caf50;
    margin-right: 0;
    display: none;
    animation: city-widgets-status-pulse 2s infinite;
}

#city-widgets-root .chat-message {
    margin-bottom: 15px;
    max-width: 80%;
    padding: 10px;
    border-radius: 10px;
}

#city-widgets-root .client {
    background-color: #ffe4c4;
    align-self: flex-end;
    margin-left: auto;
}

#city-widgets-root .operator {
    background-color: #e6e6fa;
    align-self: flex-start;
    margin-right: auto;
}

#city-widgets-root .quick-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
}

#city-widgets-root .quick-button {
    padding: 10px;
    border: 1px solid #3a7bec;
    border-radius: 20px;
    background-color: white;
    color: #3a7bec;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
}

#city-widgets-root .quick-button:hover {
    background-color: #f0f7ff;
}

#city-widgets-root .message-input-container {
    display: flex;
    position: relative;
    background-color: #fff;
    border-radius: 20px;
    border: 1px solid #ddd;
    padding: 8px 45px 8px 20px; /* увеличенный левый отступ для скругленных углов */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    align-items: center;
    min-height: 48px; /* минимальная высота контейнера */
}

#city-widgets-root #chat-message {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.3; /* уменьшаем для лучшего отображения */
    background: transparent;
    min-height: 32px; /* высота текстового поля */
    max-height: 120px; /* увеличенная максимальная высота для многострочного текста */
    padding: 4px 0 4px 3px; /* добавляем отступы + левый для скругленных углов */
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    vertical-align: middle;
    /* Стили для placeholder */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Дополнительные стили для placeholder */
#city-widgets-root #chat-message::placeholder {
    color: #999;
    font-weight: normal;
}

#city-widgets-root #chat-message::-webkit-input-placeholder {
    color: #999;
    font-weight: normal;
}

#city-widgets-root #chat-message::-moz-placeholder {
    color: #999;
    font-weight: normal;
    opacity: 1;
}

#city-widgets-root #chat-message:-ms-input-placeholder {
    color: #999;
    font-weight: normal;
}


#city-widgets-root .social-continuation {
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#city-widgets-root .continuation-header {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

/* Добавьте эти стили в раздел стилей социальных кнопок */
/* Стили для упрощенного блока мессенджеров */
#city-widgets-root .social-buttons {
    margin-top: 8px;
    padding: 6px 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-top: 1px solid #e9ecef;
    /* Горизонтальная компоновка в одну строку */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
}

#city-widgets-root .messenger-hint {
    font-size: 11px;
    color: #666;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
}

#city-widgets-root .simple-messengers {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

#city-widgets-root .messenger-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    /* Запрет выделения */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#city-widgets-root .messenger-mini img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    pointer-events: none;
}

#city-widgets-root .messenger-mini.telegram:hover {
    background-color: #0088cc;
    color: white;
}

#city-widgets-root .messenger-mini.whatsapp:hover {
    background-color: #25d366;
    color: white;
}

#city-widgets-root .messenger-mini.viber:hover {
    background-color: #7360f2;
    color: white;
}

/* Стили для блока мессенджеров */
/* Стили для блока мессенджеров */
#city-widgets-root .messenger-block {
    position: fixed;
    bottom: 20px;
    right: 90px; /* Размещаем слева от кнопки чата */
    z-index: 999;
    display: flex;
    flex-direction: row;
}

/* Мобильная компоновка чата и мессенджеров */
@media (max-width: 767px) {
    /* Для Android и других мобильных ОС оставляем старую логику */
    #city-widgets-root .messenger-block {
        position: fixed;
        bottom: 90px;
        right: 20px;
        z-index: 998;
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: auto;
    }

    #city-widgets-root .messenger-icons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #city-widgets-root .messenger-circle {
        width: 60px;
        height: 60px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    #city-widgets-root .messenger-circle img {
        width: 35px;
        height: 35px;
    }

    #city-widgets-root .chat-container {
        bottom: 90px;
        height: 70vh;
        max-height: 500px;
        width: 92%;
        left: 4%;
        right: 4%;
    }

    #city-widgets-root .chat-body {
        max-height: calc(70vh - 120px);
    }

    /* Для небольших планшетов и телефонов с экраном 481-600px */
    @media (max-width: 600px) and (min-width: 481px) {
        #city-widgets-root .chat-container {
            width: 95%;
            left: 2.5%;
            right: 2.5%;
            height: 75vh;
        }

        /* Для узких экранов в этом диапазоне - вертикальное расположение */
        @media (max-width: 520px) {
            #city-widgets-root .messenger-block {
                position: fixed;
                bottom: 90px; /* Кнопка callback занимает 60px + 10px отступ + 20px от края = 90px */
                right: 20px;
                left: auto;
                display: flex;
                flex-direction: column;
                gap: 10px; /* Равные расстояния между кнопками мессенджеров */
                align-items: flex-end;
            }

            #city-widgets-root .messenger-circle {
                width: 50px;
                height: 50px;
            }

            #city-widgets-root .messenger-circle img {
                width: 28px;
                height: 28px;
            }
        }

        /* Для более широких экранов в этом диапазоне - горизонтальное расположение */
        @media (min-width: 521px) {
            #city-widgets-root .messenger-block {
                position: fixed;
                bottom: 20px;
                right: 90px; /* Кнопка callback: 60px + 10px отступ + 20px от края = 90px */
                left: auto;
                display: flex;
                flex-direction: row;
                gap: 10px; /* Равные расстояния между кнопками мессенджеров */
            }
        }

        #city-widgets-root .messenger-icons {
            flex-direction: row;
            gap: 10px;
        }

        #city-widgets-root .messenger-circle {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
            z-index: 9999;
            transition: transform 0.3s, background-color 0.3s;
            cursor: pointer;
        }

        #city-widgets-root .messenger-circle:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
        }

        #city-widgets-root .messenger-circle img {
            width: 35px;
            height: 35px;
        }
    }
}

/* Стили, чтобы гарантировать отображение кнопки чата поверх всего */
#city-widgets-root .chat-button.fixed-btn {
    z-index: 1001 !important; /* Поверх мессенджеров */
}

/* Дополнительные стили для безопасного закрытия чата на мобильных устройствах */
@media (max-width: 767px) {
    #city-widgets-root .close-button {
        padding: 10px !important;
        font-size: 20px !important;
    }

    /* Убираем анимацию пульса для мобильных, если она вызывает проблемы с производительностью */
    #city-widgets-root .pulse-animation {
        animation: none !important;
    }
}

#city-widgets-root .messenger-icons {
    display: flex;
    gap: 10px;
}

#city-widgets-root .messenger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.2s;
}

#city-widgets-root .messenger-icon:hover {
    transform: scale(1.1);
}

#city-widgets-root .messenger-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    /* Запрет выделения иконок мессенджеров */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
}

#city-widgets-root .messenger-icon.telegram .messenger-circle {
    background-color: #0088cc;
}

#city-widgets-root .messenger-icon.whatsapp .messenger-circle {
    background-color: #25d366;
}

#city-widgets-root .messenger-icon.viber .messenger-circle {
    background-color: #7360f2;
}

#city-widgets-root .messenger-circle img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    /* Запрет выделения изображений мессенджеров */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    pointer-events: none;
}

#city-widgets-root .pulse-animation {
    animation: city-widgets-pulse 1.5s infinite;
}

@keyframes city-widgets-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
    #city-widgets-root .chat-container {
        width: 90%;
        height: 85vh;
        bottom: 0;
        left: 5%;
        right: 5%;
        border-radius: 10px 10px 0 0;
        /* Убираем белое оконтование на мобильных устройствах */
        border: none;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
        /* Запрет выделения для мобильных */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Дополнительные стили для iOS устройств */
    @supports (-webkit-touch-callout: none) {
        #city-widgets-root .chat-container {
            width: 85%;
            height: 80vh;
            left: 7.5%;
            right: 7.5%;
            bottom: 100px; /* Оставляем место для кнопок мессенджеров */
            /* Дополнительные стили для iOS чтобы убрать оконтование */
            border: none;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
            -webkit-box-shadow: none;
            box-shadow: none;
            /* Усиление запрета выделения для iOS */
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-touch-callout: none;
            -webkit-tap-highlight-color: transparent;
            -webkit-user-drag: none;
            -khtml-user-drag: none;
            -moz-user-drag: none;
            -o-user-drag: none;
        }

        /* Для очень узких экранов iOS (меньше 400px) - вертикальное расположение */
        @media (max-width: 400px) {
            #city-widgets-root .messenger-block {
                position: fixed;
                bottom: 90px; /* Кнопка callback занимает 60px + 10px отступ + 20px от края = 90px */
                right: 20px;
                left: auto;
                top: auto;
                z-index: 999;
                display: flex;
                flex-direction: column; /* Вертикально для узких экранов */
                gap: 10px; /* Равные расстояния между кнопками мессенджеров */
                width: auto;
                align-items: flex-end;
            }

            #city-widgets-root .messenger-circle {
                width: 50px;
                height: 50px;
            }

            #city-widgets-root .messenger-circle img {
                width: 28px;
                height: 28px;
            }
        }

        /* Для стандартных iOS экранов (401px - 480px) - горизонтальное расположение */
        @media (min-width: 401px) and (max-width: 480px) {
            #city-widgets-root .messenger-block {
                position: fixed;
                bottom: 20px;
                right: 90px; /* Кнопка callback: 60px + 10px отступ + 20px от края = 90px */
                left: auto;
                top: auto;
                z-index: 999;
                display: flex;
                flex-direction: row;
                gap: 10px; /* Равные расстояния между кнопками мессенджеров */
                width: auto;
            }
        }

        /* Перемещаем кнопки мессенджеров под чат для iOS (базовые стили) */
        #city-widgets-root .messenger-block {
            position: fixed;
            bottom: 20px;
            right: 90px; /* Кнопка callback: 60px + 10px отступ + 20px от края = 90px */
            left: auto;
            top: auto;
            z-index: 999;
            display: flex;
            flex-direction: row;
            gap: 10px; /* Равные расстояния между кнопками мессенджеров */
            width: auto;
        }

        #city-widgets-root .messenger-icons {
            display: flex;
            flex-direction: row;
            gap: 10px;
            align-items: center;
        }

        #city-widgets-root .messenger-circle {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
            z-index: 9999;
            transition: transform 0.3s, background-color 0.3s;
            cursor: pointer;
        }

        #city-widgets-root .messenger-circle:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
        }

        #city-widgets-root .messenger-circle img {
            width: 35px;
            height: 35px;
        }
    }

    #city-widgets-root #callback-form {
        width: 90%;
        max-width: 260px;
        right: 10px;
    }

    /* Мобильная адаптация блока социальных кнопок */
    #city-widgets-root .social-buttons {
        margin-top: 6px;
        padding: 5px 8px;
        gap: 8px;
    }

    #city-widgets-root .messenger-hint {
        font-size: 10px;
    }

    #city-widgets-root .simple-messengers {
        gap: 4px;
    }

    #city-widgets-root .messenger-mini {
        width: 20px;
        height: 20px;
    }

    #city-widgets-root .messenger-mini img {
        width: 12px;
        height: 12px;
    }

    /* Дополнительные стили для iOS устройств */
    @supports (-webkit-touch-callout: none) {
        #city-widgets-root .social-buttons {
            background-color: rgba(248, 249, 250, 0.9);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }

        #city-widgets-root .messenger-mini {
            background-color: rgba(255, 255, 255, 0.9);
            -webkit-backdrop-filter: blur(5px);
        }

        #city-widgets-root .messenger-mini:active {
            transform: scale(0.95);
        }

        /* Мобильные стили для кнопки отправки */
        #city-widgets-root .send-button {
            width: 32px;
            height: 32px;
            right: 6px;
            font-size: 14px;
        }

        #city-widgets-root .message-input-container {
            padding: 6px 38px 6px 18px;
            min-height: 44px; /* минимальная высота для touch */
        }

        #city-widgets-root #chat-message {
            min-height: 32px;
            font-size: 16px; /* увеличение для читаемости на мобильных */
            line-height: 1.3; /* корректируем line-height */
            padding: 4px 0 4px 2px; /* добавляем небольшие отступы + левый для скругленных углов */
            vertical-align: middle;
        }
    }
}

#city-widgets-root .typing-indicator {
    padding: 10px;
}

#city-widgets-root .typing-dots {
    display: flex;
    align-items: center;
    height: 20px;
}

#city-widgets-root .typing-dots span {
    height: 10px;
    width: 10px;
    margin: 0 1px;
    background-color: #9e9ea1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

#city-widgets-root .typing-dots span:nth-child(1) {
    animation: city-widgets-typing 1s infinite;
}

#city-widgets-root .typing-dots span:nth-child(2) {
    animation: city-widgets-typing 1s infinite 0.2s;
}

#city-widgets-root .typing-dots span:nth-child(3) {
    animation: city-widgets-typing 1s infinite 0.4s;
}

@keyframes city-widgets-typing {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.4;
        transform: scale(1);
    }
}

/* Улучшения для формы пользователя */
#city-widgets-root .user-info-form {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#city-widgets-root .user-info-form p {
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

#city-widgets-root .form-group {
    margin-bottom: 12px;
}

#city-widgets-root .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

#city-widgets-root .form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

#city-widgets-root .form-group input:focus {
    border-color: #3a7bec;
    outline: none;
}

#city-widgets-root .start-chat-button {
    width: 100%;
    padding: 10px;
    background-color: #3a7bec;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    margin-top: 10px;
}

#city-widgets-root .start-chat-button:hover {
    background-color: #2a6bdc;
}

/* Исправленные стили для сообщений чата */
#city-widgets-root .chat-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px; /* Уменьшаем отступ между сообщениями */
    max-width: 75%; /* Увеличиваем максимальную ширину */
    padding: 8px 12px; /* Компактные отступы */
    border-radius: 18px; /* Скругляем как в мессенджерах */
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
}

#city-widgets-root .chat-message.client {
    background-color: #007bff; /* Синий фон как в WhatsApp */
    color: white; /* Белый текст для контраста */
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px; /* Хвостик сообщения */
}

#city-widgets-root .chat-message.operator {
    background-color: #f1f1f1; /* Светло-серый фон */
    color: #333; /* Темный текст */
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 4px; /* Хвостик сообщения */
}

#city-widgets-root .message-sender {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 5px;
    color: #555;
}

#city-widgets-root .chat-message.client .message-sender {
    color: #1565c0; /* Синий для клиента */
}

#city-widgets-root .chat-message.operator .message-sender {
    color: #4caf50; /* Зеленый для оператора */
}

#city-widgets-root .message-text {
    word-break: break-word;
    line-height: 1.3; /* Уменьшаем межстрочный интервал */
    margin: 0; /* Убираем лишние отступы */
    font-size: 14px; /* Читаемый размер шрифта */
}

#city-widgets-root .chat-message.client .message-text {
    color: white; /* Белый текст для сообщений клиента */
}

#city-widgets-root .message-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 4px; /* Компактный отступ */
    opacity: 0.8;
}

#city-widgets-root .chat-message.client .message-time {
    color: rgba(255, 255, 255, 0.8); /* Полупрозрачный белый для времени клиента */
}

/* Стили для проактивного попапа - единое определение */
#city-widgets-root .proactive-popup {
    position: fixed;
    bottom: 90px;
    left: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    max-width: 280px;
    width: 280px;
    padding: 14px 40px 14px 14px;
    cursor: pointer;
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#city-widgets-root .proactive-popup.notification-show {
    transform: translateY(0);
    opacity: 1;
}

#city-widgets-root .proactive-popup-content {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    font-family: Arial, sans-serif, Arial, sans-serif;
}

/* Улучшенный крестик - больше и заметнее */
#city-widgets-root .proactive-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#city-widgets-root .proactive-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: rotate(90deg);
}

#city-widgets-root .proactive-popup-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Градиент для привлечения внимания */
#city-widgets-root .proactive-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #4CAF50, #45a049);
}

/* Стили для пуш-уведомлений и чата */
#city-widgets-root #chat-toggle-btn.has-unread {
    /* Применяем position: relative к самой кнопке, когда есть класс */
    position: relative; /* Убедитесь, что у кнопки есть относительное позиционирование */
}

#city-widgets-root #chat-toggle-btn.has-unread::after {
    /* Стиль для точки применяется к псевдоэлементу кнопки с классом */
    content: "";
    position: absolute;
    top: 5px; /* Положение точки (можно настроить) */
    right: 5px; /* Положение точки (можно настроить) */
    width: 12px; /* Размер точки */
    height: 12px; /* Размер точки */
    background-color: red;
    border-radius: 50%;
    border: 2px solid white; /* Белая обводка для контраста */
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
    animation: city-widgets-pulse-dot 1.5s infinite;
    z-index: 1; /* Чтобы точка была поверх иконки кнопки */
}

@keyframes city-widgets-pulse-dot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

/* Стили для пуш-уведомлений - компактные и предсказуемые */
#city-widgets-root .push-notification {
    position: fixed;
    bottom: 90px;
    left: 20px;
    background: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-width: 280px;
    width: 280px;
    padding: 14px 40px 14px 14px;
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#city-widgets-root .push-notification.notification-show {
    transform: translateY(0);
    opacity: 1;
}

/* Градиент слева для визуального выделения */
#city-widgets-root .push-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #2196F3, #1976D2);
}

#city-widgets-root .push-notification-content {
    padding-right: 0;
    font-family: Arial, sans-serif, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
}

/* Кнопка закрытия пуша - улучшенная */
#city-widgets-root .push-notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#city-widgets-root .push-notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: rotate(90deg);
}

#city-widgets-root .push-notification-close:active {
    transform: rotate(90deg) scale(0.95);
}

@media (max-width: 767px) {
    /* Мобильная верстка - более компактно */
    #city-widgets-root .push-notification,
#city-widgets-root .proactive-popup {
        left: 20px;
        right: 20px;
        max-width: none;
        width: auto;
    }
}

/* Анимация скрытия для уведомлений */
#city-widgets-root .notification-hide {
    opacity: 0;
    transform: translateY(20px);
}

#city-widgets-root .typing-indicator {
    padding: 10px;
}

#city-widgets-root .typing-dots {
    display: flex;
    align-items: center;
    height: 20px;
}

#city-widgets-root .typing-dots span {
    height: 10px;
    width: 10px;
    margin: 0 1px;
    background-color: #9e9ea1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

#city-widgets-root .typing-dots span:nth-child(1) {
    animation: city-widgets-typing 1s infinite;
}

#city-widgets-root .typing-dots span:nth-child(2) {
    animation: city-widgets-typing 1s infinite 0.2s;
}

#city-widgets-root .typing-dots span:nth-child(3) {
    animation: city-widgets-typing 1s infinite 0.4s;
}

@keyframes city-widgets-typing {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.4;
        transform: scale(1);
    }
}

#city-widgets-root .hide-notification {
    opacity: 0;
    transform: translateY(20px);
}

#city-widgets-root .chat-notification {
    padding: 10px 15px;
    margin: 5px auto;
    border-radius: 10px;
    max-width: 80%;
    text-align: center;
    animation: city-widgets-fade-in 0.3s;
    transition: opacity 0.5s;
}

#city-widgets-root .chat-notification.info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #0d47a1;
}

#city-widgets-root .chat-notification.error {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
    color: #b71c1c;
}

#city-widgets-root .chat-notification.fade-out {
    opacity: 0;
}

@keyframes city-widgets-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Основные классы отображения */
#city-widgets-root .flex {
    display: flex !important;
}

#city-widgets-root .hidden {
    display: none !important;
}

#city-widgets-root .block {
    display: block !important;
}

/* Классы для мессенджеров */
#city-widgets-root .messenger-mobile {
    position: fixed !important;
    bottom: 80px !important;
    right: 20px !important;
    z-index: 998 !important;
    flex-direction: column !important;
    gap: 10px !important;
}

#city-widgets-root .messenger-desktop {
    position: fixed !important;
    bottom: 20px !important;
    right: 90px !important;
    z-index: 998 !important;
}

/* Классы для чата и кнопок */
#city-widgets-root .chat-fixed {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999 !important;
}

body.chat-open-body {
    overflow: hidden !important;
}

/* Класс для индикатора непрочитанных сообщений */
#city-widgets-root .has-unread::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background-color: red;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
    animation: city-widgets-pulse-dot 1.5s infinite;
    z-index: 1;
}

/* Мобильные настройки для чата */
#city-widgets-root .chat-mobile {
    position: fixed !important;
    width: 100% !important;
    height: 65vh !important;
    max-height: 480px !important;
    bottom: 90px !important;
    right: 0 !important;
    left: 0 !important;
    border-radius: 0 !important;
    margin: 0 auto !important;
    z-index: 998 !important;
}

#city-widgets-root .chat-messages-mobile {
    max-height: calc(65vh - 120px) !important;
}
