/*
 * GravityView overrides — pagination, widget wrappers, map, misc.
 * Main layout + search bar + cards are handled by PHP templates.
 */

/* ── Strip GV grid wrapper around search widget ──────────────── */
.gv-widgets-header,
.gv-widgets-footer {
	display: block;
	padding: 0;
	margin: 0;
	width: 100%;
}

/* ── Search bar: compact horizontal layout ──────────────────── */
/* GravityView wraps fields in .gv-grid-row > .gv-grid-col > .gv-search-widget-area
   (a vertical column by default). Neutralise those wrappers and lay the fields
   out on one flexible row. */
.spdir-search,
.spdir-search > .gv-grid-row,
.spdir-search > .gv-grid-row > [class*="gv-grid-col"] {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
}

.spdir-search .gv-search-widget-area {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 10px;
}

.spdir-search__field {
	flex: 1 1 160px;
}

/* GravityView core gives every .gv-search-box `flex: 1 1 10em`, so each pill
   wrapper grew to fill the row and the pills drifted apart. They size to their
   content instead; the .gv-search-widget-area gap does the spacing. */
.spdir-search .spdir-pill-field {
	flex: 0 0 auto;
}

/* Visual order regardless of stored field order:
   Location & Radius  →  subtype pills  →  Search button */
.spdir-search .gk-search-geolocation-field { order: 1; }
.spdir-search .spdir-pill-field            { order: 2; }
.spdir-search .spdir-search__submit        { order: 3; margin-left: auto; }

/* ── Geolocation radius field (inline, matches the bar) ──────── */
.gk-search-geolocation-field {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 300px;
	min-width: 240px;
}

/* Collapse GravityView grid columns into inline pieces */
.gk-search-geolocation-field .gv-grid-col-1-1 {
	width: auto;
	padding: 0;
	margin: 0;
}

/* Hide the redundant "Location & Radius" label — the placeholder is clear */
.gk-search-geolocation-field .gv-grid-col-1-1:has(> label) {
	display: none;
}

/* Address input grows to fill remaining space */
.gk-search-geolocation-field .gv-grid-col-1-1:has(.gk-maps-search-geolocation-address-autocomplete-container) {
	flex: 1 1 auto;
	min-width: 0;
}

.gk-maps-search-geolocation-address-autocomplete-container {
	display: flex;
	align-items: center;
	gap: 6px;
}

.gk-maps-search-geolocation-address-autocomplete {
	width: 100%;
	min-width: 0;
	height: 44px;
	border: 1.5px solid rgba(255,255,255,.25);
	border-radius: var(--radius-md);
	background: #fff;
	color: var(--color-text);
	font-size: 14px;
	padding: 0 12px;
	outline: none;
}

.gk-maps-search-current-geolocation {
	flex-shrink: 0;
	width: 42px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid rgba(255,255,255,.25);
	border-radius: var(--radius-md);
	background: rgba(255,255,255,.12);
	color: #fff;
	cursor: pointer;
	transition: background .15s;
}
.gk-maps-search-current-geolocation:hover { background: rgba(255,255,255,.22); }
.gk-maps-search-current-geolocation svg { width: 18px; height: 18px; }

.gk-maps-search-current-geolocation-radius,
.gk-maps-search-current-geolocation-unit {
	height: 44px;
	border: 1.5px solid rgba(255,255,255,.25);
	border-radius: var(--radius-md);
	background: #fff;
	color: var(--color-text);
	font-size: 14px;
	padding: 0 10px;
	cursor: pointer;
	outline: none;
	flex-shrink: 0;
}

/* ── Sticky offset coupled to real search-bar height (set via JS) ─ */
.spdir-layout {
	min-height: calc(100vh - var(--spdir-header-h, 80px));
}
.spdir-panel--list {
	top: var(--spdir-header-h, 80px);
	max-height: calc(100vh - var(--spdir-header-h, 80px));
}
.spdir-panel--map {
	top: var(--spdir-header-h, 80px);
	height: calc(100vh - var(--spdir-header-h, 80px));
}

.spdir-pill-field {
	display: flex;
	align-items: center;
}

.spdir-pill-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

/* One look for every filter pill: the subtype/rare toggles on both Views and
   the capability checkboxes on the list View. Kept in a single rule so the two
   can't drift apart — .spdir-checkpill adds only its checkbox-specific bits,
   in directory-filters.css. */
.spdir-pill,
.spdir-checkpill {
	display: inline-flex;
	align-items: center;
	height: 30px;
	padding: 0 13px;
	border-radius: 20px;
	border: 1.5px solid rgba(255,255,255,.28);
	background: rgba(255,255,255,.08);
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	user-select: none;
	transition: background .15s, border-color .15s, color .15s;
}

.spdir-pill:hover,
.spdir-checkpill:hover {
	background: rgba(255,255,255,.18);
	border-color: rgba(255,255,255,.5);
	color: #fff;
}

.spdir-pill--active,
.spdir-pill-checkbox:checked + .spdir-pill,
.spdir-checkpill:has(input:checked) {
	background: #fff;
	border-color: #fff;
	color: var(--color-primary);
	font-weight: 600;
}

/* Submit area */
.spdir-search__submit {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.spdir-search__clear {
	font-size: 13px;
	color: rgba(255,255,255,.75);
	text-decoration: none;
	white-space: nowrap;
}
.spdir-search__clear:hover {
	color: #fff;
	text-decoration: underline;
}

/* ── Card inner link (full-card clickable) ───────────────────── */
.spdir-card__inner-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

/* ── Rare-subtypes count tag (amber, distinct from subtype tags) ─ */
.spdir-tag--rare {
	background: #fef3c7;
	color: #92610a;
}
[data-theme="dark"] .spdir-tag--rare {
	background: #3f2d0a;
	color: #fbbf24;
}

/* ── Pagination widget ───────────────────────────────────────── */
/* The Page Links widget renders:
     nav.gv-widget-page-links > ul.page-numbers > li > a.page-numbers
   with the active page as span.page-numbers.current, the arrows as
   a.page-numbers.prev / .next, and any gap as span.page-numbers.dots.
   gv-default-styles.css sets display/padding via
   `body .gv-widget-page-links li .page-numbers`, so the rules below qualify
   the element (a./span.) to outrank it on specificity. That is no longer
   strictly required — the theme's directory CSS now loads after GravityView's
   (see the enqueue in functions.php) — but the qualification is kept so these
   rules do not depend on load order at all. */

/* Unwrap the footer grid so the nav spans the results column. */
.gv-widgets-footer > .gv-grid-row,
.gv-widgets-footer > .gv-grid-row > [class*="gv-grid-col"] {
	display: block;
	float: none;
	width: 100%;
	margin: 0;
	padding: 0;
}

.gv-widget-page-links,
.gv-widget-page_info,
.gv-widget-pagination {
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	border-top: 1px solid var(--color-border);
	background: var(--color-card);
}

body .gv-widget-page-links ul.page-numbers {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body .gv-widget-page-links li a.page-numbers,
body .gv-widget-page-links li span.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	color: var(--color-text);
	background: var(--color-card);
	transition: background .12s, border-color .12s;
}

body .gv-widget-page-links li a.page-numbers:hover {
	background: var(--color-primary-light);
	border-color: var(--color-primary-mid);
	color: var(--color-primary);
}

body .gv-widget-page-links li span.page-numbers.current {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #fff;
	cursor: default;
}

body .gv-widget-page-links li a.page-numbers.prev,
body .gv-widget-page-links li a.page-numbers.next {
	color: var(--color-text-muted);
}

body .gv-widget-page-links li span.page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

.gv-widget-page_info {
	font-size: 13px;
	color: var(--color-text-muted);
}

/* ── GravityMaps canvas in map panel ─────────────────────────── */
/* Canvas classes emitted by GravityView Maps: .gv-map-canvas (legacy) + .gk-map-canvas */
#spdir-map .gv-map-canvas,
#spdir-map .gk-map-canvas {
	width: 100% !important;
	height: 100% !important;
	min-height: 400px;
}

/* Single-entry map canvas on the detail page */
.spdir-detail__map-placeholder .gv-map-canvas,
.spdir-detail__map-placeholder .gk-map-canvas {
	width: 100% !important;
	height: 100% !important;
	min-height: 280px;
}

/* ── Detail page ─────────────────────────────────────────────── */
.spdir-detail {
	max-width: 900px;
	margin: 0 auto;
	padding: 0 24px 60px;
}

.spdir-detail__back {
	padding: 20px 0 8px;
}

.spdir-back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	color: var(--color-text-muted);
	text-decoration: none;
	transition: color .12s;
}
.spdir-back-link:hover { color: var(--color-primary); }

.spdir-detail__hero {
	background: var(--color-primary);
	border-radius: var(--radius-lg);
	padding: 32px;
	margin: 12px 0 32px;
	color: #fff;
}

.spdir-detail__hero-inner {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
}

.spdir-detail__name {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.25;
	margin-bottom: 6px;
	color: #fff;
}

.spdir-detail__institution {
	font-size: 16px;
	color: rgba(255,255,255,.8);
}

.spdir-detail__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.spdir-detail__body {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 32px;
}

@media (max-width: 720px) {
	.spdir-detail__body { grid-template-columns: 1fr; }
}

.spdir-detail__section {
	margin-bottom: 32px;
}

.spdir-detail__section-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--color-border);
}

.spdir-detail__contact-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.spdir-detail__contact-item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	font-size: 15px;
	color: var(--color-text);
}

.spdir-detail__contact-item svg {
	flex-shrink: 0;
	margin-top: 2px;
	color: var(--color-primary);
}

.spdir-detail__contact-item a {
	color: var(--color-primary);
	text-decoration: none;
}
.spdir-detail__contact-item a:hover { text-decoration: underline; }

.spdir-detail__contact-person {
	padding: 16px;
	background: var(--color-primary-light);
	border-radius: var(--radius-md);
	border-left: 4px solid var(--color-primary);
}

.spdir-detail__contact-name {
	font-size: 15px;
	font-weight: 600;
	color: var(--color-text);
}

.spdir-detail__contact-role {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-top: 2px;
}

.spdir-detail__map-placeholder {
	height: 280px;
	background: var(--color-bg);
	border-radius: var(--radius-md);
	border: 1px solid var(--color-border);
	overflow: hidden;
}

/* ── Detail: capability lists (team / diagnostics / treatments) ─ */
.spdir-detail__caps {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.spdir-detail__cap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 14px;
	padding: 9px 0;
	border-bottom: 1px solid var(--color-border);
}
.spdir-detail__cap:last-child { border-bottom: none; }

.spdir-detail__cap-label { color: var(--color-text); }

.spdir-detail__status {
	font-size: 12px;
	font-weight: 600;
	padding: 3px 11px;
	border-radius: 999px;
	white-space: nowrap;
	flex-shrink: 0;
}
.spdir-detail__status--yes     { background: var(--tag-teal-bg); color: var(--tag-teal-text); }
.spdir-detail__status--ref     { background: #fef3c7; color: #92610a; }
.spdir-detail__status--no      { background: var(--tag-gray-bg); color: var(--tag-gray-text); }
.spdir-detail__status--neutral { background: var(--color-primary-light); color: var(--color-primary); }

/* ── Detail: extra blocks (partner labs, tags, free text) ────── */
.spdir-detail__extra { margin-top: 16px; }

.spdir-detail__extra-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	margin-bottom: 7px;
}

.spdir-detail__tag-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.spdir-detail__extra .spdir-detail__prose { font-size: 14px; }
.spdir-detail__extra .spdir-detail__prose p { margin: 0 0 8px; }

/* ── Detail: ISA disclaimer ──────────────────────────────────── */
.spdir-detail__disclaimer {
	margin-top: 28px;
	padding: 16px 18px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	font-size: 13px;
	line-height: 1.55;
	color: var(--color-text-muted);
}

.spdir-detail__updated {
	margin-top: 14px;
	font-size: 13px;
	color: var(--color-text-muted);
	text-align: center;
}

/* Dark theme: keep the "referral" badge readable */
[data-theme="dark"] .spdir-detail__status--ref { background: #3f2d0a; color: #fbbf24; }


