/*--------------------------------------------------------------
Location field

v10: replaced the absolute-positioning + `!important` stack from
v5–v9 with the SAME technique the official HivePress Geolocation
plugin uses for its own Location field (verified against the real
hivepress-geolocation 1.3.10 source): a plain flexbox row. The input
gets `flex:1`, the icon gets a fixed flex-basis pulled over the
input's reserved padding with a negative margin. This is simpler,
matches a pattern that's been in production for years across many
HivePress sites, and — critically — never risks being positioned
relative to a taller block (like the map picker) the way `position:
absolute; top:50%` on a shared ancestor could.
--------------------------------------------------------------*/
.hp-field--location-osm {
	box-sizing: border-box;
}

.hp-field--location-osm * {
	box-sizing: border-box;
}

.hp-geolocation__row {
	display: flex;
	align-items: stretch;
	position: relative;
}

.hp-geolocation__row input[type="text"] {
	flex: 1;
	min-width: 0;
	padding-right: 3rem;
}

.hp-geolocation__row a.hp-geolocation__locate {
	flex: 0 0 3rem;
	margin-left: -3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	position: relative;
	z-index: 3;
}

.hp-geolocation__row a.hp-geolocation__locate .hp-icon {
	font-size: 0.95em;
}

/* Custom placeholder overlay: lets "Localisation" render in normal
   style while "(en minuscule)" renders italic and slightly smaller —
   something the native `::placeholder` pseudo-element can't do, since
   it only ever applies one single style to the whole string. Shown via
   pure CSS using `:placeholder-shown` (the real input's placeholder
   attribute is just a single space, only there to trigger this state)
   — never needs JS and can't get out of sync with the input's value. */
.hp-geolocation__placeholder {
	display: none;
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	max-width: calc(100% - 4rem);
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: #767676;
}

.hp-geolocation__row input[type="text"]:placeholder-shown ~ .hp-geolocation__placeholder {
	display: block;
}

/* White specifically on the search-bar instance of this field (the only
   one with its own placeholder text — "Localisation (en minuscule)" —
   identified directly in PHP, not guessed from a theme class name, so
   this can't accidentally also turn the add-listing form's grey hint
   white against its white background). */
.hp-geolocation__placeholder--search {
	color: #ffffff;
	opacity: 0.85;
}

.hp-geolocation__placeholder-main {
	font-style: normal;
}

.hp-geolocation__placeholder-hint {
	font-style: italic;
	font-size: 0.85em;
}

/*--------------------------------------------------------------
Suggestions / Benin city → quartier browse dropdown
--------------------------------------------------------------*/
.hp-geolocation__suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 1000;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
	background-color: #fff;
	border: 1px solid #d9d9d9;
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
	max-height: 300px;
	overflow-y: auto;
	overflow-x: hidden;
	box-sizing: border-box;
}

.hp-geolocation__item {
	margin: 0;
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.4;
	color: #333;
	cursor: pointer;
	border-top: 1px solid #f0f0f0;
	white-space: normal;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 40px;
}

.hp-geolocation__item:first-child {
	border-top: none;
}

.hp-geolocation__item:hover,
.hp-geolocation__item:active {
	background-color: #f5f5f5;
}

.hp-geolocation__item-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hp-geolocation__item-chevron {
	flex: none;
	color: #999;
	font-size: 15px;
}

.hp-geolocation__item--back {
	font-weight: 600;
	color: #555;
	background-color: #fafafa;
}

.hp-geolocation__item--whole {
	font-weight: 600;
	color: #1a1a1a;
}

.hp-geolocation__item--quartier {
	padding-left: 22px;
}

/*--------------------------------------------------------------
Draggable pin picker map
--------------------------------------------------------------*/
.hp-geolocation__picker {
	width: 100%;
	max-width: 100%;
	height: 220px;
	margin-top: 0.75rem;
	border-radius: 6px;
	overflow: hidden;
	box-sizing: border-box;
}

/*--------------------------------------------------------------
Listings / vendors / requests
--------------------------------------------------------------*/
.hp-listing__location,
.hp-vendor__location {
	display: flex;
	align-items: center;
	max-width: 100%;
}

.hp-listing__location i,
.hp-vendor__location i {
	margin-right: 0.5rem;
	flex: none;
}

.hp-listing__location a,
.hp-vendor__location a {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-decoration: none;
	color: inherit;
}

.hp-vendor__location:not(:last-child) {
	margin-bottom: 0.5rem;
}

/*--------------------------------------------------------------
Maps
--------------------------------------------------------------*/
.hp-map {
	z-index: 1;
	max-width: 100%;
}

.hp-map:not(:last-child) {
	margin-bottom: 2rem;
}

.leaflet-popup-content {
	min-width: 160px;
}

/*--------------------------------------------------------------
Mobile
--------------------------------------------------------------*/
@media (max-width: 600px) {

	/* Bigger, easier-to-tap rows for beginners on touch screens. */
	.hp-geolocation__item {
		padding: 12px;
		font-size: 14px;
		min-height: 44px;
	}

	.hp-geolocation__suggestions {
		max-height: 60vh;
		left: 0;
		right: 0;
		border-radius: 8px;
	}

	.hp-geolocation__row input[type="text"] {
		padding-right: 2.6rem;
	}

	.hp-geolocation__row a.hp-geolocation__locate {
		flex-basis: 2.6rem;
		margin-left: -2.6rem;
	}
}

/*--------------------------------------------------------------
Search bar hardening (glass-effect header search bars, etc.)
Any container wrapping the location field should never clip or force
overflow — these rules are intentionally generic/defensive so they help
regardless of the parent theme markup.
--------------------------------------------------------------*/
.hp-form .hp-field--location-osm,
.hp-search-form .hp-field--location-osm {
	min-width: 0;
}
