/**
 * Conversational intake — the posting page + apply chat.
 * Spec: docs/product/conversational-intake/SLICE-1-SPEC.md
 *
 * Layout contract:
 *   >= 900px  two panes; content scrolls left, chat is pinned right
 *   <  900px  single column; the chat collapses to a prompt bubble that opens
 *             full-screen (the pattern hourly applicants actually use, on a phone)
 */

:root {
    --fc-accent: #B4145A;
    --fc-header-bg: #EDE4DA;
    --fc-border: #E5E7EB;
    --fc-text: #1F2937;
    --fc-muted: #6B7280;
}

/* Scoped reset. The host page's reset isn't guaranteed here (this renders on
   public-chat/index.html today and will be embedded elsewhere), and several
   panes below combine width:100% with padding — without border-box that
   overflows the viewport horizontally, which is the recurring layout bug in
   this codebase. */
.fc-page,
.fc-page *,
.fc-page *::before,
.fc-page *::after {
    box-sizing: border-box;
}

.fc-page {
    min-height: 100vh;
    background: #FAFAFA;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--fc-text);
    display: flex;
    flex-direction: column;
}

/* ─── Branded header band ─────────────────────── */
.fc-header {
    background: var(--fc-header-bg);
    padding: 18px 24px;
    text-align: center;
    flex: 0 0 auto;
}

.fc-header img {
    max-height: 44px;
    max-width: 260px;
    width: auto;
    display: inline-block;
}

.fc-header-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ─── Two-pane shell ──────────────────────────── */
.fc-shell {
    flex: 1 1 auto;
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: stretch;
    min-height: 0;          /* let the panes own the scroll, not the page */
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.fc-posting {
    flex: 1 1 auto;
    min-width: 0;
    background: #FFFFFF;
    border: 1px solid var(--fc-border);
    border-radius: 12px;
    padding: 32px 36px 88px;
    position: relative;
    overflow-y: auto;
}

.fc-posting-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 12px;
}

.fc-location {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--fc-muted);
    margin-bottom: 22px;
}

.fc-location::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2DD4BF;
    flex: 0 0 auto;
}

/* Author-supplied job description. Constrained so a pasted Word/Indeed blob
   can't blow out the layout with giant images or wide tables. */
.fc-posting-body { font-size: 15px; line-height: 1.65; }
.fc-posting-body h1,
.fc-posting-body h2,
.fc-posting-body h3 { font-size: 17px; font-weight: 700; margin: 24px 0 10px; }
.fc-posting-body p { margin: 0 0 14px; }
.fc-posting-body ul,
.fc-posting-body ol { margin: 0 0 16px; padding-left: 24px; }
.fc-posting-body li { margin-bottom: 6px; }
.fc-posting-body img { max-width: 100%; height: auto; }
.fc-posting-body table { display: block; overflow-x: auto; max-width: 100%; }

/* Pinned CTA so "apply" is reachable without scrolling a 1,400-word JD. */
.fc-cta-bar {
    position: sticky;
    bottom: -88px;
    margin: 24px -36px -88px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #FFFFFF 40%);
    text-align: center;
}

.fc-cta {
    background: var(--fc-accent);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 13px 34px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s;
}

.fc-cta:hover { filter: brightness(1.08); }

/* ─── Chat pane ───────────────────────────────── */
.fc-chat {
    flex: 0 0 380px;
    background: #FFFFFF;
    border: 1px solid var(--fc-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - 40px);
    position: sticky;
    top: 20px;
}

.fc-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--fc-border);
    flex: 0 0 auto;
}

.fc-chat-header img,
.fc-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    background: #E5E7EB;
}

.fc-chat-header-name { font-size: 15px; color: #374151; }

.fc-chat-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fc-muted);
    padding: 4px;
    display: none;          /* only meaningful in the mobile takeover */
    line-height: 0;
}

.fc-log {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Persona splash above the first message, like a real intro */
.fc-intro { text-align: center; padding: 22px 0 8px; }
.fc-intro img,
.fc-intro .fc-avatar-lg {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 10px;
    display: block;
    background: #E5E7EB;
}
.fc-intro-name { font-size: 19px; color: #4B5563; }

.fc-started {
    text-align: center;
    font-size: 12px;
    color: #9CA3AF;
    border-top: 1px solid #F3F4F6;
    padding-top: 12px;
}

.fc-row { display: flex; gap: 8px; align-items: flex-start; }
.fc-row.user { justify-content: flex-end; }

.fc-bubble {
    max-width: 78%;
    font-size: 14.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.fc-row.user .fc-bubble {
    background: #FFFFFF;
    border: 1px solid var(--fc-border);
    border-radius: 8px;
    padding: 9px 13px;
    color: #374151;
}

.fc-row.error .fc-bubble { color: #B91C1C; }

/* Answer card: chips + a footer action (Skip before choosing, Done after) */
.fc-card {
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    overflow: hidden;
    background: #FFFFFF;
}

.fc-card-label {
    padding: 12px 14px;
    font-size: 14px;
    color: var(--fc-muted);
    border-bottom: 1px solid var(--fc-border);
}

.fc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding: 14px;
}

.fc-chip {
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    padding: 9px 17px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    /* 44px min touch target — these are tapped on phones */
    min-height: 40px;
}

.fc-chip:hover { border-color: var(--fc-accent); }

.fc-chip.selected {
    background: var(--fc-accent);
    border-color: var(--fc-accent);
    color: #FFFFFF;
}

.fc-card-action {
    border-top: 1px solid var(--fc-border);
    text-align: center;
}

.fc-card-action button {
    width: 100%;
    background: none;
    border: none;
    padding: 13px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
}

.fc-card-action button.primary { color: var(--fc-accent); font-weight: 600; }
.fc-card-action button:hover { background: #F9FAFB; }

/* File upload */
.fc-drop {
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    padding: 18px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: #FFFFFF;
    font-size: 14px;
    color: #374151;
    transition: border-color 0.15s, background 0.15s;
}

.fc-drop:hover,
.fc-drop.dragover { border-color: var(--fc-accent); background: #FDF2F7; }
.fc-drop svg { flex: 0 0 auto; color: var(--fc-muted); }

.fc-doc {
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 13.5px;
    background: #F9FAFB;
    word-break: break-all;
}

.fc-hint { font-size: 12px; color: #9CA3AF; padding: 0 2px; }

/* Typing indicator */
.fc-typing { display: flex; gap: 4px; padding: 6px 2px; }
.fc-typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--fc-accent);
    animation: fc-bounce 1.3s infinite ease-in-out;
}
.fc-typing span:nth-child(2) { animation-delay: 0.16s; }
.fc-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes fc-bounce {
    0%, 70%, 100% { transform: translateY(0); opacity: 0.45; }
    35% { transform: translateY(-5px); opacity: 1; }
}

/* Composer */
.fc-composer {
    flex: 0 0 auto;
    border-top: 1px solid var(--fc-border);
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.fc-composer input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--fc-border);
    border-radius: 999px;
    padding: 12px 16px;
    /* 16px keeps iOS from zooming the viewport on focus */
    font-size: 16px;
    font-family: inherit;
    outline: none;
}

.fc-composer input:focus { border-color: var(--fc-accent); }
.fc-composer input:disabled { background: #F9FAFB; cursor: not-allowed; }

.fc-send {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--fc-accent);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-send:disabled { opacity: 0.4; cursor: not-allowed; }

.fc-footnote {
    flex: 0 0 auto;
    text-align: center;
    font-size: 11.5px;
    color: #9CA3AF;
    padding: 0 12px 12px;
}

/* Launcher — hidden on desktop, where the chat is always visible */
.fc-launcher { display: none; }

/* ─── Mobile: stack, and collapse the chat ────── */
@media (max-width: 899px) {
    .fc-shell { flex-direction: column; padding: 12px; gap: 12px; }
    .fc-posting { padding: 22px 18px 80px; overflow-y: visible; }
    .fc-cta-bar { margin: 20px -18px -80px; }
    .fc-posting-title { font-size: 22px; }

    /* Full-screen takeover rather than a cramped panel */
    .fc-chat {
        position: fixed;
        inset: 0;
        z-index: 1000;
        flex: 1 1 auto;
        max-height: none;
        border: none;
        border-radius: 0;
        display: none;
        top: 0;
    }
    .fc-chat.open { display: flex; }
    .fc-chat-close { display: block; }

    .fc-launcher {
        display: flex;
        position: fixed;
        right: 14px;
        bottom: 14px;
        z-index: 999;
        align-items: center;
        gap: 10px;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
    }
    .fc-launcher-text {
        background: #FFFFFF;
        border: 1px solid var(--fc-border);
        border-radius: 10px;
        padding: 10px 14px;
        font-size: 14px;
        font-family: inherit;
        color: #374151;
        box-shadow: 0 4px 14px rgba(0,0,0,0.13);
        max-width: 60vw;
        text-align: left;
    }
    .fc-launcher img,
    .fc-launcher .fc-avatar-lg {
        width: 56px; height: 56px;
        border-radius: 50%;
        object-fit: cover;
        box-shadow: 0 4px 14px rgba(0,0,0,0.2);
        background: #E5E7EB;
    }
    .fc-chat.open ~ .fc-launcher { display: none; }
}

/* Success state */
.fc-done {
    text-align: center;
    padding: 22px 8px;
    font-size: 14.5px;
    line-height: 1.55;
    color: #374151;
}
