/* Infinfy AI Concierge Widget — self-contained, prefixed .ifc- to avoid host-page leakage */
#infinfy-concierge, .ifc-root {
  --ifc-accent: #D97757;
  --ifc-accent-dark: #b85f42;
  --ifc-bg: #ffffff;
  --ifc-panel-bg: #faf8f6;
  --ifc-border: #e7e1da;
  --ifc-text: #2b2622;
  --ifc-muted: #8a8078;
  --ifc-radius: 14px;
  --ifc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--ifc-font);
  color: var(--ifc-text);
  box-sizing: border-box;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}
.ifc-root *, .ifc-root *::before, .ifc-root *::after { box-sizing: inherit; }

.ifc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ifc-bg);
  border: 1px solid var(--ifc-border);
  border-radius: var(--ifc-radius);
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.ifc-bar:focus-within {
  border-color: var(--ifc-accent);
  box-shadow: 0 0 0 3px rgba(217,119,87,0.15);
}

.ifc-icon-search {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--ifc-muted);
}

.ifc-input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--ifc-text);
  font-family: inherit;
  min-width: 0;
}
.ifc-input::placeholder { color: var(--ifc-muted); }

.ifc-mic-btn, .ifc-submit-btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--ifc-muted);
  transition: background .15s ease, color .15s ease;
}
.ifc-mic-btn:hover, .ifc-submit-btn:hover { background: var(--ifc-panel-bg); color: var(--ifc-accent); }
.ifc-mic-btn.ifc-listening { color: #fff; background: var(--ifc-accent); animation: ifc-pulse 1.2s ease-in-out infinite; }
.ifc-mic-btn[hidden] { display: none; }

@keyframes ifc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,87,0.45); }
  50% { box-shadow: 0 0 0 8px rgba(217,119,87,0); }
}

.ifc-submit-btn svg, .ifc-mic-btn svg { width: 18px; height: 18px; }

.ifc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ifc-chip {
  border: 1px solid var(--ifc-border);
  background: var(--ifc-panel-bg);
  color: var(--ifc-text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.ifc-chip:hover { border-color: var(--ifc-accent); color: var(--ifc-accent-dark); }

.ifc-panel {
  margin-top: 14px;
  border: 1px solid var(--ifc-border);
  border-radius: var(--ifc-radius);
  background: var(--ifc-panel-bg);
  overflow: hidden;
  display: none;
}
.ifc-panel.ifc-open { display: block; }

.ifc-loading {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ifc-muted);
  font-size: 14px;
}
.ifc-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--ifc-border);
  border-top-color: var(--ifc-accent);
  border-radius: 50%;
  animation: ifc-spin .7s linear infinite;
}
@keyframes ifc-spin { to { transform: rotate(360deg); } }

.ifc-summary {
  padding: 16px 18px;
  border-bottom: 1px solid var(--ifc-border);
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--ifc-bg);
}
.ifc-summary-label {
  display: block;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ifc-accent-dark);
  font-weight: 600;
  margin-bottom: 6px;
}

.ifc-results { list-style: none; margin: 0; padding: 0; }
.ifc-result { border-bottom: 1px solid var(--ifc-border); }
.ifc-result:last-child { border-bottom: none; }
.ifc-result a.ifc-result-link {
  display: block;
  padding: 12px 18px;
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.ifc-result a.ifc-result-link:hover { background: var(--ifc-bg); }
.ifc-result-title { font-size: 14.5px; font-weight: 600; color: var(--ifc-accent-dark); margin-bottom: 3px; }
.ifc-result-snippet { font-size: 13px; color: var(--ifc-text); opacity: .85; line-height: 1.45; }
.ifc-result-url { font-size: 11.5px; color: var(--ifc-muted); margin-top: 4px; }

.ifc-empty {
  padding: 20px 18px;
  font-size: 14px;
  color: var(--ifc-text);
  line-height: 1.6;
}
.ifc-empty a { color: var(--ifc-accent-dark); font-weight: 600; }

.ifc-footer-note {
  padding: 8px 18px;
  font-size: 11px;
  color: var(--ifc-muted);
  border-top: 1px solid var(--ifc-border);
  background: var(--ifc-bg);
}

.ifc-mic-error {
  margin-top: 8px;
  font-size: 12.5px;
  color: #a33;
}

/* ---------------------------------------------------------------------------
   Citations (added 2026-08-14) — the paid tier's visible differentiator.
   Inline [n] markers become small clickable pills that land on the client's own
   page. Deliberately understated: they must read as provenance, not decoration.
   --------------------------------------------------------------------------- */
.ifc-cite {
  display: inline-block;
  min-width: 15px;
  padding: 0 4px;
  margin: 0 1px;
  font-size: 10px;
  line-height: 15px;
  font-weight: 600;
  text-align: center;
  vertical-align: super;
  border-radius: 4px;
  background: rgba(0, 0, 0, .07);
  color: inherit;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.ifc-cite:hover,
.ifc-cite:focus-visible {
  background: var(--ifc-accent, #B3402E);
  color: #fff;
}
/* Static badge in the source list — a label, not a second link target. */
.ifc-cite-static {
  vertical-align: baseline;
  margin-right: 6px;
  pointer-events: none;
}

.ifc-answer-list { margin: 8px 0 8px 2px; padding-left: 18px; }
.ifc-answer-list li { margin-bottom: 5px; }
.ifc-summary p { margin: 0 0 9px; }
.ifc-summary p:last-child { margin-bottom: 0; }

.ifc-sources-label {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .55;
}

/* ---------------------------------------------------------------------------
   DARK THEME (added 2026-08-14) — opt in with data-theme="dark".
   The widget's default ivory palette sits on a light page. Dropped onto a
   dark-themed site (thecanadaguardian.com is near-black) it reads as a
   bolted-on third-party box, which is exactly the "the widget never took the
   client's colours" complaint from 2026-08-08. Every colour here is a variable
   override — no duplicated rules, so the two themes cannot drift apart.
   --------------------------------------------------------------------------- */
#infinfy-concierge.ifc-dark, .ifc-root.ifc-dark {
  --ifc-bg: #131a28;
  --ifc-panel-bg: #0f1520;
  --ifc-border: #26314a;
  --ifc-text: #e7ecf5;
  --ifc-muted: #93a0b8;
}
.ifc-dark .ifc-bar { box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.ifc-dark .ifc-panel { box-shadow: 0 10px 34px rgba(0,0,0,.45); }
.ifc-dark .ifc-chip {
  background: rgba(255,255,255,.05);
  border-color: var(--ifc-border);
  color: var(--ifc-muted);
}
.ifc-dark .ifc-chip:hover {
  background: rgba(255,255,255,.10);
  color: var(--ifc-text);
}
.ifc-dark .ifc-cite { background: rgba(255,255,255,.12); }
.ifc-dark .ifc-cite:hover, .ifc-dark .ifc-cite:focus-visible {
  background: var(--ifc-accent); color: #0f1520;
}
.ifc-dark .ifc-result:hover { background: rgba(255,255,255,.04); }
.ifc-dark .ifc-input::placeholder { color: var(--ifc-muted); }
/* The search/mic glyphs are strokes that vanish on dark. */
.ifc-dark .ifc-icon-search, .ifc-dark .ifc-mic { color: var(--ifc-muted); }

/* --ifc-accent-dark is the "text on light background" shade of the accent. On a
   dark surface a darkened accent is the wrong direction — it loses contrast and
   ignores the client's colour entirely (result titles kept rendering clay on a
   site whose accent is gold). On dark, text should use the accent itself. */
#infinfy-concierge.ifc-dark, .ifc-root.ifc-dark { --ifc-accent-dark: var(--ifc-accent); }
