/*
 * Add-listing form field visibility overrides.
 *
 * .wdm-hide         — applied via GD Custom Fields → CSS Class setting.
 * data-argument     — used for fields with no CSS Class setting
 *                     (address sub-fields: latitude, longitude, default_category).
 */

/*
 * Move field descriptions above inputs.
 * GD renders <small class="form-text"> after the input inside .col-sm-10.
 * Flex column + order: -1 floats it to the top without touching markup.
 */
#geodirectory-add-post .col-sm-10:has(small.form-text) {
	display: flex;
	flex-direction: column;
}

#geodirectory-add-post .col-sm-10 small.form-text {
	order: -1;
	margin-bottom: 0.25rem;
}

/*
 * GD image meta modals (photo/logo/banner pencil-icon popups) must sit above
 * the Bootstrap backdrop. Divi or other plugins can reset Bootstrap z-index
 * values, causing the backdrop to intercept all clicks and freeze the screen.
 * JS (listing-form.js) also removes the backdrop node on insertion as a belt-
 * and-suspenders fix.
 */
div[id^="gd_image_meta_"].modal.bsui {
	z-index: 1056 !important;
}

/*
 * When advanced search filters are present, GD renders a second Search button
 * inside the main bar (.geodir-search) in addition to the one inside
 * .geodir-advance-search. Hide the redundant one in the main bar only.
 */
.geodir-search>.geodir-filter-container~.gd-search-field-search button,
.geodir-search .gd-search-field-search:not(.geodir-advance-search .gd-search-field-search) button {
	display: none !important;
}

/*
 * Tab navigation dropdown on single listing page — fix right-align overflow
 * on mobile (Bootstrap expand breakpoint resets dropdown-menu-end).
 */
.bsui .navbar-expand .dropdown:hover>.dropdown-menu {
	right: auto;
}

/*
 * GD file upload — constrain action icon row height and centre icons.
 */
.gd-thumb-actions {
	height: 30px !important;
	align-items: center;
}

/*
 * GD file upload — uploaded file thumbnails full-width on mobile.
 */
@media (max-width: 768px) {
	.plupload-thumbs.row-cols-3>* {
		width: 100% !important;
	}
}

/*
 * Listing detail feature rows: Address and Availability values render on a new
 * line below their label instead of inline.
 *
 * Address: targeted via [itemprop] spans GD outputs for schema markup.
 * Availability: targeted via .wdm-gd-cat-value marker span injected by
 *   strip_category_term_links() PHP filter — no manual field config needed.
 */
.geodir-feature-wrapper .geodir-feature-value [itemprop="streetAddress"],
.bsui .geodir-feature-wrapper:has(.wdm-gd-cat-value) .geodir-feature-value {
	display: block !important;
}

.geodir-feature-wrapper .geodir-feature-value [itemprop="streetAddress"] {
	word-break: break-word;
	overflow-wrap: break-word;
}

/* The <br> immediately after the block-displayed streetAddress span creates a double
   gap (block break + br break). Suppress it — the block itself is the line separator. */
.geodir-feature-value [itemprop="streetAddress"]+br {
	display: none;
}

/*
 * Listing detail feature rows: when a field value is a single-item list,
 * collapse the <ul> inline beside the label instead of rendering a block list.
 * Multiple <li> items keep default stacked list rendering.
 */
.geodir-feature-value ul:has(li:only-child),
.geodir-feature-value ul:has(li:only-child) li {
	display: inline;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Exception: fields marked wdm-value-always-block always render the list below the label. */
.wdm-value-always-block .geodir-feature-value ul:has(li:only-child),
.wdm-value-always-block .geodir-feature-value ul:has(li:only-child) li {
	display: revert;
}

/*
 * "Save and Continue Later" button — sits after the submit button in the GD submit row.
 */
#wdm-save-draft-btn {
	margin-left: 5px;
}

/*
 * Hidden form fields — removed from layout entirely.
 * #geodir_address_map_row (the map canvas) is intentionally NOT hidden here.
 * GD geocodes the address on the visible Leaflet map and records the current
 * zoom as address_mapview. When the map is display:none the map initialises at
 * zoom 1, so the saved mapview drives a zoomed-out single-listing map. Users
 * also need the map to confirm the pin location and correct browser-geolocation
 * errors (browser IP-geolocation can place the pin far from the actual address).
 * The raw lat/lon/mapview numeric input containers are still hidden.
 */
.wdm-hide,
div.mb-3[data-argument="address_latitude"],
div.mb-3[data-argument="address_longitude"],
div.mb-3[data-argument="address_mapview"],
div.mb-3[data-argument="default_category"] {
	display: none;
}

/*
 * "Apply Now" / "Contact Us" CTA buttons injected at bottom of How to Apply tab.
 */
.wdm-apply-cta {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid #dee2e6;
}

/* Hiding registration link from pop-ups */
.uwp-footer-links .uwp-register-link {
	visibility: collapse;
}

/*
 * Advanced search — "Clear All" reset button sits next to the Search button.
 */
.wdm-search-reset.btn.btn-outline-primary {
	white-space: nowrap;
	margin-top: 10px;
}

/*
 * Search button — show the visually-hidden "Search" label text alongside
 * the magnifying-glass icon. Bootstrap's .visually-hidden hides it by default.
 */
.geodir_submit_search span.visually-hidden {
	position: static !important;
	width: auto !important;
	height: auto !important;
	padding: 0 !important;
	margin: 0 0 0 0.4em !important;
	overflow: visible !important;
	clip: auto !important;
	white-space: normal !important;
	border: 0 !important;
}

/*
 * Draft listing preview banner — fixed top bar shown to the listing author
 * when viewing their own unpublished listing.
 */
#wdm-draft-preview-banner {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 99999;
	background: #2271b1;
	color: #fff;
	padding: 0.6rem 1rem;
	text-align: center;
	font-size: 0.95rem;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

#wdm-draft-preview-banner a {
	color: #fff;
	font-weight: 600;
	text-decoration: underline;
}

/*
 * Registration success toast — fixed bottom-right notification shown
 * on first landing on the listing form after account creation.
 */
#wdm-registered-toast {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	z-index: 99999;
	background: #00a32a;
	color: #fff;
	padding: 1rem 1.25rem;
	border-radius: 6px;
	font-size: 0.95rem;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
	max-width: 320px;
	animation: wdm-toast-in 0.3s ease;
}

@keyframes wdm-toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}
