﻿        * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        /* Кнопка чата */
        .chat-widget-btn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: all 0.3s ease;
            border: none;
        }

        .chat-widget-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
        }

        .chat-widget-btn svg {
            width: 28px;
            height: 28px;
            fill: white;
        }

        .chat-widget-btn .badge {
            position: absolute;
            top: -2px;
            right: -2px;
            background: #ff4757;
            color: white;
            font-size: 11px;
            padding: 2px 6px;
            border-radius: 10px;
            border: 2px solid white;
        }

        /* Модальное окно */
        .chat-widget-modal {
            position: fixed;
            bottom: 90px;
            right: 20px;
            width: 380px;
            height: 600px;
            max-height: calc(100vh - 100px);
            background: white;
            border-radius: 20px;
            box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
            z-index: 9998;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px) scale(0.95);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .chat-widget-modal.active {
            opacity: 1;
            visibility: visible;
            transform: translateY(0) scale(1);
        }

        /* Шапка */
        .chat-widget-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 16px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
        }

        .chat-widget-header-info h3 {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 2px;
        }

        .chat-widget-header-info p {
            font-size: 12px;
            opacity: 0.9;
        }

        .chat-widget-header-actions {
            display: flex;
            gap: 8px;
        }

        .chat-widget-btn-icon {
            background: rgba(255,255,255,0.2);
            border: none;
            color: white;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s;
        }

        .chat-widget-btn-icon:hover {
            background: rgba(255,255,255,0.3);
        }

        /* Сообщения */
        .chat-widget-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            background: #f8f9fa;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .chat-widget-message {
            display: flex;
            gap: 8px;
            max-width: 85%;
            animation: slideIn 0.3s ease-out;
        }

        @keyframes slideIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .chat-widget-message.user {
            align-self: flex-end;
            flex-direction: row-reverse;
        }

        .chat-widget-message-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: bold;
            flex-shrink: 0;
        }

        .chat-widget-message.bot .chat-widget-message-avatar {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .chat-widget-message.user .chat-widget-message-avatar {
            background: #4CAF50;
            color: white;
        }

        .chat-widget-message-bubble {
            padding: 10px 14px;
            border-radius: 16px;
            font-size: 14px;
            line-height: 1.5;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .chat-widget-message.bot .chat-widget-message-bubble {
            background: white;
            color: #333;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }

        .chat-widget-message.user .chat-widget-message-bubble {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-bottom-right-radius: 4px;
        }

        /* Быстрые кнопки */
        .chat-widget-quick {
            padding: 12px 16px;
            background: white;
            border-top: 1px solid #eee;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            flex-shrink: 0;
        }

        .chat-widget-quick-btn {
            padding: 6px 12px;
            background: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 16px;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .chat-widget-quick-btn:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        /* Ввод */
        .chat-widget-input-area {
            padding: 12px 16px;
            background: white;
            border-top: 1px solid #eee;
            display: flex;
            gap: 8px;
            align-items: center;
            flex-shrink: 0;
        }

        .chat-widget-input {
            flex: 1;
            padding: 10px 14px;
            border: 2px solid #e0e0e0;
            border-radius: 20px;
            font-size: 14px;
            outline: none;
            transition: border-color 0.3s;
        }

        .chat-widget-input:focus {
            border-color: #667eea;
        }

        .chat-widget-send {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s;
        }

        .chat-widget-send:hover {
            transform: scale(1.1);
        }

        .chat-widget-send:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .chat-widget-send svg {
            width: 18px;
            height: 18px;
            fill: white;
        }

        /* Индикатор печати */
        .chat-widget-typing {
            display: none;
            padding: 8px 14px;
            background: white;
            border-radius: 16px;
            border-bottom-left-radius: 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            width: fit-content;
        }

        .chat-widget-typing.active {
            display: flex;
            gap: 4px;
        }

        .chat-widget-typing-dot {
            width: 6px;
            height: 6px;
            background: #999;
            border-radius: 50%;
            animation: typing 1.4s infinite;
        }

        .chat-widget-typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .chat-widget-typing-dot:nth-child(3) { animation-delay: 0.4s; }

        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-8px); }
        }

        /* Пустое состояние */
        .chat-widget-empty {
            text-align: center;
            padding: 40px 20px;
            color: #999;
            font-size: 14px;
        }

        /* Адаптивность для мобильных */
        @media (max-width: 480px) {
            .chat-widget-modal {
                position: fixed;
                bottom: 0;
                right: 0;
                left: 0;
                width: 100%;
                height: 100%;
                max-height: 100vh;
                border-radius: 0;
            }

            .chat-widget-btn {
                bottom: 16px;
                right: 16px;
                width: 56px;
                height: 56px;
            }

            .chat-widget-btn svg {
                width: 24px;
                height: 24px;
            }

            .chat-widget-message {
                max-width: 90%;
            }
        }

        /* Скроллбар */
        .chat-widget-messages::-webkit-scrollbar {
            width: 6px;
        }

        .chat-widget-messages::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 3px;
        }

        .chat-widget-messages::-webkit-scrollbar-thumb:hover {
            background: #999;
        }



.chat-widget-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6; /* Увеличенный интервал для читаемости */
    white-space: pre-wrap; /* Сохраняет переносы строк из ответа */
    word-wrap: break-word;
}

/* Дополнительные стили для бота */
.chat-widget-message.bot .chat-widget-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Эмодзи чуть крупнее для наглядности */
.chat-widget-message-bubble emoji {
    font-size: 1.1em;
    vertical-align: middle;
}

/* Акцентные строки (цена, параметры) */
.chat-widget-message-bubble strong {
    color: #667eea;
    font-weight: 600;
}