/* Chat assistant panel (chatbot.js), public pages and the client portal */
.lf-chat { position: fixed; right: 24px; bottom: 100px; z-index: 9999; width: min(380px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 140px)); height: min(600px, calc(100dvh - 140px)); display: none; flex-direction: column; overflow: hidden;
    background: var(--bg-card, #0f172a); color: var(--text-main, #e2e8f0); border: 1px solid var(--border-glass, rgba(148,163,184,.25));
    border-radius: 18px; box-shadow: 0 24px 60px rgba(2, 6, 23, .35); font-size: 14px; }
.lf-chat.open { display: flex; animation: lfChatIn .18s ease-out; }
@keyframes lfChatIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lf-chat.open { animation: none; } }

.lf-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
    background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; }
.lf-chat-avatar { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800;
    font-size: 13px; background: rgba(255,255,255,.18); }
.lf-chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lf-chat-title strong { font-size: 14.5px; }
.lf-chat-title small { font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lf-chat-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; margin-right: 6px; vertical-align: middle; }
.lf-chat-human { flex: none; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px;
    padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lf-chat-human:hover { background: rgba(255,255,255,.22); }
.lf-chat-x { flex: none; background: none; border: 0; color: #fff; font-size: 16px; cursor: pointer; padding: 4px 6px; opacity: .85; }

.lf-chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.lf-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.lf-msg-user { align-self: flex-end; background: #2563eb; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.lf-msg-bot { align-self: flex-start; background: var(--bg-alt, rgba(148,163,184,.12)); border-bottom-left-radius: 4px; }
.lf-msg-acts, .lf-msg-related { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lf-act { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 600;
    text-decoration: none; cursor: pointer; color: var(--color-accent, #3b82f6); background: transparent; border: 1px solid currentColor; }
.lf-act:hover { background: rgba(59,130,246,.1); }
.lf-act-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.lf-act-primary:hover { background: #1d4ed8; }
.lf-typing { display: flex; gap: 4px; padding: 12px 14px; }
.lf-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted, #94a3b8); animation: lfDot 1s infinite ease-in-out; }
.lf-typing span:nth-child(2) { animation-delay: .15s; } .lf-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lfDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.lf-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.lf-chat-chips:empty { display: none; }
.lf-chip { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer; color: var(--text-main, inherit);
    background: var(--bg-alt, rgba(148,163,184,.1)); border: 1px solid var(--border-glass, rgba(148,163,184,.3)); text-align: left; }
.lf-chip:hover { border-color: var(--color-accent, #3b82f6); }

.lf-chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border-glass, rgba(148,163,184,.2)); }
.lf-chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 110px; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 14px;
    color: var(--text-main, inherit); background: var(--bg-alt, rgba(148,163,184,.08)); border: 1px solid var(--border-glass, rgba(148,163,184,.3)); }
.lf-chat-form textarea:focus { outline: 2px solid rgba(37,99,235,.45); border-color: transparent; }
.lf-chat-send { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 0; cursor: pointer; background: #2563eb; color: #fff; font-size: 15px; }
.lf-chat-send:hover { background: #1d4ed8; }
.lf-chat-foot { margin: 0; padding: 0 12px 10px; font-size: 10.5px; color: var(--text-dim, var(--text-muted)); text-align: center; }
.lf-chat-sr, .lf-chat-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.lf-lead, .lf-channels { align-self: stretch; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px;
    border: 1px solid rgba(37,99,235,.35); background: rgba(37,99,235,.06); }
.lf-lead p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.lf-lead .form-input { width: 100%; }
.lf-lead-err { color: var(--color-danger, #ef4444) !important; }
.lf-lead-err:empty { display: none; }
.lf-channel { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: 12px; font: inherit; font-weight: 600; text-align: left;
    text-decoration: none; cursor: pointer; color: var(--text-main, inherit); background: var(--bg-card, transparent); border: 1px solid var(--border-glass, rgba(148,163,184,.3)); }
.lf-channel small { font-weight: 400; font-size: 11.5px; color: var(--text-muted); }
.lf-channel:hover { border-color: var(--color-accent, #3b82f6); }
.lf-channel-whatsapp { border-left: 4px solid #25D366; } .lf-channel-telegram { border-left: 4px solid #229ED9; }
.lf-channel-chat { border-left: 4px solid #1d4ed8; } .lf-channel-form { border-left: 4px solid #64748b; }

.lf-sponsored { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none;
    color: var(--text-main, inherit); border: 1px dashed var(--border-glass, rgba(148,163,184,.4)); }
.lf-sponsored-tag { display: inline-block; align-self: flex-start; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px;
    font-size: 10.5px; font-weight: 700; line-height: 15px; color: var(--text-muted); }
.lf-sponsored small { color: var(--text-muted); font-size: 12px; }

html[data-theme="light"] .lf-chat { background: #fff; color: #0f172a; }
@media (max-width: 520px) {
    /* Pinned to the visible screen's top and bottom: 100vh ignores the phone's address bar, so a
       bottom-anchored 100vh panel pushed its header under the bar */
    .lf-chat { right: 8px; left: 8px; top: max(8px, env(safe-area-inset-top)); bottom: 84px; width: auto; height: auto; border-radius: 16px; }
    .lf-chat-title small { display: none; }
}

/* Client portal: dropped down under the top bar's Ask button (chatbot.js sets top, right and height) */
.lf-chat.lf-chat-docked { bottom: auto; transform-origin: top right; }
.lf-chat.lf-chat-docked.open { animation: lfChatDrop .16s ease-out; }
@keyframes lfChatDrop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lf-chat.lf-chat-docked.open { animation: none; } }
@media (max-width: 520px) { .lf-chat.lf-chat-docked { left: 8px; right: 8px; width: auto; } }
