/* Стили виджета чата */
.chat-container {
    position: fixed;
    bottom: 0px;
    right: 0px;
    width: 350px;
    height: 527px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.result { line-height:1.4; margin-bottom:1rem; }
.chat-header {
    background: #02282c;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Предотвратить сжатие заголовка */
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    scroll-behavior: smooth; /* Плавная прокрутка */
    max-height: 400px; /* например, ограничим по высоте */
}


.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    margin-left: auto;
    background: #02282c;
    color: white;
    border-radius: 15px 15px 0 15px;
    padding: 10px 15px;
}

.bot-message {
    background: #e9ecef;
    border-radius: 15px 15px 15px 0;
    padding: 10px 15px;
}

.chat-input-container {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.typing-indicator {
    display: none;
    padding: 10px;
    background: #e9ecef;
    border-radius: 15px 15px 15px 0;
    width: 80px;
    margin: 0 15px 10px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
    animation: typing 1s infinite;
}

.typing-indicator span:nth-of-type(2) {
    animation: typing 1s infinite 0.2s;
}

.typing-indicator span:nth-of-type(3) {
    animation: typing 1s infinite 0.4s;
}

@keyframes typing {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

.chat-input {
    display: flex !important; /* Принудительно установить отображение как flex */
    padding: 10px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0; /* Предотвратить сжатие поля ввода */
    flex: 0 0 auto !important; /* Предотвратить сжатие поля ввода */
    min-height: 60px; /* Обеспечить минимальную высоту */
}

.chat-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    display: block !important; /* Принудительно установить отображение как block */
}

.chat-input button {
    background: #02282c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: block !important; /* Принудительно установить отображение как block */
    flex-shrink: 0;
}

.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #02282c;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 10001;
    transition: all 0.2s ease;
}

.chat-toggle:hover {
    background: #03363d;
    transform: scale(1.05);
}

.timestamp {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

/* Адаптивный дизайн */
@media (max-width: 576px) {
    .chat-container {
        width: calc(100% - 40px);
        height: 70vh;
        right: 0px;
        left: 0px;
        bottom: 0px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
}