/* FLUXBOT chat app: Web search (E2). Prefixes: #searchBtn, .sources, .src-*, .web-chip, .search-status, .web-note
   (BUILD-PLAN §8.11). Dark + light themes via the style.css tokens; no animation under prefers-reduced-motion or
   body.fx-off; body.no-search (the kill switch, members only) hides the button. */

body.no-search #searchBtn { display: none !important; }
#searchBtn .tb-label { display: none; }
@media (min-width: 420px) { #searchBtn .tb-label { display: inline; } } /* the word "Search" when there's room */
#composer[data-mode="search"] #searchBtn .tb-label { display: none; } /* the chip says it already */

/* while the answer is on its way */
.search-status { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 6px; font-size: 13px; color: var(--muted); }
.search-status::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: srcPulse 1.2s ease-in-out infinite;
}
@keyframes srcPulse { 50% { opacity: .25; transform: scale(.7); } }
body.fx-off .search-status::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .search-status::after { animation: none !important; } }

/* Sources under a web answer: the domain in bold (never cut off), the title on one line */
.sources {
  margin-top: 14px; padding: 6px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); max-width: 100%;
}
[data-theme="dark"] .sources, :root:not([data-theme="light"]) .sources { background: rgba(10, 20, 40, 0.55); }
.src-head { padding: 4px 8px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
[data-theme="light"] .src-head { color: var(--muted); }
/* minmax(0, 1fr): a long one-line title must never widen the list past the reply */
.src-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.src-item { min-width: 0; }
.src-item a {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 0; min-height: 44px; padding: 6px 8px;
  border-radius: 10px; color: var(--text); text-decoration: none; min-width: 0; overflow: hidden;
}
.src-item a:hover { background: var(--hover); }
.src-item a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.src-host { flex: 0 1 auto; max-width: 100%; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.src-title { flex: 1 1 8em; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-more {
  margin: 4px 6px 2px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--accent);
}
[data-theme="light"] .src-more { color: #0a52c4; }
.src-more:hover { background: var(--hover); }

/* "answered without the web" (the look of .switch-note) */
.web-note {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 12px; border-radius: 14px;
  font-size: 12.5px; line-height: 1.45; color: var(--muted); background: var(--neon-soft, var(--surface)); border: 1px solid var(--border);
  max-width: 100%;
}

/* "🌐 This might be out of date · Search the web" */
.web-chip {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 40px; padding: 4px 14px;
  border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text);
  font-size: 13px; text-align: left; transition: background .15s;
}
.web-chip:hover { background: var(--active); }
.web-chip .wc-go { color: var(--accent); }
[data-theme="light"] .web-chip .wc-go { color: #0a52c4; }
.web-chip .wc-dot { color: var(--dim); }

@media (max-width: 768px) {
  .src-more { min-height: 40px; }
}
@media (forced-colors: active) {
  .sources, .web-chip, .web-note { border-color: CanvasText; }
  .search-status::after { background: CanvasText; }
}
