/* ── Pagefind custom search UI ───────────────────────────────────────────
   Uses the low-level pagefind.js API, so no pagefind-ui.css is loaded.
   All classes are prefixed with .pf- to avoid conflicts with RTD theme.
──────────────────────────────────────────────────────────────────────── */

#pf {
  max-width: 820px;
  margin-top: 1.25rem;
}

/* ── Input ─────────────────────────────────────────────────────────────── */

.pf-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* magnifying-glass icon — absolutely positioned, no overlap with text */
.pf-search-icon {
  position: absolute;
  left: 10px;
  width: 18px;
  height: 18px;
  color: #aaa;
  pointer-events: none;
  flex-shrink: 0;
}

#pf-input {
  width: 100%;
  box-sizing: border-box;
  /* left pad = icon (18px) + gap (10px) + left edge (10px) = 38px */
  padding: 0.6rem 2.2rem 0.6rem 2.6rem;
  border: 1px solid #c8d0d8;
  border-radius: 3px;
  font-size: 1rem;
  font-family: Lato, "Helvetica Neue", Arial, sans-serif;
  color: #404040;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#pf-input:focus {
  border-color: #2980b9;
  outline: none;
  box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.2);
}

.pf-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: 1.1rem;
  padding: 2px 4px;
  line-height: 1;
}
.pf-clear:hover { color: #555; }

/* ── Section filters ───────────────────────────────────────────────────── */

.pf-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-top: 0.8rem;
  padding: 0.55rem 0.9rem;
  background: #f8f9fa;
  border: 1px solid #e1e4e5;
  border-radius: 3px;
}

.pf-filters-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  white-space: nowrap;
  margin-right: 0.2rem;
}

/* Each checkbox+label pair — clicking anywhere toggles the checkbox */
.pf-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: #404040;
  cursor: pointer;
  user-select: none;
}

.pf-filter-item input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #2980b9;
}

/* Occurrence count bubble next to each filter label */
.pf-filter-count {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.3em;
  border-radius: 8px;
  background: #dde4ea;
  color: #555;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
  margin-left: 0.2rem;
}

/* ── Status line ───────────────────────────────────────────────────────── */

.pf-status {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  color: #888;
  min-height: 1.2em;
}

/* ── Results ───────────────────────────────────────────────────────────── */

.pf-results {
  margin-top: 0.25rem;
}

.pf-result {
  padding: 0.9rem 0;
  border-bottom: 1px solid #eaedf0;
}
.pf-result:last-child { border-bottom: none; }

.pf-result-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

/* Section badge */
.pf-result-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.1rem 0.42rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  /* default (Documentation / unknown) */
  background: #e8f1f8;
  color: #2980b9;
  border: 1px solid #c3ddf0;
}

.pf-tag-examples         { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.pf-tag-modules          { background: #e3f2fd; color: #1565c0; border-color: #90caf9; }
.pf-tag-features         { background: #fff8e1; color: #e65100; border-color: #ffe082; }
.pf-tag-getting-started  { background: #f3e5f5; color: #6a1b9a; border-color: #ce93d8; }
.pf-tag-exploitation     { background: #fce4ec; color: #880e4f; border-color: #f48fb1; }
.pf-tag-general-documentation { background: #e0f2f1; color: #00695c; border-color: #80cbc4; }
.pf-tag-composer         { background: #fff3e0; color: #bf360c; border-color: #ffcc80; }
.pf-tag-misc             { background: #f5f5f5; color: #555;    border-color: #ddd;    }

.pf-result-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2980b9 !important;
  text-decoration: none !important;
}
.pf-result-title:hover { text-decoration: underline !important; }

.pf-result-excerpt {
  margin: 0;
  font-size: 0.88rem;
  color: #666;
  line-height: 1.55;
}

/* Highlight from pagefind excerpts */
.pf-result-excerpt mark {
  background: #fff3cd;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
