/* ── SHV AI Search Widget ─────────────────────────────────────────────────── */

.shv-ai-search-wrapper {
  position: relative;
  width: 100%;
}

/* Results panel */
.shv-ai-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.14);
  z-index: 9999;
  overflow: hidden;
  animation: shv-fadeSlide 0.18s ease;
  max-height: 480px;
  overflow-y: auto;
}

.shv-ai-results.is-open {
  display: block;
}

@keyframes shv-fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Loading state */
.shv-ai-loading {
  display: none;
  padding: 20px 24px;
  color: #666;
  font-size: 14px;
  align-items: center;
  gap: 10px;
}
.shv-ai-loading.is-visible {
  display: flex;
}
.shv-ai-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e0e0e0;
  border-top-color: #5b2d8e;
  border-radius: 50%;
  animation: shv-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes shv-spin {
  to { transform: rotate(360deg); }
}

/* Disclaimer bar */
.shv-ai-disclaimer {
  background: #f8f4ff;
  border-bottom: 1px solid #e8dcff;
  padding: 10px 16px;
  font-size: 12px;
  color: #5b2d8e;
  display: flex;
  align-items: center;
  gap: 6px;
}
.shv-ai-disclaimer svg {
  flex-shrink: 0;
}

/* Result items list */
.shv-ai-result-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.shv-ai-result-item {
  padding: 0;
}

.shv-ai-result-item a {
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  text-decoration: none;
  transition: background 0.12s ease;
  border-left: 3px solid transparent;
}
.shv-ai-result-item a:hover,
.shv-ai-result-item a:focus {
  background: #f8f4ff;
  border-left-color: #5b2d8e;
  outline: none;
}
.shv-ai-result-item a:focus-visible {
  outline: 2px solid #5b2d8e;
  outline-offset: -2px;
}

.shv-ai-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.shv-ai-result-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: #5b2d8e;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.6;
}

/* Type colour variants */
.shv-ai-result-type[data-type="Clinic"]               { background: #1a7a4a; }
.shv-ai-result-type[data-type="Professional Learning"] { background: #0066aa; }
.shv-ai-result-type[data-type="STI & BBV"]             { background: #c0392b; }
.shv-ai-result-type[data-type="News & Resources"]      { background: #e67e22; }
.shv-ai-result-type[data-type="Sexual Health Info"]    { background: #2980b9; }
.shv-ai-result-type[data-type="About SHV"]             { background: #6d4c8e; }
.shv-ai-result-type[data-type="Educators"]             { background: #27ae60; }

.shv-ai-result-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
}

.shv-ai-result-excerpt {
  font-size: 13px;
  color: #555;
  margin-top: 3px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Divider between items */
.shv-ai-result-item + .shv-ai-result-item {
  border-top: 1px solid #f0f0f0;
}

/* Fallback / message state */
.shv-ai-message {
  padding: 16px 20px;
  font-size: 14px;
  color: #444;
  line-height: 1.5;
}
.shv-ai-message a {
  color: #5b2d8e;
  font-weight: 600;
}

/* Footer */
.shv-ai-results-footer {
  border-top: 1px solid #f0f0f0;
  padding: 10px 20px;
  font-size: 12px;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shv-ai-results-footer a {
  color: #5b2d8e;
  text-decoration: none;
  font-weight: 500;
}
.shv-ai-results-footer a:hover {
  text-decoration: underline;
}

/* Keyboard hint */
.shv-ai-hint {
  font-size: 11px;
  color: #bbb;
}
.shv-ai-hint kbd {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-family: inherit;
}

/* Screen reader only */
.shv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .shv-ai-results {
    max-height: 70vh;
  }
}


/*Search page*/
/* search-page.css */

.shv-sp {
  --sp-accent: #0077b6;
  --sp-accent-light: #e8f4fd;
  --sp-col: #1a1a2e;
  --sp-muted: #6b7280;
  --sp-border: #e5e7eb;
  --sp-bg: #ffffff;
  --sp-radius: 12px;
  --sp-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --sp-shadow-hover: 0 4px 16px rgba(0,119,182,.13);
  --sp-ease: 180ms ease;
}

/* ── Meta ───────────────────────────────────────────────────────────────────── */
.shv-sp__meta {
  font-size: .9375rem;
  color: var(--sp-muted);
  margin-bottom: 1.5rem;
  min-height: 1.4em;
}

.shv-sp__meta em  { font-style: italic; color: var(--sp-col); font-weight: 600; }
.shv-sp__meta strong { color: var(--sp-col); }
.shv-sp__meta--fallback,
.shv-sp__meta--error { color: #b45309; }

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.shv-sp__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr));
  gap: 1rem;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.shv-sp__card {
  animation: sp-in .3s ease both;
}

@keyframes sp-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shv-sp__card-link {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  height: 100%;
  padding: 1.25rem 1.375rem;
  background: var(--sp-bg);
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  /*box-shadow: var(--sp-shadow);*/
  text-decoration: none;
  color: var(--sp-col);
  box-sizing: border-box;
  transition: border-color var(--sp-ease), box-shadow var(--sp-ease);
}

.shv-sp__card-link:hover {
  border-color: var(--sp-accent);
  box-shadow: var(--sp-shadow-hover);
}

.shv-sp__card-link:focus-visible {
  outline: 2.5px solid var(--sp-accent);
  outline-offset: 2px;
}

/* Badge */
.shv-sp__card-badge {
  display: inline-block;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .2em .65em;
  border-radius: 4px;
  align-self: flex-start;
}

.badge--health  { background: #dcfce7; color: #166534; }
.badge--sti     { background: #fef3c7; color: #92400e; }
.badge--clinic  { background: #dbeafe; color: #1e3a8a; }
.badge--pro     { background: #ede9fe; color: #4c1d95; }
.badge--news    { background: #f0f9ff; color: #0369a1; }
.badge--edu     { background: #fff7ed; color: #9a3412; }
.badge--about   { background: #f3f4f6; color: #374151; }
.badge--info    { background: #f0fdf4; color: #15803d; }

/* Title */
.shv-sp__card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  flex: 1;
}

/* Excerpt */
.shv-sp__card-excerpt {
  font-size: .875rem;
  line-height: 1.55;
  color: var(--sp-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CTA arrow */
.shv-sp__card-cta {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--sp-accent);
  margin-top: auto;
  padding-top: .25rem;
}

.shv-sp__card-cta svg { width: 14px; height: 14px; transition: transform var(--sp-ease); }
.shv-sp__card-link:hover .shv-sp__card-cta svg { transform: translateX(3px); }

/* ── Fallback list ───────────────────────────────────────────────────────────── */
.shv-sp__fallback-list {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  max-width: 480px;
}

.shv-sp__fallback-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1rem;
  border: 1.5px solid var(--sp-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--sp-col);
  font-weight: 600;
  font-size: .9375rem;
  transition: border-color var(--sp-ease), background var(--sp-ease), color var(--sp-ease);
}

.shv-sp__fallback-link:hover {
  border-color: var(--sp-accent);
  background: var(--sp-accent-light);
  color: var(--sp-accent);
}

.shv-sp__fallback-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Skeletons ──────────────────────────────────────────────────────────────── */
.shv-sp__skeletons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.shv-sp__skeleton {
  padding: 1.25rem 1.375rem;
  background: var(--sp-bg);
  border: 1.5px solid var(--sp-border);
  border-radius: var(--sp-radius);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.shv-sp__sk-badge,
.shv-sp__sk-title,
.shv-sp__sk-line {
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s infinite;
}

.shv-sp__sk-badge  { width: 72px;  height: 16px; }
.shv-sp__sk-title  { width: 80%;   height: 18px; }
.shv-sp__sk-line   { width: 100%;  height: 13px; }
.shv-sp__sk-line--short { width: 60%; }

@keyframes sk-shimmer {
  from { background-position:  200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Load more ──────────────────────────────────────────────────────────────── */
.shv-sp__more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.shv-sp__more {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.875rem;
  background: transparent;
  border: 1.5px solid var(--sp-accent);
  border-radius: var(--sp-radius);
  color: var(--sp-accent);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--sp-ease);
}

.shv-sp__more:hover { background: var(--sp-accent-light); }
.shv-sp__more svg   { width: 16px; height: 16px; transition: transform var(--sp-ease); }
.shv-sp__more:hover svg { transform: translateY(2px); }

[hidden]{
  display: none !important;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .shv-sp__grid,
  .shv-sp__skeletons { grid-template-columns: 1fr; }
}