.gelife-ais {
	/* Easy to re-skin to your brand: only these variables need to change. */
	--gelife-ais-accent: #ffc629;
	--gelife-ais-accent-text: #24291f;
	--gelife-ais-accent-glow: rgba(255, 198, 41, 0.35);
	--gelife-ais-border: #e5e7eb;
	--gelife-ais-track: #f3f4f6;
	--gelife-ais-text: #1f2328;
	--gelife-ais-text-muted: #6b7280;
	--gelife-ais-radius: 999px;
	max-width: 900px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--gelife-ais-text);
	/* Some translations (e.g. Georgian, via TranslatePress) run noticeably
	   longer than the source text and can include long unbroken words —
	   without this, a flex child's default min-width:auto lets that text
	   force the whole bar wider than the screen on mobile. */
	overflow-wrap: break-word;
	word-break: break-word;
}

.gelife-ais, .gelife-ais * {
	min-width: 0;
	box-sizing: border-box;
}

.gelife-ais-bar {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

/* The rounded pill that groups the engine toggle + text input, matching
   the reference layout (search-type switch + input inside one border). */
.gelife-ais-pill {
	flex: 1 1 320px;
	display: flex;
	align-items: center;
	gap: 6px;
	background: #fff;
	border: 1.5px solid var(--gelife-ais-accent);
	border-radius: var(--gelife-ais-radius);
	padding: 6px;
	min-width: 0;
	transition: box-shadow 0.15s ease;
}

.gelife-ais-pill:focus-within {
	box-shadow: 0 0 0 3px var(--gelife-ais-accent-glow);
}

.gelife-ais-engine-toggle {
	display: flex;
	align-items: center;
	gap: 2px;
	background: var(--gelife-ais-track);
	border-radius: var(--gelife-ais-radius);
	padding: 3px;
	flex: none;
}

.gelife-ais-engine-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: none;
	background: transparent;
	color: var(--gelife-ais-text-muted);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	padding: 9px 14px;
	border-radius: var(--gelife-ais-radius);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.gelife-ais-engine-btn .gelife-ais-btn-icon {
	width: 15px;
	height: 15px;
	flex: none;
}

.gelife-ais-engine-btn.is-active {
	background: #fff;
	color: var(--gelife-ais-text);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.gelife-ais-engine-btn .gelife-ais-sparkle {
	color: #f59e0b;
}

.gelife-ais-engine-btn.is-active .gelife-ais-sparkle {
	color: #f59e0b;
}

.gelife-ais-beta {
	display: inline-block;
	background: #ff6b35;
	color: #fff;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.04em;
	line-height: 1;
	padding: 3px 5px;
	border-radius: 5px;
	transform: translateY(-1px);
}

.gelife-ais-input-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 100px;
}

.gelife-ais-input {
	width: 100%;
	border: none;
	outline: none;
	font-size: 15px;
	/* Right padding leaves room for the mic button even in browsers where
	   JS keeps it hidden (no Web Speech API support) — simpler and more
	   robust than conditioning it on a :has() selector, and the small gap
	   it leaves on the right there is harmless. */
	padding: 10px 34px 10px 10px;
	background: transparent;
	color: var(--gelife-ais-text);
}

.gelife-ais-input::placeholder {
	color: var(--gelife-ais-text-muted);
}

.gelife-ais-mic-btn {
	position: absolute;
	top: 50%;
	right: 4px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: none;
	background: transparent;
	color: var(--gelife-ais-text-muted);
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.gelife-ais-mic-btn:hover {
	background: var(--gelife-ais-track);
	color: var(--gelife-ais-text);
}

.gelife-ais-mic-icon {
	width: 18px;
	height: 18px;
}

/* Recording state — a plain color change plus a soft pulsing halo so
   it's obvious the mic is live without relying on color alone. */
.gelife-ais-mic-btn.is-listening {
	color: var(--gelife-ais-accent);
	animation: gelife-ais-mic-pulse 1.4s ease-in-out infinite;
}

@keyframes gelife-ais-mic-pulse {
	0%, 100% { box-shadow: 0 0 0 0 var(--gelife-ais-accent-glow); }
	50% { box-shadow: 0 0 0 8px transparent; }
}

.gelife-ais-suggestion-listening {
	display: flex;
	align-items: center;
	gap: 8px;
}

.gelife-ais-suggestion-listening .gelife-ais-mic-icon {
	flex: none;
	width: 16px;
	height: 16px;
	color: var(--gelife-ais-accent);
	animation: gelife-ais-mic-pulse 1.4s ease-in-out infinite;
}

/* Google-style live suggestions dropdown. */
.gelife-ais-suggestions {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--gelife-ais-border);
	border-radius: 14px;
	box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
	padding: 6px;
	max-height: 380px;
	overflow-y: auto;
	z-index: 40;
}

.gelife-ais-suggestion {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	text-align: left;
	padding: 8px 10px;
	border-radius: 10px;
	text-decoration: none;
	color: var(--gelife-ais-text);
	border: none;
	background: transparent;
	font-size: 14px;
	cursor: pointer;
}

.gelife-ais-suggestion:hover,
.gelife-ais-suggestion.is-active {
	background: var(--gelife-ais-track);
}

.gelife-ais-suggestion-thumb {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 8px;
	object-fit: cover;
	background: var(--gelife-ais-track);
}

.gelife-ais-suggestion-thumb-empty {
	display: block;
}

.gelife-ais-suggestion-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.gelife-ais-suggestion-title-row {
	display: flex;
	align-items: center;
	min-width: 0;
}

.gelife-ais-suggestion-title {
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gelife-ais-suggestion-meta {
	font-size: 12px;
	color: var(--gelife-ais-text-muted);
}

/* Badge for listings MyListing itself marks as featured/promoted
   (the same "_featured" priority used across Explore and the map) —
   these are also the ones this plugin's ranking already boosts to the
   top, this badge just makes that visible in the dropdown. */
.gelife-ais-suggestion-badge {
	display: inline-block;
	flex: none;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 5px;
	background: var(--gelife-ais-accent);
	color: var(--gelife-ais-accent-text);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	vertical-align: middle;
}

.gelife-ais-suggestion-empty {
	padding: 10px 12px;
	font-size: 13px;
	color: var(--gelife-ais-text-muted);
}

.gelife-ais-suggestion-all {
	margin-top: 2px;
	border-top: 1px solid var(--gelife-ais-border);
	font-weight: 600;
	color: var(--gelife-ais-text);
}

.gelife-ais-suggestion-icon {
	flex: none;
	width: 16px;
	height: 16px;
	color: var(--gelife-ais-text-muted);
}

.gelife-ais-filter-toggle {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 1px solid var(--gelife-ais-border);
	background: var(--gelife-ais-track);
	border-radius: 12px;
	color: var(--gelife-ais-text);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.gelife-ais-filter-toggle svg {
	width: 18px;
	height: 18px;
}

.gelife-ais-filter-toggle:hover,
.gelife-ais-filter-toggle.is-active {
	background: #e9eaec;
}

.gelife-ais-submit {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--gelife-ais-accent);
	color: var(--gelife-ais-accent-text);
	border: none;
	border-radius: var(--gelife-ais-radius);
	padding: 13px 26px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.gelife-ais-submit .gelife-ais-btn-icon {
	width: 16px;
	height: 16px;
}

.gelife-ais-submit:hover {
	filter: brightness(0.96);
}

.gelife-ais-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Filter panel (category / region selects), revealed by the slider icon. */
.gelife-ais-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	margin-top: 12px;
	padding: 14px 16px;
	background: var(--gelife-ais-track);
	border-radius: 14px;
}

.gelife-ais-filter-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 12px;
	color: var(--gelife-ais-text-muted);
	/* 150px (not 180px) so Category + Subcategory + Region reliably fit
	   on one row even at the narrow end of the desktop width range —
	   at 180px a 3-field row could just barely fail to fit and wrap its
	   last field alone onto its own full-width row, which looked odd. */
	flex: 1 1 150px;
}

/* Author `display: flex` above otherwise beats the UA `[hidden]` rule at
   equal specificity (origin, not specificity, decides that tie) — same
   fix already needed elsewhere in this file for author-styled elements
   that toggle via the `hidden` attribute. Covers the subcategory field,
   which starts hidden until a top-level category is picked. */
.gelife-ais-filter-field[hidden] {
	display: none;
}

.gelife-ais-filter-field select {
	font-size: 14px;
	color: var(--gelife-ais-text);
	padding: 9px 10px;
	border-radius: 8px;
	border: 1px solid var(--gelife-ais-border);
	background: #fff;
}

/* Quick category chips. */
.gelife-ais-chips {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	gap: 8px;
	margin-top: 14px;
	padding-bottom: 4px;
	-ms-overflow-style: none;
	scrollbar-width: thin;
}

.gelife-ais-chip {
	flex: none;
	display: inline-block;
	border: 1px solid var(--gelife-ais-border);
	background: #fff;
	color: var(--gelife-ais-text);
	font-size: 13px;
	font-weight: 500;
	padding: 8px 16px;
	border-radius: var(--gelife-ais-radius);
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gelife-ais-chip:hover {
	border-color: var(--gelife-ais-accent);
}

.gelife-ais-chip.is-empty {
	color: var(--gelife-ais-text-muted);
	border-style: dashed;
}

.gelife-ais-chip.is-active {
	background: var(--gelife-ais-text);
	border-color: var(--gelife-ais-text);
	color: #fff;
}

.gelife-ais-status {
	min-height: 22px;
	margin: 14px 4px 0;
	font-size: 14px;
	color: var(--gelife-ais-text-muted);
}

.gelife-ais-status.is-error {
	color: #b3261e;
}

.gelife-ais-results {
	margin-top: 10px;
}

.gelife-ais-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

.gelife-ais-card {
	min-width: 0;
}

.gelife-ais-fallback-card {
	display: block;
	border: 1px solid var(--gelife-ais-border);
	border-radius: 10px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	background: #fff;
}

.gelife-ais-fallback-card img {
	display: block;
	width: 100%;
	height: 160px;
	object-fit: cover;
}

.gelife-ais-fallback-card h3,
.gelife-ais-fallback-card p {
	margin: 0;
	padding: 0 14px;
}

.gelife-ais-fallback-card h3 {
	margin-top: 12px;
	font-size: 16px;
}

.gelife-ais-fallback-card p {
	margin: 6px 0 14px;
	color: var(--gelife-ais-text-muted);
	font-size: 14px;
}

.gelife-ais-no-results {
	text-align: center;
	color: var(--gelife-ais-text-muted);
	padding: 30px 0;
}

.gelife-ais-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-right: 8px;
	border: 2px solid var(--gelife-ais-accent-glow);
	border-top-color: var(--gelife-ais-accent);
	border-radius: 50%;
	vertical-align: -2px;
	animation: gelife-ais-spin 0.7s linear infinite;
}

@keyframes gelife-ais-spin {
	to { transform: rotate(360deg); }
}

/* --- Mobile full-screen search/filters (elements below only ever become
   visible through the classes the JS toggles below 640px; on desktop
   they stay in their normal, unchanged inline layout). --- */

/* Back arrow inside the pill, only shown once the mobile search overlay
   is open. */
.gelife-ais-mobile-back {
	display: none;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: none;
	background: transparent;
	color: var(--gelife-ais-text);
	cursor: pointer;
	border-radius: 50%;
	padding: 0;
}

.gelife-ais-mobile-back svg {
	width: 20px;
	height: 20px;
}

.gelife-ais-mobile-back:hover {
	background: var(--gelife-ais-track);
}

/* On desktop the filter button is an icon-only square (unchanged); the
   text label next to it is only used in the mobile footer button. */
.gelife-ais-filter-toggle-label {
	display: none;
}

/* Wrapper around the filter-toggle + submit buttons. display:contents
   removes it from the box tree so its children lay out exactly as
   direct children of .gelife-ais-bar — i.e. exactly like before this
   wrapper existed. It only becomes a real (sticky-bottom) flex row once
   the mobile search overlay is open. */
.gelife-ais-mobile-footer {
	display: contents;
}

/* Header row (title + close ×) above the filters — only used in the
   mobile full-screen filters view; the desktop dropdown panel doesn't
   need it. */
.gelife-ais-filters-header {
	display: none;
	align-items: center;
	justify-content: space-between;
	flex-basis: 100%;
}

.gelife-ais-filters-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--gelife-ais-text);
}

.gelife-ais-filters-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	background: var(--gelife-ais-track);
	border-radius: 50%;
	color: var(--gelife-ais-text);
	cursor: pointer;
}

.gelife-ais-filters-close svg {
	width: 16px;
	height: 16px;
}

/* Category quick-chips (mymarket-style) — an alternative, thumb-friendly
   way to set the same <select> that's used on desktop; hidden there
   since the select alone is enough at that width. */
.gelife-ais-category-chips,
.gelife-ais-quick-categories,
.gelife-ais-subcategory-chips {
	display: none;
}

.gelife-ais-category-chip {
	display: inline-block;
	border: 1px solid var(--gelife-ais-border);
	background: #fff;
	color: var(--gelife-ais-text);
	font-size: 13px;
	font-weight: 500;
	padding: 8px 14px;
	border-radius: var(--gelife-ais-radius);
	cursor: pointer;
	white-space: nowrap;
}

.gelife-ais-category-chip.is-active {
	background: var(--gelife-ais-text);
	border-color: var(--gelife-ais-text);
	color: #fff;
}

.gelife-ais-filters-apply {
	display: none;
	flex: none;
	width: 100%;
	border: none;
	background: var(--gelife-ais-accent);
	color: var(--gelife-ais-accent-text);
	font-size: 15px;
	font-weight: 700;
	padding: 14px;
	border-radius: var(--gelife-ais-radius);
	cursor: pointer;
}

body.gelife-ais-lock-scroll {
	/* `overflow: hidden` alone doesn't stop touch scrolling on mobile
	   Safari/Chrome — pinning the body in place (JS sets `top` to the
	   negative of the saved scroll offset) is what actually holds the
	   page still behind the full-screen mobile search overlay. */
	position: fixed;
	overflow: hidden;
	width: 100%;
}

@media (max-width: 640px) {
	/* Default (collapsed) state: a single compact line — engine toggle +
	   input only, matching the reference. Everything else (filter/search
	   buttons, the quick category links, the BETA badge) folds into the
	   full-screen overlay instead of crowding this line. */
	.gelife-ais-pill {
		border-radius: 999px;
		padding: 4px;
	}
	.gelife-ais-engine-toggle {
		padding: 2px;
		gap: 0;
	}
	/* Icon-only on mobile — with both buttons' full text ("Поиск" /
	   "GeLife AI") this toggle alone was ~220px wide, wider than half
	   the screen, and forced the input off the right edge. */
	.gelife-ais-engine-btn {
		padding: 9px;
		gap: 0;
	}
	.gelife-ais-engine-label,
	.gelife-ais-beta {
		display: none;
	}
	.gelife-ais-bar {
		flex-wrap: nowrap;
	}
	.gelife-ais-input-wrap {
		min-width: 0;
	}
	/* iOS Safari auto-zooms the whole page on focus for any input/select
	   with a computed font-size under 16px — that's the "zooms in when
	   you tap search" behaviour. 16px here (up from 15/14px) stops it. */
	.gelife-ais-input {
		font-size: 16px;
	}
	.gelife-ais-filter-field select {
		font-size: 16px;
	}
	.gelife-ais-mobile-footer,
	.gelife-ais-chips,
	.gelife-ais-quick-categories {
		display: none;
	}
	.gelife-ais:not(.gelife-ais--mobile-open) .gelife-ais-suggestions {
		display: none;
	}

	/* Category select vs. chips: chips are the touch-friendly mobile
	   version of the same field, so swap which one is visible. Same
	   swap for the subcategory field that opens up underneath it. */
	.gelife-ais-filter-field select[data-role="category-select"],
	.gelife-ais-filter-field select[data-role="subcategory-select"] {
		display: none;
	}
	.gelife-ais-category-chips,
	.gelife-ais-filter-field .gelife-ais-subcategory-chips {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}
	.gelife-ais-filter-field {
		flex: none;
		width: 100%;
	}

	/* Tapping the compact bar expands it into a full-screen "page":
	   back arrow + input at top, live suggestions below, and a footer
	   with the filters/search buttons pinned to the bottom — the same
	   structure as the mymarket.ge reference. */
	.gelife-ais--mobile-open {
		position: fixed;
		inset: 0;
		z-index: 9999;
		max-width: none;
		margin: 0;
		background: #fff;
		padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
		display: flex;
		flex-direction: column;
	}
	.gelife-ais--mobile-open .gelife-ais-bar {
		flex: 1;
		min-height: 0;
		flex-direction: column;
		align-items: stretch;
		flex-wrap: nowrap;
		gap: 0;
	}
	.gelife-ais--mobile-open .gelife-ais-pill {
		flex: none;
		border-radius: 14px;
	}
	.gelife-ais--mobile-open .gelife-ais-mobile-back {
		display: inline-flex;
	}
	.gelife-ais--mobile-open .gelife-ais-suggestions {
		/* Generous fixed cap rather than measuring the header/footer in
		   JS — leaves comfortable room for the pill above and the
		   footer below on any phone size. */
		max-height: calc(100vh - 280px);
	}
	/* Categories, right on the main search screen — no extra tap into
	   the filters panel needed just to narrow by category. */
	.gelife-ais--mobile-open .gelife-ais-quick-categories {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 8px;
		flex: none;
		padding: 12px 0 2px;
		-ms-overflow-style: none;
		scrollbar-width: thin;
	}
	.gelife-ais--mobile-open .gelife-ais-quick-categories .gelife-ais-category-chip {
		flex: none;
	}
	/* Subcategories for whichever top-level category is picked above —
	   a second horizontal-scroll row, same treatment as the first. Scoped
	   to a direct child of the form so this never also matches the
	   (differently laid out) subcategory chips inside the filters panel. */
	.gelife-ais--mobile-open .gelife-ais-bar > .gelife-ais-subcategory-chips {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 8px;
		flex: none;
		padding: 4px 0 2px;
		-ms-overflow-style: none;
		scrollbar-width: thin;
	}
	.gelife-ais--mobile-open .gelife-ais-bar > .gelife-ais-subcategory-chips .gelife-ais-category-chip {
		flex: none;
	}
	.gelife-ais--mobile-open .gelife-ais-mobile-footer {
		display: flex;
		flex: none;
		gap: 8px;
		margin-top: auto;
		padding-top: 12px;
	}
	.gelife-ais--mobile-open .gelife-ais-filter-toggle {
		width: auto;
		height: 48px;
		padding: 0 16px;
		gap: 8px;
		border-radius: var(--gelife-ais-radius);
	}
	.gelife-ais--mobile-open .gelife-ais-filter-toggle-label {
		display: inline;
		font-size: 14px;
		font-weight: 600;
		white-space: nowrap;
	}
	.gelife-ais--mobile-open .gelife-ais-submit {
		flex: 1 1 auto;
		height: 48px;
		justify-content: center;
	}

	/* The filters panel, opened from the footer button, layers on top
	   of the search overlay as its own full-screen "page" — same
	   pattern as mymarket's "Расширенные фильтры" screen, with the
	   categories folded in as chips. */
	.gelife-ais--mobile-filters-open .gelife-ais-filters {
		position: fixed;
		inset: 0;
		z-index: 10000;
		margin: 0;
		border-radius: 0;
		background: #fff;
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 16px;
		padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		overflow-y: auto;
	}
	.gelife-ais--mobile-filters-open .gelife-ais-filters-header {
		display: flex;
	}
	.gelife-ais--mobile-filters-open .gelife-ais-filters-apply {
		display: block;
		margin-top: auto;
	}
}
