/* AI Chat Widget Styles */
#ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ─── Пузырь ─────────────────────────────────────────────── */
.ai-chat-bubble {
    width: 60px;
    height: 60px;
    background: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    color: #fff;
}
.ai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.ai-chat-bubble.ai-chat-hidden {
    display: none;
}

/* ─── Окно чата ──────────────────────────────────────────── */
.ai-chat-window {
    display: none;
    flex-direction: column;
    width: 380px;
    height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    position: absolute;
    bottom: 0;
    right: 0;
}
.ai-chat-window.ai-chat-open {
    display: flex;
}

/* ─── Шапка ──────────────────────────────────────────────── */
.ai-chat-header {
    background: #000;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ai-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.ai-chat-title {
    font-weight: 600;
    font-size: 15px;
}
.ai-chat-status {
    font-size: 12px;
    opacity: 0.7;
}
.ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.ai-chat-close:hover {
    opacity: 1;
}

/* ─── Сообщения ──────────────────────────────────────────── */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f8f8;
}
.ai-chat-message {
    display: flex;
}
.ai-chat-bot {
    justify-content: flex-start;
}
.ai-chat-user {
    justify-content: flex-end;
}
.ai-chat-bubble-text {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.ai-chat-bot .ai-chat-bubble-text {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ai-chat-user .ai-chat-bubble-text {
    background: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ─── Typing indicator ───────────────────────────────────── */
.ai-chat-typing .ai-chat-bubble-text {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}
.ai-chat-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: aiChatBounce 1.4s infinite ease-in-out;
}
.ai-chat-dot:nth-child(1) { animation-delay: 0s; }
.ai-chat-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiChatBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ─── Быстрые кнопки ─────────────────────────────────────── */
.ai-chat-quick-actions {
    padding: 8px 18px 10px;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}
.ai-chat-quick-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.ai-chat-quick-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

/* ─── Ссылки на мессенджеры ──────────────────────────────── */
.ai-chat-links {
    padding: 0 18px 10px;
    display: flex;
    gap: 12px;
    background: #fff;
    flex-shrink: 0;
}
.ai-chat-link {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}
.ai-chat-link:hover {
    color: #000;
}

/* ─── Поле ввода ─────────────────────────────────────────── */
.ai-chat-input-area {
    padding: 12px 18px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.ai-chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ai-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.ai-chat-input:focus {
    border-color: #000;
}
.ai-chat-send {
    width: 40px;
    height: 40px;
    border: none;
    background: #000;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
.ai-chat-send:hover {
    background: #333;
}

/* ─── Адаптив ────────────────────────────────────────────── */
@media (max-width: 480px) {
    #ai-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    .ai-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        max-height: 600px;
    }
}
