/* === Кнопка чата === */
.chat-fab {
    position: fixed;
    right: 25px;
    bottom: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2c5aa0;
    color: #ffffff;
    font-size: 26px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: transform 0.2s, background 0.2s;
}

.chat-fab:hover {
    transform: scale(1.07);
    background: #1a4d8f;
}

/* === Окно чата === */
.chat-window {
    position: fixed;
    right: 25px;
    bottom: 100px;
    width: 340px;
    max-width: calc(100vw - 30px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
}

.chat-window.open {
    display: flex;
}

.chat-header {
    background: #2c5aa0;
    color: #ffffff;
    padding: 12px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

/* === Сообщения === */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f0f5fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.chat-bubble.bot {
    background: #ffffff;
    border: 1px solid #dce7f5;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: #2c5aa0;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble.status-ok {
    background: #e8f7ee;
    border: 1px solid #27ae60;
    color: #1e7e46;
    align-self: flex-start;
}

.chat-bubble.status-err {
    background: #fdecea;
    border: 1px solid #d32f2f;
    color: #a02222;
    align-self: flex-start;
}

/* === Форма ввода === */
.chat-form {
    border-top: 1px solid #e0e0e0;
    padding: 10px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-form input,
.chat-form textarea {
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    resize: none;
    box-sizing: border-box;
    width: 100%;
}

.chat-form input:focus,
.chat-form textarea:focus {
    border-color: #2c5aa0;
}

.chat-send-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-send {
    flex-shrink: 0;
    background: #27ae60;
    border: none;
    color: #ffffff;
    border-radius: 6px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.chat-send:hover {
    background: #219150;
}

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}