/* === CHAT.CSS ===
   assets/css/chat.css
   НАЗНАЧЕНИЕ: Стили виджета AI чата (плавающая кнопка + popup)
   РАЗМЕР: ~130 строк */

/* -- Floating button -- */
.mkt-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: transform 0.2s var(--ease-out-quart, ease), box-shadow 0.2s;
}
.mkt-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
.mkt-chat-fab svg { width: 24px; height: 24px; }

/* -- Chat popup -- */
.mkt-chat-popup {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    z-index: 1001;
    display: none;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    overflow: hidden;
}
.mkt-chat-popup.open { display: flex; }

/* -- Header -- */
.mkt-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.mkt-chat-head-title { font-weight: 600; font-size: 14px; color: var(--text-primary); flex: 1; }
.mkt-chat-close {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 4px; border-radius: 6px;
}
.mkt-chat-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* -- Messages area -- */
.mkt-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    max-height: 350px;
}

/* -- Bubbles -- */
.mkt-chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}
.mkt-chat-msg.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mkt-chat-msg.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.mkt-chat-msg.error {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* -- Typing indicator -- */
.mkt-chat-typing {
    display: flex; gap: 4px; padding: 8px 12px; align-self: flex-start;
}
.mkt-chat-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted); opacity: 0.5;
    animation: mkt-dot-pulse 1.2s infinite;
}
.mkt-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mkt-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mkt-dot-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* -- Input area -- */
.mkt-chat-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.mkt-chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
}
.mkt-chat-input:focus { border-color: var(--color-primary); }
.mkt-chat-send, .mkt-chat-mic {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 6px; border-radius: 6px; display: flex; align-items: center;
}
.mkt-chat-send:hover, .mkt-chat-mic:hover { color: var(--color-primary); background: var(--bg-tertiary); }
.mkt-chat-mic.recording { color: var(--color-danger); }

/* -- Responsive -- */
@media (max-width: 480px) {
    .mkt-chat-popup { width: calc(100vw - 16px); right: 8px; bottom: 80px; max-height: 70vh; }
    .mkt-chat-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    .mkt-chat-typing span { animation: none; opacity: 0.6; }
    .mkt-chat-fab { transition: none; }
}
