@layer infine.components {
/* ─────────────────────────────────────────────────────────────────────
   Empty :ingredient-list — paste → parse flow

   Empty state ("+ Add ingredient list" button in a dashed input-like box),
   the paste modal, the in-place parsing state (ghost family chips shimmering
   in the muted --infine-fam-N hues, foreshadowing the coloured structured
   output), and the parse-error state. Companion to
   connect-ingredient-structure.css, whose .connect-ing-box border/radius
   language the boxes here mirror.
   ──────────────────────────────────────────────────────────────────── */

/* Dashed rather than solid: an invitation to create the field's content,
   not yet an editable field. The lone centred button IS the empty state —
   guidance waits until the modal. */
.connect-ing-add-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    border: 1px dashed var(--infine-blue-light-fade);
    border-radius: var(--mantine-radius-default, 4px);
}

/* Parsing / error shell */
.connect-ing-parse-box {
    padding: 14px 12px;
    border: 1px solid var(--infine-blue-light-fade);
    border-radius: var(--mantine-radius-default, 4px);
    background: var(--infine-blue-bg-tint);
}

/* The parsing state reads as inert machinery, not an editable field: gray
   ground (Connect's disabled surface), everything composed on the centre
   axis, message at body size so the wait expectation can't be missed. */
.connect-ing-parse-box-parsing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 148px;
    background: var(--mantine-color-gray-2);
    border-color: var(--mantine-color-gray-3);
}

/* Spinner above a centred, width-capped message — an inline row would drop
   its wrapped second line flush left. */
.connect-ing-parse-box-parsing .connect-ing-parse-status {
    flex-direction: column;
    gap: 10px;
    max-width: 36em;
    text-align: center;
    font-size: var(--mantine-font-size-md);
    color: var(--mantine-color-gray-7);
}

.connect-ing-parse-box-parsing .connect-ing-parse-spinner {
    width: 20px;
    height: 20px;
}

/* Ghost chips — one per future compound family, cycling the --infine-fam-N
   tokens at a whisper of opacity, widths varied so the row reads as a
   wrapping ingredient list rather than a progress bar. */
.connect-ing-parse-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.connect-ing-parse-chip {
    height: 16px;
    border-radius: 8px;
    background: var(--fam);
    opacity: 0.18;
    animation: connect-ing-shimmer 1.8s ease-in-out infinite;
}

.connect-ing-parse-chip-0 { --fam: var(--infine-fam-1); width: 72px; }
.connect-ing-parse-chip-1 { --fam: var(--infine-fam-2); width: 48px; animation-delay: 0.2s; }
.connect-ing-parse-chip-2 { --fam: var(--infine-fam-3); width: 88px; animation-delay: 0.4s; }
.connect-ing-parse-chip-3 { --fam: var(--infine-fam-4); width: 42px; animation-delay: 0.6s; }
.connect-ing-parse-chip-4 { --fam: var(--infine-fam-5); width: 64px; animation-delay: 0.8s; }
.connect-ing-parse-chip-5 { --fam: var(--infine-fam-6); width: 52px; animation-delay: 1.0s; }
.connect-ing-parse-chip-6 { --fam: var(--infine-fam-7); width: 78px; animation-delay: 1.2s; }

/* Slightly stronger than the original whisper — the chips sit on the gray
   working ground now and would otherwise vanish into it. */
@keyframes connect-ing-shimmer {
    0%, 100% { opacity: 0.14; }
    50%      { opacity: 0.34; }
}

@media (prefers-reduced-motion: reduce) {
    .connect-ing-parse-chip { animation: none; }
}

.connect-ing-parse-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--mantine-font-size-xs);
    color: var(--mantine-color-gray-6);
}

/* Spinner: same CSS-mask technique as the autosave bar; the connect-spin
   keyframe is defined (globally) in connect-autosave-bar.css. */
.connect-ing-parse-spinner {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url("/icons/connect-saving-spinner.svg") center / contain no-repeat;
            mask: url("/icons/connect-saving-spinner.svg") center / contain no-repeat;
    animation: connect-spin 1.6s linear infinite;
}

/* Error: a system failure (autosave :error precedent), not a validator
   error — soft red tints, deliberately unlike the field-block validator
   treatment so it doesn't read as "fix your input". */
.connect-ing-parse-box-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-color: var(--infine-red-fade);
    background: var(--infine-red-bg);
}

.connect-ing-parse-box-error .connect-ing-parse-status {
    color: var(--infine-red-strong);
}

.connect-ing-parse-error-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url("/icons/connect-error.svg") center / contain no-repeat;
            mask: url("/icons/connect-error.svg") center / contain no-repeat;
}

/* Modal */
.connect-ing-add-modal-hint {
    font-size: var(--mantine-font-size-sm);
    color: var(--mantine-color-gray-7);
    margin: 0 0 10px;
}

.connect-ing-add-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
}
