/* ── ff chatbot ────────────────────────────────────────────────────────────
   Visitor-facing chat widget. Floating launcher bottom-right + a slide-up
   panel. Driven by chatbot_getConfig.php; rendered by ff-chatbot.js.
   Uses the F&F theme vars (--fnf-color-primary, etc.) with safe fallbacks. */

.ff-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 9998;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ff-chat-launcher:hover { transform: scale(1.05); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3); }
.ff-chat-launcher.ff-chat-open { transform: scale(0.9); }

.ff-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 88px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: var(--fnf-font-body, system-ui, sans-serif);
    animation: ff-chat-rise 0.2s ease-out;
}
.ff-chat-panel.ff-chat-show { display: flex; }

@keyframes ff-chat-rise {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.ff-chat-header {
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* Force the auto-contrast color onto every heading/link in the colored header.
   Published sites carry global `h1–h6 { color: var(--heading-color) }` (Yummy
   main.css) and `a { color: … }` rules that would otherwise leak onto this
   colored chrome — the ✕ stayed white only because a <button> has no such rule.
   Mirrors the theme's own `.fnf-section--bg-primary h1–h6 { color: inherit }`
   fix and wins on specificity, so no !important is needed. */
.ff-chat-header h1, .ff-chat-header h2, .ff-chat-header h3,
.ff-chat-header h4, .ff-chat-header h5, .ff-chat-header h6,
.ff-chat-header a {
    color: var(--fnf-color-primary-contrast, #fff);
}
.ff-chat-header h4 { margin: 0; font-size: 15px; font-weight: 600; font-family: inherit; }
.ff-chat-header__close {
    background: none; border: none; color: inherit;
    font-size: 22px; line-height: 1; cursor: pointer; opacity: 0.85;
}
.ff-chat-header__close:hover { opacity: 1; }

.ff-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7f9;
}

.ff-chat-msg { margin-bottom: 10px; display: flex; }
.ff-chat-msg__bubble {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    max-width: 85%;
    word-wrap: break-word;
}
.ff-chat-msg--bot .ff-chat-msg__bubble {
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.ff-chat-msg--user { justify-content: flex-end; }
.ff-chat-msg--user .ff-chat-msg__bubble {
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff);
    border-bottom-right-radius: 4px;
}
.ff-chat-msg__bubble a { color: inherit; text-decoration: underline; }
.ff-chat-msg--bot .ff-chat-msg__bubble a { color: var(--fnf-color-primary, #4f46e5); }

.ff-chat-cta {
    display: inline-block;
    margin-top: 8px;
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff) !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

/* "You might also ask" label above follow-up chips */
.ff-chat-followup-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    margin: 2px 0 6px;
}

/* Suggested-question chips */
.ff-chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ff-chat-chip {
    border: 1px solid var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary, #4f46e5);
    background: #fff;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.ff-chat-chip:hover {
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff);
}

/* Contact card in the fallback */
.ff-chat-contact { font-size: 13px; line-height: 1.6; margin-top: 6px; }
.ff-chat-contact a { color: var(--fnf-color-primary, #4f46e5); }

/* Lead-capture form in the fallback */
.ff-chat-lead { display: flex; gap: 6px; margin-top: 8px; }
.ff-chat-lead__email {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}
.ff-chat-lead__email:focus { border-color: var(--fnf-color-primary, #4f46e5); }
.ff-chat-lead__send { border: none; cursor: pointer; }
.ff-chat-lead__send:disabled { opacity: 0.6; cursor: default; }

/* Typing indicator (live mode) */
.ff-chat-typing { display: inline-flex; gap: 4px; align-items: center; }
.ff-chat-typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: #9ca3af; display: inline-block;
    animation: ff-chat-blink 1.2s infinite both;
}
.ff-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ff-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ff-chat-blink {
    0%, 80%, 100% { opacity: 0.3; }
    40%           { opacity: 1; }
}

.ff-chat-footer {
    border-top: 1px solid #e5e7eb;
    padding: 10px;
    display: flex;
    gap: 8px;
    background: #fff;
}
.ff-chat-footer input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
}
.ff-chat-footer input:focus { border-color: var(--fnf-color-primary, #4f46e5); }
.ff-chat-footer button {
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    background: var(--fnf-color-primary, #4f46e5);
    color: var(--fnf-color-primary-contrast, #fff);
    cursor: pointer;
    flex: 0 0 auto;
}
.ff-chat-footer button:disabled { opacity: 0.5; cursor: default; }

.ff-chat-powered {
    text-align: center;
    font-size: 10px;
    color: #9ca3af;
    padding: 4px 0 8px;
    background: #fff;
}
