.chat-window {
    position: fixed;
    bottom: 70px;
    left: 20px;
    right: 240px;
    height: 60vh;
    background: rgba(255, 255, 255, 0.92); /* полупрозрачность */
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    z-index: 1;

    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;

    display: flex;
    flex-direction: column;
}

body.expanded .chat-window {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.expanded .chatbot-bar {
    border-top: 1px solid #ccc;
    border-radius: 0 0 10px 10px;
    background: #fff;
}

.chat-container {
    position: relative;
}

.chat-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background: transparent; /* полностью прозрачный фон */
    border: none;
    z-index: 2;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chat-close svg {
    width: 16px;
    height: 16px;
}

.chat-close:hover {
    background: rgba(0,0,0,0.08);
    transform: scale(1.1);
}

body.expanded .chat-close {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px 12px;
}

.bot-icon {
    z-index: 10 !important;
}

#chatMessages {
    display: flex;
    flex-direction: column;
}

.chat-message {
    margin: 6px 40px;
    padding: 10px 14px;
    border-radius: 8px;
    max-width: calc(100% - 80px);
    word-wrap: break-word;
    font-size: 20px;
    line-height: 1.4;
}

.chat-message.user {
    background: #e6f0ff;
    align-self: flex-start;
    padding: 15px 20px;
}

.chat-message.bot {
    background: #f1f1f1;
    align-self: flex-end;
    opacity: 0;
    transform: translateY(5px);
    animation: fadeIn 0.35s ease forwards;
    padding: 15px 20px;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-dots {
    display: inline-block;
    margin-left: 6px;
}

.loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #888;
    border-radius: 50%;
    animation: blink 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}