/* ========================================
   Assistant chat window (assets/js/assistant.js), on every page.
   Site tokens and font only; sits under the mobile menu (z-index 140/150).
   Direction B (fintwinpay#88, T44): a white button with a hairline — the dark ink stays the page's main
   action; the panel is a window of B; on phones the button waits below the first screen.
   ======================================== */
.fp-assist-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 120;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 44px;
    padding: 0 1.1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--t1);
    background-color: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: var(--r-s);
    box-shadow: var(--sh);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s var(--ease), opacity 0.25s;
}

.fp-assist-toggle:hover { border-color: var(--t1); transform: translateY(-1px); }
.fp-assist-toggle:focus-visible { outline: 3px solid var(--glow-blue-strong); outline-offset: 2px; }
.fp-assist-toggle svg { width: 1.15rem; height: 1.15rem; flex: none; color: var(--brand-blue-dark); }
.fp-assist-open .fp-assist-toggle { display: none; }

.fp-assist-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 120;
    display: none;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 2.5rem);
    height: 560px;
    max-height: calc(100vh - 2.5rem);
    background: var(--bg-white);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    box-shadow: var(--sh-window);
    overflow: hidden;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.fp-assist-open .fp-assist-panel { display: flex; }

.fp-assist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    color: var(--t1);
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
}

.fp-assist-title { font-weight: 700; font-size: 0.95rem; }

.fp-assist-close {
    width: 2rem;
    height: 2rem;
    padding: 0;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--t1);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    cursor: pointer;
}

.fp-assist-close:hover { border-color: var(--t1); }
.fp-assist-close:focus-visible { outline: 2px solid var(--brand-blue-dark); }

.fp-assist-note {
    margin: 0;
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.fp-assist-log {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fp-assist-msg {
    max-width: 85%;
    padding: 0.6rem 0.8rem;
    line-height: 1.5;
    border-radius: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.fp-assist-msg-user { align-self: flex-end; color: #fff; background: var(--ink); border-bottom-right-radius: 0.25rem; }
.fp-assist-msg-bot { align-self: flex-start; background: var(--bg-gray); border-bottom-left-radius: 0.25rem; }
.fp-assist-msg-error { align-self: flex-start; color: var(--text-secondary); background: transparent; border: 1px dashed var(--border-medium); }

.fp-assist-wait { align-self: flex-start; display: inline-flex; gap: 0.3rem; padding: 0.75rem 0.85rem; background: var(--bg-gray); border-radius: 0.75rem; }
.fp-assist-wait span { width: 0.4rem; height: 0.4rem; background: var(--text-muted); border-radius: 50%; animation: fp-assist-dot 1.2s infinite ease-in-out; }
.fp-assist-wait span:nth-child(2) { animation-delay: 0.15s; }
.fp-assist-wait span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fp-assist-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .fp-assist-wait span { animation: none; }
}

.fp-assist-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.fp-assist-input {
    flex: 1;
    min-height: 2.5rem;
    max-height: 7rem;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-s);
    resize: none;
}

.fp-assist-input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px var(--glow-blue); }

.fp-assist-send {
    height: 2.5rem;
    padding: 0 1rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--ink);
    border: none;
    border-radius: var(--r-s);
    cursor: pointer;
}

.fp-assist-send:hover { background: #1e293b; }
.fp-assist-send:disabled { opacity: 0.55; cursor: default; }

.fp-assist-foot {
    margin: 0;
    padding: 0 0.75rem 0.7rem;
    font-size: 0.75rem;
    color: var(--t2);
}

.fp-assist-foot a { color: var(--brand-blue-ink); }

@media (max-width: 480px) {
    /* a round icon on phones: it does not cover the first screen's scheme (fintwinpay#80 p.9);
       the words stay its accessible name */
    .fp-assist-toggle { right: 1rem; bottom: 1rem; width: 3.25rem; height: 3.25rem; padding: 0; justify-content: center; gap: 0; font-size: 0; border-radius: 50%; }
    .fp-assist-toggle svg { width: 1.4rem; height: 1.4rem; }
    .fp-assist-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; border: none; }
}

/* phones and tablets: while most of the first screen of the home page is in view the button is away
   (fintwinpay#88, critique p.14); assistant.js sets fp-assist-hero on the home page only */
@media (max-width: 959px) {
    .fp-assist-hero .fp-assist-toggle { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px); }
}
