/* =========================================================
 * HomeoPilot — Symptom → Remedy Finder
 * Frontend UI (form, cards, repertory)
 * File: assets/css/sf-ui.css
 * ======================================================= */

/* ---------- Base shell ---------- */

.hp-sf {
  max-width: 980px;
  margin: 1rem auto;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color: #0f172a; /* slate-900 */
}

.hp-sf * {
  box-sizing: border-box;
}

.hp-sf a {
  color: #0ea5e9;
  text-decoration: none;
}
.hp-sf a:hover {
  text-decoration: underline;
}

/* ---------- Search form ---------- */

.hp-sf-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.hp-sf-input {
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font: inherit;
  width: 100%;
}

.hp-sf-input:focus {
  outline: 2px solid rgba(14, 165, 233, 0.45);
  outline-offset: 1px;
  border-color: #0ea5e9;
}

.hp-sf-btn,
.hp-sf-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.hp-sf-btn {
  background: #0ea5e9;
  color: #ffffff;
}

.hp-sf-btn:hover {
  background: #0284c7;
}

.hp-sf-clear {
  margin-left: 0.5rem;
  background: #475569;
  color: #ffffff;
}
.hp-sf-clear:hover {
  background: #1e293b;
}

/* Button focus-visible (keyboard) */
.hp-sf-btn:focus-visible,
.hp-sf-clear:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
}

.hp-sf-help {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  color: #64748b; /* slate-500 */
  margin-top: 0.25rem;
}

/* ---------- Filters (Primary / Secondary) ---------- */

.hp-sf-filters {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8fafc;
}

.hp-sf-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  margin: 0.5rem 0;
}

.hp-sf-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #ffffff;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hp-sf-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.hp-sf-group label:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* ---------- Results ---------- */

.hp-sf-results {
  margin-top: 1rem;
  transition: opacity 0.15s ease;
}

.hp-sf-loading {
  opacity: 0.6;
}

.hp-sf-card {
  padding: 0.9rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 0.6rem 0;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.hp-sf-card h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.05rem;
}

.hp-sf-card h3 a {
  color: #0f172a;
  text-decoration: none;
}
.hp-sf-card h3 a:hover {
  text-decoration: underline;
}

.hp-sf-sec {
  margin: 0.25rem 0 0.25rem;
}

.hp-sf-sec h4 {
  margin: 0.25rem 0 0.2rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.hp-sf-sec-body {
  font-size: 0.94rem;
  color: #1f2937;
}

.hp-sf-modalities,
.hp-sf-ext {
  margin: 0.35rem 0 0;
  color: #334155; /* slate-700 */
  font-size: 0.94rem;
}

.hp-sf-empty {
  color: #64748b;
  font-size: 0.95rem;
}

/* ---------- Search highlight ---------- */

.hp-sf mark.mm-hi,
.hp-sf mark.hp-sf-hi {
  background: #ffeb3b;
  padding: 0 0.1em;
  border-radius: 2px;
}

/* ---------- Pagination ---------- */

.hp-sf-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: #64748b;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hp-sf-pager-center {
  flex: 1;
  text-align: center;
}

.hp-sf-page-btn {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  cursor: pointer;
  font-size: 0.85rem;
}

.hp-sf-page-btn:hover:not([disabled]) {
  background: #e5e7eb;
}

.hp-sf-page-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.hp-sf-page-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
}

/* =========================================================
 * Repertory Panel (chips + detail)
 * Used by sf-form.php + sf-repertory-panel.php
 * ======================================================= */

.hp-sf-rep-panel {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.hp-sf-rep-section {
  margin-bottom: 0.75rem;
}

.hp-sf-rep-section:last-child {
  margin-bottom: 0;
}

.hp-sf-rep-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.hp-sf-rep-section-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}

.hp-sf-rep-section-note {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.hp-sf-rep-rubrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}

/* Rubric chip / pill */
.hp-sf-rubric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.8rem;
  color: #0f172a;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease;
}

.hp-sf-rubric-pill:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
  transform: translateY(-0.5px);
}

/* Active rubric pill — clearly selected */
.hp-sf-rubric-pill.is-active {
  background: #0ea5e9;
  color: #f9fafb;
  border-color: #0284c7;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.28);
  transform: translateY(0); /* keep it "grounded" when active */
}

/* Keyboard focus on rubric pill */
.hp-sf-rubric-pill:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.7);
  outline-offset: 2px;
}

/* Repertory detail box when embedded under the form */

.hp-sf-rep-detail {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.hp-sf-rep-detail h4 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.hp-sf-rep-text {
  margin: 0.25rem 0;
  font-size: 0.94rem;
  color: #1f2937;
}

.hp-sf-rep-remedies,
.hp-sf-rep-notes,
.hp-sf-rep-meta {
  margin: 0.25rem 0;
  font-size: 0.86rem;
  color: #475569;
}

/* Smaller variant if you render ONLY repertory panel */
.hp-sf-repertory-only .hp-sf-rep-panel {
  margin-top: 0;
}

/* =========================================================
 * Repertory Single Page (/repertory/section/slug/)
 * Used by templates/repertory-single.php
 * ======================================================= */

.hp-sf-rep-single {
  max-width: 920px;
  margin: 1.25rem auto;
  padding: 0 0.75rem;
}

.hp-sf-rep-article {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 1.1rem 1.2rem 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.hp-sf-rep-header {
  margin-bottom: 0.9rem;
}

/* Breadcrumb */
.hp-sf-rep-breadcrumb {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.hp-sf-rep-breadcrumb a {
  color: #64748b;
}
.hp-sf-rep-breadcrumb a:hover {
  color: #0ea5e9;
}

.hp-sf-rep-bc-sep {
  margin: 0 0.25rem;
  color: #cbd5f5;
}
.hp-sf-rep-bc-current {
  color: #0f172a;
}

/* Title */
.hp-sf-rep-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
}

.hp-sf-rep-title-section {
  font-size: 0.92rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hp-sf-rep-title-rubric {
  font-weight: 700;
}

.hp-sf-rep-meta-line {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

/* Body blocks */

.hp-sf-rep-body {
  margin-top: 0.7rem;
}

.hp-sf-rep-block {
  margin: 0.55rem 0;
}

.hp-sf-rep-block h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
}

.hp-sf-rep-block-main .hp-sf-rep-text {
  font-size: 0.96rem;
  color: #111827;
}

.hp-sf-rep-block-remedies .hp-sf-rep-remedies-line {
  font-size: 0.94rem;
  margin: 0.15rem 0 0.35rem;
}

.hp-sf-rep-remedies-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  color: #111827;
}
.hp-sf-rep-remedies-list li {
  margin: 0.1rem 0;
}

.hp-sf-rep-block-notes .hp-sf-rep-notes {
  font-size: 0.9rem;
  color: #4b5563;
}

.hp-sf-rep-block-about p {
  font-size: 0.9rem;
  color: #4b5563;
}

/* =========================================================
 * Responsive tweaks
 * ======================================================= */

@media (max-width: 720px) {
  .hp-sf-form {
    grid-template-columns: 1fr;
  }
  .hp-sf-form > div {
    display: flex;
    gap: 0.5rem;
  }
  .hp-sf-btn,
  .hp-sf-clear {
    flex: 1;
    justify-content: center;
  }
  .hp-sf-rep-single {
    padding: 0 0.5rem;
  }
}

@media (max-width: 480px) {
  .hp-sf-card {
    padding: 0.8rem 0.85rem;
  }
  .hp-sf-rep-article {
    padding: 0.9rem 0.85rem 1.2rem;
  }
  .hp-sf-group label {
    font-size: 0.82rem;
  }
  .hp-sf-rubric-pill {
    font-size: 0.78rem;
  }
}
