/* ═══════════════════════════════════════════════════════════════════════════
   forms.css — buttons, inputs, switches, search results
   The sidebar and modals both pull from these primitives.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ───── Sidebar-context inputs ───── */
.field-row { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.field-row > * { flex: 1; min-width: 0; }
.input {
  width: 100%; background: var(--bg-sidebar-elev); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.55rem 0.75rem; border-radius: 6px;
  font-family: var(--sans); font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--bg-sidebar-elev-2); }
.input::placeholder { color: var(--text-muted); }

/* ───── Buttons ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--accent); color: white; border: 1px solid var(--accent);
  padding: 0.5rem 0.85rem; border-radius: 6px;
  font-family: var(--sans); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; width: 100%;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover  { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn.btn-ghost:hover { background: var(--bg-sidebar-elev); border-color: var(--border); }
.btn.btn-small { padding: 0.4rem 0.7rem; font-size: 0.8rem; }

.btn-row { display: flex; gap: 0.5rem; }
.btn-row .btn { flex: 1; }

/* ───── Icon-only buttons (in category rows etc) ───── */
.icon-btn {
  background: transparent; border: none; cursor: pointer; padding: 4px;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.icon-btn svg { width: 15px; height: 15px; }

/* ───── Hint text (italic muted serif) ───── */
.hint {
  margin-top: 0.6rem; font-size: 0.75rem; color: var(--text-muted);
  font-family: var(--serif); font-style: italic; line-height: 1.45;
}

/* ───── iOS-style switch ───── */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 100px;
  transition: background 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 14px; width: 14px;
  left: 3px; top: 3px; background: white; border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + .slider          { background: var(--accent); }
.switch input:checked + .slider::before  { transform: translateX(16px); }
.switch input:disabled + .slider         { opacity: 0.5; cursor: not-allowed; }

/* ───── Search results dropdown ───── */
.search-results {
  margin-top: 0.4rem;
  background: var(--bg-sidebar-elev); border: 1px solid var(--border);
  border-radius: 7px; overflow: hidden;
  max-height: 280px; overflow-y: auto;
}
.search-result {
  padding: 0.55rem 0.75rem; cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.825rem; line-height: 1.35;
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-sidebar-elev-2); }
.search-result .sr-name { font-weight: 500; }
.search-result .sr-meta {
  font-size: 0.72rem; color: var(--text-muted);
  margin-top: 0.15rem; font-variant-numeric: tabular-nums;
}

/* ───── Empty-state copy ───── */
.empty-state {
  padding: 0.75rem; text-align: center;
  color: var(--text-muted);
  font-family: var(--serif); font-style: italic; font-size: 0.85rem;
}

/* ───── Spinner (inline, inherits colour) ───── */
.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
