/* Search-intent chatbot (template-parts/intent-chatbot.php, js/intent-chatbot.js)
   Frosted-glass panel: translucent white over the page, soft green/blue glows, green Upside accents. */

/* Default launcher — pages with their own FAB look pass button_class 'us-fab-btn' instead */
.ilp-chat-btn {
    position: fixed; right: 24px; bottom: 24px; z-index: 9998;
    display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 22px 0 18px;
    background: #a8cf45; color: #000; border: 0; border-radius: 9999px; font-weight: 600; font-size: 15px;
    box-shadow: 0 10px 24px rgba(168, 207, 69, .45), 0 4px 10px rgba(0,0,0,.15);
    cursor: pointer; transition: transform .2s;
}
.ilp-chat-btn:hover { transform: scale(1.05); }
#ilp-chat-btn[aria-expanded="true"] { display: none !important; }
#ilp-chat-btn[hidden] { display: none !important; } /* ads-only pages until an intent matches */

.ilp-chat {
    --ilp-green: #a8cf45; --ilp-green-dark: #6d9a22; --ilp-ink: #1b2a4a; --ilp-muted: #6b7280;
    position: fixed; right: 24px; bottom: 24px; z-index: 9999;
    width: 360px; max-width: calc(100vw - 32px); max-height: min(540px, calc(100vh - 48px)); /* height follows the conversation */
    display: flex; flex-direction: column; isolation: isolate; overflow: hidden;
    overflow: clip; /* not a scroll container: CF7's success scrollIntoView() can't shift the whole panel up */
    background: rgba(247, 249, 251, .95); /* near-white like the reference, even over a dark hero */
    -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .85); border-radius: 28px;
    box-shadow: 0 24px 50px -12px rgba(15, 23, 42, .18), 0 8px 20px rgba(15, 23, 42, .06), inset 0 1px 0 rgba(255,255,255,.9);
    color: var(--ilp-ink);
    opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s;
}
/* Soft glows behind the content (reference: green bottom-left, blue right) */
.ilp-chat::before, .ilp-chat::after {
    content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(40px); pointer-events: none;
}
.ilp-chat::before { width: 200px; height: 200px; left: -50px; bottom: 50px; background: rgba(190, 228, 140, .35); }
.ilp-chat::after { width: 220px; height: 220px; right: -70px; top: 40%; background: rgba(191, 219, 254, .45); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .ilp-chat { background: rgba(248, 250, 252, .97); }
}
.ilp-chat[hidden] { display: none; }
.ilp-chat.is-open { opacity: 1; transform: translateY(0); }

/* Header */
.ilp-chat-head {
    display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}
.ilp-chat-id { flex: 1; min-width: 0; }
.ilp-chat-title { color: var(--ilp-ink); font-weight: 700; font-size: 16px; line-height: 1.2; margin: 0; }
.ilp-chat-sub { color: var(--ilp-muted); font-size: 12.5px; line-height: 1.3; margin: 2px 0 0; }
.ilp-chat-close {
    background: transparent; color: #1f2937; border: 0; border-radius: 9999px; width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.ilp-chat-close:hover { background: rgba(15, 23, 42, .06); }
.ilp-chat-close:focus-visible { outline: 2px solid var(--ilp-ink); outline-offset: 2px; }

/* Avatar: the Upside arrow mark (dev uploads/2026/10/UL_logo.svg, inlined so it works on every site) */
.ilp-avatar { width: 28px; height: 30px; flex-shrink: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15 15.5 148.1 163'%3E%3Cpath fill='%23a5cf45' d='M70.54,178.37h85.08c4.09,0,7.41-3.52,7.41-7.82V23.65c0-4.22-3.33-7.86-7.41-7.86H22.5c-4.09,0-7.43,3.64-7.43,7.86v96.19c0,32.18,24.96,58.54,55.47,58.54ZM152.7,22.91l-41.89,83.48-15.65-26.11-26.2-15.67,83.74-41.7Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.ilp-avatar-lg { width: 38px; height: 42px; }

/* Conversation */
.ilp-chat-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 12px;
    scrollbar-width: thin; scrollbar-color: rgba(15, 23, 42, .15) transparent;
}
.ilp-chat-log { display: flex; flex-direction: column; gap: 8px; }
.ilp-row { display: flex; align-items: flex-start; gap: 10px; }
.ilp-row-cont .ilp-avatar { visibility: hidden; }
.ilp-msg { max-width: 82%; padding: 11px 15px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; }
.ilp-msg-bot {
    background: #eef2f7; color: #1f2937;
    border: 1px solid #e6ebf2; border-top-left-radius: 6px;
}
.ilp-row-cont .ilp-msg-bot { border-top-left-radius: 18px; }
.ilp-row .ilp-msg { max-width: calc(100% - 52px); }
.ilp-msg-user {
    align-self: flex-end; background: var(--ilp-green); color: #0f172a; font-weight: 500;
    border-bottom-right-radius: 6px; box-shadow: 0 4px 12px rgba(143, 191, 53, .25);
}

/* Answers */
.ilp-chat-input { display: flex; flex-direction: column; gap: 8px; padding-left: 40px; }
.ilp-chat-input:empty { display: none; }
.ilp-chat-hint { margin: 2px 0 0; font-size: 12px; color: var(--ilp-muted); text-align: center; }
.ilp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ilp-chips-col { flex-direction: column; align-items: stretch; }
.ilp-chat .ilp-opt {
    display: inline-flex; align-items: center; gap: 10px; text-align: left;
    border: 1.5px solid rgba(168, 207, 69, .75); background: transparent; color: var(--ilp-ink);
    border-radius: 9999px; padding: 10px 18px 10px 14px; font-size: 14px; font-weight: 600; line-height: 1.3;
    cursor: pointer; transition: background-color .2s, border-color .2s, box-shadow .2s, transform .15s;
}
.ilp-chips-col .ilp-opt { border-radius: 18px; }
/* Single choice: green chevron on the left */
.ilp-chat .ilp-opt::before {
    content: ""; width: 16px; height: 16px; flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237cb32e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 5 16 12 9 19'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ilp-chat .ilp-opt:hover { border-color: #8fbf35; }
.ilp-chat .ilp-opt:focus-visible { outline: 2px solid var(--ilp-ink); outline-offset: 2px; }
/* Multi-select: white rows with a round check */
.ilp-list { display: flex; flex-direction: column; gap: 8px; }
.ilp-chat .ilp-opt[aria-pressed]::before {
    width: 20px; height: 20px; border: 1.5px solid #6b7280; border-radius: 50%; background: none;
}
.ilp-chat .ilp-opt[aria-pressed="true"] { background: rgba(168, 207, 69, .16); border-color: var(--ilp-green); }
.ilp-chat .ilp-opt[aria-pressed="true"]::before {
    border-color: #7cb32e;
    background: #7cb32e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.ilp-chat-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ilp-chat-next {
    display: inline-flex; align-items: center; gap: 8px; align-self: flex-end;
    background: var(--ilp-green); color: #0f172a; border: 0; border-radius: 9999px; padding: 11px 22px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    box-shadow: 0 8px 18px rgba(143, 191, 53, .35); transition: background-color .2s, transform .15s;
}
.ilp-chat-next::after { content: "\2192"; font-weight: 700; }
.ilp-chat-next:hover { background: #9bc23a; transform: translateY(-1px); }
.ilp-chat-next:focus-visible { outline: 2px solid var(--ilp-ink); outline-offset: 2px; }
.ilp-chat-next[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* Lead form: the page's dark form card, inset in the glass */
.ilp-chat-form { background: #3b3b3b; border-radius: 20px; padding: 18px; box-shadow: 0 10px 24px rgba(15, 23, 42, .18); }
.ilp-chat-form[hidden] { display: none; }
/* Submit label = the flow's end CTA (can be ~55 chars): keep it inside the card, wrap instead of overflowing.
   Beats the page's own `.home-cta-form .wpcf7 input[type="submit"]` rule (same !important, higher specificity). */
.ilp-chat-form .home-cta-form .wpcf7 input[type="submit"] {
    max-width: 100% !important; white-space: normal !important; overflow-wrap: break-word;
    height: auto !important; line-height: 1.3 !important; text-align: left;
    font-size: 14px !important; padding: 12px 48px 12px 22px !important; border-radius: 24px !important;
    background-position: right 18px center !important;
}

/* Docked composer */
.ilp-chat-composer { display: flex; align-items: center; gap: 10px; padding: 12px 16px 16px; }
.ilp-chat-composer[hidden] { display: none; }
.ilp-chat-composer input {
    flex: 1; min-width: 0; height: 50px; padding: 0 20px; font-size: 14.5px; color: var(--ilp-ink);
    background: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .95); border-radius: 9999px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .07);
}
.ilp-chat-composer input::placeholder { color: #8a94a6; }
.ilp-chat-composer input:focus { outline: 2px solid rgba(168, 207, 69, .7); outline-offset: 0; }
.ilp-chat-composer input:disabled { background: rgba(255, 255, 255, .55); cursor: not-allowed; }
.ilp-chat-sendbtn {
    width: 50px; height: 50px; flex-shrink: 0; border: 0; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: #8cc63f; color: #fff; box-shadow: 0 8px 18px rgba(140, 198, 63, .4); transition: transform .15s, background-color .2s;
}
.ilp-chat-sendbtn:hover { background: #7db535; transform: scale(1.05); }
.ilp-chat-sendbtn:focus-visible { outline: 2px solid var(--ilp-ink); outline-offset: 2px; }
.ilp-chat-sendbtn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

@media (max-width: 640px) {
    .ilp-chat-btn { right: auto; left: 50%; bottom: 16px; transform: translateX(-50%); height: 48px; font-size: 14px; }
    .ilp-chat-btn:hover { transform: translateX(-50%) scale(1.05); }
    .ilp-chat { left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; max-height: 85vh; max-height: 85dvh; border-radius: 24px; }
    .ilp-chat-input { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .ilp-chat, .ilp-chat-btn, .ilp-chat .ilp-opt, .ilp-chat-next, .ilp-chat-sendbtn { transition: none; }
}

/* Chatbot lead step = Name, Work Email, Company, Job Title only (content doc). Team size is optional in the
   shared CF7 form, so it is hidden here and stays on the page's own forms. */
.ilp-chat-form .cf7-col-full:has([data-name="workforce"]) { display: none; }