/* ============================================================
   БИНЭКСТ — чат-виджет для основного сайта
   ============================================================ */

/* ---------- контейнер ---------- */
#bnx-ai-chat {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- плавающая кнопка ---------- */
.bnx-chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0066cc;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 99999;
}

.bnx-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.6);
}

.bnx-chat-fab svg {
    fill: #fff;
}

/* ---------- окно чата ---------- */
.bnx-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 100000;
}

.bnx-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---------- заголовок ---------- */
.bnx-chat-header {
    background: #0066cc;
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px 12px 0 0;
}

.bnx-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.bnx-chat-header-info {
    flex: 1;
}

.bnx-chat-title {
    font-weight: 600;
    font-size: 16px;
}

.bnx-chat-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.bnx-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.bnx-chat-close:hover {
    opacity: 1;
}

/* ---------- сообщения ---------- */
.bnx-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bnx-chat-message {
    display: flex;
    gap: 8px;
}

.bnx-chat-message.bnx-ai {
    align-items: flex-start;
}

.bnx-chat-message.bnx-user {
    align-items: flex-start;
    justify-content: flex-end;
}

.bnx-chat-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.bnx-chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.bnx-chat-message.bnx-ai .bnx-chat-bubble {
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.bnx-chat-message.bnx-user .bnx-chat-bubble {
    background: #0066cc;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ---------- подсказки ---------- */
.bnx-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.bnx-chat-suggestion {
    background: #f0f8ff;
    border: 1px solid #0066cc;
    color: #0066cc;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.bnx-chat-suggestion:hover {
    background: #0066cc;
    color: #fff;
}

/* ---------- индикатор набора ---------- */
.bnx-chat-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 0 16px 8px;
}

.bnx-chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 16px;
}

.bnx-chat-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: bnx-typing 1.4s infinite;
}

.bnx-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.bnx-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bnx-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* ---------- поле ввода ---------- */
.bnx-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.bnx-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

.bnx-chat-input:focus {
    outline: none;
    border-color: #0066cc;
}

.bnx-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0066cc;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

.bnx-chat-send:hover {
    background: #0052a3;
}

/* ---------- адаптив ---------- */
@media (max-width: 480px) {
    .bnx-chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 80px;
        right: 20px;
    }
    
    .bnx-chat-fab {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 360px) {
    .bnx-chat-window {
        width: calc(100vw - 20px);
        right: 10px;
    }
}