/* ═══════════════════════════════════════════════════════════════════
   Fisalis AI Assistant — стили виджета чата
   ═══════════════════════════════════════════════════════════════════ */

/* ── Кнопка-триггер ─────────────────────────────────────────────── */
.fisalis-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--fisalis-color, #f5a623);
    box-shadow: 0 4px 20px rgba(0,0,0,.28);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    transition: transform .2s, box-shadow .2s;
}
.fisalis-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,.35);
}
.fisalis-chat-btn svg {
    width: 32px;
    height: 32px;
    fill: #fff;
    display: block;
}

/* Бейдж-точка уведомления */
.fisalis-chat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #e53935;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: fisalisBadgePop .3s ease-out;
}
@keyframes fisalisBadgePop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* Пульсирующий ореол */
.fisalis-chat-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid rgba(245,166,35,.5);
    animation: fisalisPulse 2.5s ease-out infinite;
}
@keyframes fisalisPulse {
    0%   { transform: scale(1); opacity: .7; }
    70%  { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

/* ── Модал чата ─────────────────────────────────────────────────── */
.fisalis-chat-modal {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    transition: opacity .22s, transform .22s;
    transform-origin: bottom right;
}
.fisalis-chat-modal.fisalis-v-closed {
    opacity: 0;
    pointer-events: none;
    transform: scale(.92) translateY(12px);
}

/* ── Шапка ──────────────────────────────────────────────────────── */
.fisalis-chat-header {
    background: var(--fisalis-color, #f5a623);
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.fisalis-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.fisalis-chat-avatar svg { width: 22px; height: 22px; fill: #fff; }
.fisalis-chat-avatar--photo { background: none; }
.fisalis-chat-avatar--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fisalis-chat-info { flex: 1; min-width: 0; }
.fisalis-chat-info strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.fisalis-chat-info span {
    font-size: 12px;
    color: rgba(255,255,255,.88);
    display: flex;
    align-items: center;
    gap: 5px;
}
.fisalis-chat-info span::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: fisalisOnlinePulse 2s ease-out infinite;
    flex-shrink: 0;
}
@keyframes fisalisOnlinePulse {
    0%   { transform: scale(1); opacity: 1; }
    60%  { transform: scale(2); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}
.fisalis-chat-mute {
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    padding: 3px 5px;
    flex-shrink: 0;
    opacity: .85;
    transition: opacity .15s;
}
.fisalis-chat-mute:hover { opacity: 1; }
.fisalis-chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.85);
    font-size: 24px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color .15s;
}
.fisalis-chat-close:hover { color: #fff; }

/* ── Область сообщений ──────────────────────────────────────────── */
.fisalis-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f6f6f6;
    scroll-behavior: smooth;
}
.fisalis-chat-messages::-webkit-scrollbar { width: 4px; }
.fisalis-chat-messages::-webkit-scrollbar-track { background: transparent; }
.fisalis-chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ── Пузыри сообщений ───────────────────────────────────────────── */
.fisalis-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}
.fisalis-msg--bot {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.fisalis-msg--user {
    align-self: flex-end;
    background: var(--fisalis-color, #f5a623);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.fisalis-msg--bot ul,
.fisalis-msg--bot ol { margin: 6px 0 6px 18px; padding: 0; }
.fisalis-msg--bot li { margin: 4px 0; }
.fisalis-msg--bot br { display: block; margin-top: 3px; }
.fisalis-msg--bot ul.fisalis-emoji-list { list-style: none; margin-left: 4px; }
.fisalis-msg--bot ul.fisalis-emoji-list li { display: flex; align-items: baseline; gap: 6px; margin: 5px 0; }
.fisalis-emoji-bullet { flex-shrink: 0; font-size: 15px; }
.fisalis-msg--bot strong { font-weight: 700; }
.fisalis-msg--bot em { font-style: italic; }
.fisalis-msg--bot code {
    background: #f0f0f0;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 12px;
    font-family: monospace;
}

/* ── Индикатор печатания ────────────────────────────────────────── */
.fisalis-typing {
    display: flex;
    gap: 5px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.fisalis-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    animation: fisalisBounce 1.2s infinite ease-in-out;
}
.fisalis-typing span:nth-child(2) { animation-delay: .18s; }
.fisalis-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes fisalisBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); background: var(--fisalis-color, #f5a623); }
}

/* ── Поле ввода ─────────────────────────────────────────────────── */
.fisalis-chat-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #ebebeb;
    background: #fff;
    flex-shrink: 0;
}
.fisalis-chat-input {
    flex: 1;
    border: 1.5px solid #e2e2e2;
    border-radius: 24px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    background: #fafafa;
}
.fisalis-chat-input:focus {
    border-color: var(--fisalis-color, #f5a623);
    background: #fff;
}
.fisalis-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--fisalis-color, #f5a623);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .15s;
}
.fisalis-chat-send:hover { opacity: .88; transform: scale(1.06); }
.fisalis-chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* ── Кнопка микрофона ───────────────────────────────────────────── */
.fisalis-chat-mic {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: none;
    border: 1.5px solid #e2e2e2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #aaa;
    transition: color .15s, border-color .15s;
    padding: 0;
}
.fisalis-chat-mic:hover { color: var(--fisalis-color, #f5a623); border-color: var(--fisalis-color, #f5a623); }
.fisalis-chat-mic.fisalis-mic-active {
    background: #fee;
    border-color: #e53935;
    color: #e53935;
    animation: fisalisMicPulse 1s ease-in-out infinite;
}
.fisalis-chat-mic svg { width: 18px; height: 18px; }
.fisalis-chat-mic.fisalis-mic-hidden { display: none; }
@keyframes fisalisMicPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,.4); }
    50%       { box-shadow: 0 0 0 6px rgba(229,57,53,0); }
}

/* ── Строка транскрипта ─────────────────────────────────────────── */
.fisalis-transcript-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px dashed var(--fisalis-color, #f5a623);
    border-radius: 12px;
    padding: 8px 10px;
    margin-top: 4px;
}
.fisalis-transcript-bar span { font-size: 16px; flex-shrink: 0; }
.fisalis-transcript-bar input {
    flex: 1;
    border: 1px solid #e2e2e2;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
    min-width: 0;
}
.fisalis-transcript-bar input:focus { border-color: var(--fisalis-color, #f5a623); }
.fisalis-transcript-bar button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--fisalis-color, #f5a623);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity .15s;
}
.fisalis-transcript-bar button:hover { opacity: .85; }
.fisalis-transcript-bar button:disabled { opacity: .6; cursor: default; }

/* ── Дисклеймер ─────────────────────────────────────────────────── */
.fisalis-chat-disclaimer {
    text-align: center;
    font-size: 10px;
    color: #aaa;
    padding: 5px 12px 7px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    line-height: 1.4;
}
.fisalis-chat-disclaimer a { color: #aaa; text-decoration: underline; }
.fisalis-chat-disclaimer a:hover { color: #666; }

/* ── Мобильная адаптация ────────────────────────────────────────── */
@media (max-width: 480px) {
    .fisalis-chat-btn { bottom: 18px; right: 18px; width: 52px; height: 52px; }
    .fisalis-chat-btn svg { width: 26px; height: 26px; }
    .fisalis-chat-modal { left: 10px; right: 10px; width: auto; bottom: 82px; height: 70svh; }
}

/* WhatsApp CTA button */
.fisalis-wa-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px 4px;
    padding: 11px 16px;
    background: #25d366;
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.fisalis-wa-cta:hover { background: #1ebe5a; color: #fff; }
.fisalis-wa-cta svg { flex-shrink: 0; }
