/*
 * Locations finder (design: pages/about/locations.html, section 02 "The locator"), built with WP Grid Builder.
 * The theme already provides .g-locator / .g-locator__results / .g-locator__map (two halves, sticky map),
 * .g-form--light and the card classes. This file only adapts WP Grid Builder's own markup to them.
 * WPGB class names: check in the browser inspector after building, and adjust if your version differs.
 */

/* Elementor containers carrying the design classes: no inner padding/width limits from Elementor. */
.e-con.g-locator { --padding-top: 0px; --padding-bottom: 0px; --padding-left: 0px; --padding-right: 0px; --gap: 0px; }
.e-con.g-locator > .e-con-inner { display: contents; }

/* Map column: full viewport height, sticky beside the results (theme rule), map fills it. */
.g-locator__map { position: sticky; top: 0; height: 100vh; height: 100svh; }
.g-locator__map .elementor-widget,
.g-locator__map .elementor-widget-container,
.g-locator__map .wpgb-facet,
.g-locator__map .wpgb-map-facet,
.g-locator__map .wpgb-map { height: 100%; margin: 0; }
.g-locator__map .wpgb-facet fieldset { margin: 0; height: 100%; }
@media (max-width: 1024px) {
	.g-locator__map { position: static; height: 360px; order: -1; }
}

/*
 * Filter panel (design: form.g-form.g-form--light). Facets sit in an Elementor container with
 * "g-form g-form--light". Rows: Your location | Search radius / Category | Region / Search (full width).
 * WP Grid Builder's own facet CSS loads after this file, hence the long selectors and a few !important.
 */
.e-con.g-form:has(.wpgb-facet) {
	display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md);
	--padding-top: var(--space-lg); --padding-bottom: var(--space-lg); --padding-left: var(--space-lg); --padding-right: var(--space-lg);
}
.e-con.g-form:has(.wpgb-facet) > .elementor-element { width: auto; max-width: none; margin: 0; min-width: 0; }
.e-con.g-form:has(.wpgb-facet) > .elementor-element:has(.wpgb-geolocation-facet),
.g-form--light .g-field--full { grid-column: 1 / -1; }
/*
 * Buttons (design: .g-field--full > .g-btn.g-btn--navy): own row, as wide as their text, left-aligned.
 * Search + Reset side by side: put both facet widgets in one container with the class "gl-form-actions".
 */
.e-con.g-form:has(.wpgb-facet) > .elementor-element:has(.wpgb-button) { grid-column: 1 / -1; justify-self: start; width: auto; }
.e-con.g-form:has(.wpgb-facet) .gl-form-actions {
	grid-column: 1 / -1; display: flex !important; flex-flow: row wrap; align-items: center; gap: var(--space-sm);
	--padding-top: 0px; --padding-bottom: 0px; --padding-left: 0px; --padding-right: 0px;
}
.e-con.g-form:has(.wpgb-facet) .gl-form-actions > .elementor-element { width: auto; margin: 0; }
.g-form.g-form--light .wpgb-facet { margin: 0; }
.g-form.g-form--light .wpgb-facet fieldset,
.g-form.g-form--light .wpgb-facet fieldset:last-child { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Labels (= the design's .g-field label). */
.g-form.g-form--light .wpgb-facet .wpgb-facet-title:not(.wpgb-sr-only),
.g-form.g-form--light .gl-radius-label {
	display: block; margin: 0 0 6px; padding: 0; font-family: var(--font-body); line-height: var(--leading-snug);
	font-weight: var(--weight-medium); font-size: var(--type-body-sm); color: var(--clr-heading); letter-spacing: 0; text-transform: none;
}
.g-form--light .g-req { color: var(--clr-2-orange); }

/* Fields (= the design's .g-field input / select): white, 14px padding, hairline border, small radius. */
.g-form.g-form--light .wpgb-facet .wpgb-input,
.g-form.g-form--light .wpgb-facet select.wpgb-select,
.g-form.g-form--light .wpgb-facet select.gl-radius {
	display: block; box-sizing: border-box !important; width: 100% !important; max-width: 100%; height: auto !important; min-height: 0; margin: 0;
	padding: 14px !important; text-indent: 0 !important; border: 1px solid var(--clr-hairline) !important; border-radius: var(--radius-sm) !important;
	background-color: var(--clr-white) !important; color: var(--clr-heading); box-shadow: none !important;
	font-family: var(--font-body); font-size: var(--type-body); line-height: var(--leading-snug);
}
.g-form.g-form--light .wpgb-facet select.wpgb-select,
.g-form.g-form--light .wpgb-facet select.gl-radius {
	padding-right: 44px !important; cursor: pointer; appearance: none; -webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23002855' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 18px !important;
}
.g-form.g-form--light .wpgb-select-controls { display: none; } /* WPGB's own arrow; the select draws one */
.g-form.g-form--light .wpgb-select-facet,
.g-form.g-form--light .wpgb-select-facet label { position: relative; display: block; width: 100%; max-width: 100%; margin: 0; }
.g-form.g-form--light .wpgb-facet .wpgb-input:focus,
.g-form.g-form--light .wpgb-facet select:focus {
	outline: none; border-color: var(--clr-green) !important; box-shadow: 0 0 0 3px rgba(51, 119, 97, .20) !important;
}

/* Your location + Search radius: one WPGB facet, laid out as the design's two fields side by side. */
.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) {
	display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-md); align-items: start;
}
.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) > .wpgb-facet-title { grid-column: 1; grid-row: 1; }
.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) fieldset,
.g-form.g-form--light .wpgb-geolocation-facet { display: contents; }
.g-form.g-form--light .wpgb-geolocation-input { grid-column: 1; grid-row: 2; position: relative; margin: 0; }
.g-form.g-form--light .wpgb-geolocation-input label { display: block; margin: 0; }
.g-form.g-form--light .wpgb-geolocation-input .wpgb-input-icon { display: none; } /* no search icon in the design */
.g-form.g-form--light .wpgb-geolocation-input { padding: 0 !important; border: 0 !important; background: none !important; }
.g-form.g-form--light .wpgb-geolocation-facet .wpgb-geolocation-input input.wpgb-input {
	padding: 14px 48px 14px 14px !important; padding-inline: 14px 48px !important; text-indent: 0 !important;
}
.g-form.g-form--light .wpgb-locate-button {
	position: absolute; top: 50%; right: 12px; transform: translateY(-50%); padding: 4px; border: 0; background: none; color: var(--clr-2-gray);
}
.g-form.g-form--light .wpgb-geo-radius {
	grid-column: 2; grid-row: 1 / span 2; display: block; margin: 0;
	font-size: 0; line-height: 0; /* hides "Show results within … mi" if WPGB re-renders it */
}
.g-form.g-form--light .wpgb-geo-radius .gl-radius-label { line-height: var(--leading-snug); }
.g-form.g-form--light .wpgb-geo-radius .gl-radius-label { font-size: var(--type-body-sm); }
.g-form.g-form--light .wpgb-geo-radius select.gl-radius { font-size: var(--type-body); line-height: var(--leading-snug); }
.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) .gl-req-msg { grid-column: 1; grid-row: 3; }

/* Required "Your location": message when Search is pressed with it empty (wpgb.php). */
.g-form--light .wpgb-facet .wpgb-input.gl-invalid { border-color: #C8102E !important; box-shadow: 0 0 0 3px rgba(200, 16, 46, .15) !important; }
.g-form--light .gl-req-msg { margin: 6px 0 0; font-size: var(--type-body-sm); color: #C8102E; }

/* Search (WPGB Apply facet) = the design's full-width .g-btn--navy. */
.g-form.g-form--light .wpgb-facet .wpgb-button,
.g-form.g-form--light .wpgb-facet button[type="submit"] {
	display: inline-flex; align-items: center; justify-content: center; width: auto !important; margin: 0;
	padding: 16px 20px !important; border: 0 !important; border-radius: var(--radius-sm) !important; white-space: nowrap;
	background: var(--clr-navy) !important; color: var(--clr-white) !important; box-shadow: none !important;
	font-family: var(--font-body); font-size: var(--type-button); font-weight: var(--weight-medium); line-height: var(--leading-normal); cursor: pointer; opacity: 1;
	transition: background var(--dur-fast, .15s);
}
.g-form.g-form--light .wpgb-facet .wpgb-button:hover,
.g-form.g-form--light .wpgb-facet button[type="submit"]:hover { background: var(--clr-navy-hover, #001a3a) !important; }
.g-form.g-form--light .wpgb-facet .wpgb-button:disabled { opacity: .85; cursor: default; }
/* Reset = the design's outline button (navy border and text on the grey panel). */
.g-form.g-form--light .wpgb-facet .wpgb-button.wpgb-reset {
	background: transparent !important; color: var(--clr-navy) !important; box-shadow: inset 0 0 0 1px var(--clr-navy) !important;
}
.g-form.g-form--light .wpgb-facet .wpgb-button.wpgb-reset:hover { background: var(--clr-navy) !important; color: var(--clr-white) !important; }

@media (max-width: 768px) {
	.e-con.g-form:has(.wpgb-facet),
	.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) { grid-template-columns: 1fr; }
	.e-con.g-form:has(.wpgb-facet) > .elementor-element { grid-column: 1 / -1; }
	.g-form.g-form--light .wpgb-geo-radius { grid-column: 1; grid-row: 3; margin-top: var(--space-md); }
	.g-form.g-form--light .wpgb-facet:has(.wpgb-geolocation-facet) .gl-req-msg { grid-row: 4; }
}

/* Result count ("235 facilities") above the filters. */
.g-locator .wpgb-result-count { font-size: var(--type-body-sm); color: var(--clr-2-gray); }

/* Cards: the WPGB card becomes the design's grey .g-xcard--fill card. */
.g-locator .wpgb-card .wpgb-card-inner,
.g-locator .wpgb-card .wpgb-card-body {
	height: 100%;
}
.g-locator .wpgb-card .wpgb-card-inner {
	display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md);
	background: var(--clr-background); border: 1px solid var(--clr-hairline-strong); border-radius: var(--radius-lg);
	transition: background var(--dur-base), border-color var(--dur-base);
}
.g-locator .wpgb-card:hover .wpgb-card-inner { background: var(--clr-white); }
.g-locator .wpgb-card .wpgb-card-body { display: flex; flex-direction: column; gap: var(--space-sm); padding: 0; }
.g-locator .wpgb-card h3,
.g-locator .wpgb-card .wpgb-block-title {
	margin: 0; font-size: var(--type-h4); font-weight: var(--weight-medium); color: var(--clr-heading);
}
.g-locator .wpgb-card .g-fcard__type {
	margin: 0; font-family: var(--font-condensed); font-size: var(--type-label);
	letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--clr-2-gray);
}
.g-locator .wpgb-card .g-addr { margin: 0; font-style: normal; font-size: var(--type-body-sm); color: var(--clr-body); }
.g-locator .wpgb-card .g-fcard__tags { margin: 0; font-size: var(--type-body-sm); color: var(--clr-2-gray); }
.g-locator .wpgb-card .g-arrow { margin-top: auto; font-size: var(--type-body-sm); gap: 8px; }
.g-locator .wpgb-card .g-arrow svg { width: 14px; height: 14px; }

/* Map marker popup: same card content, compact. */
.wpgb-map-popup .g-fcard__type { margin: 0 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--clr-2-gray); }
.wpgb-map-popup .g-addr { font-style: normal; font-size: 13px; }

/* Card <-> map pin (wpgb.php, #gl-map-hover): hovering a card lifts its pin, hovering a pin highlights its card. */
.wpgb-map-facet .wpgb-marker-icon,
.wpgb-map-facet .wpgb-marker svg,
.wpgb-map-facet .wpgb-marker img { transition: transform .2s var(--ease-out, ease-out), filter .2s; transform-origin: 50% 100%; }
.wpgb-map-facet .gl-marker-active .wpgb-marker-icon,
.wpgb-map-facet .gl-marker-active svg,
.wpgb-map-facet .gl-marker-active img {
	transform: scale(1.35) translateY(-2px); filter: drop-shadow(0 4px 6px rgba(0, 40, 85, .35));
}
.g-locator .e-loop-item.gl-card-active .g-xcard,
.g-locator .e-loop-item.gl-card-active > .e-con {
	background: var(--clr-white); border-color: var(--clr-green);
}
