/* Search Global ACF - bara de căutare
   Culorile pornesc din variabile, ca să se poată suprascrie ușor din Custom CSS. */

.ags-search{
	--ags-width: 240px;
	--ags-height: 40px;
	--ags-radius: 999px;
	--ags-bg: rgba(255, 255, 255, 0.9);
	--ags-border: rgba(0, 0, 0, 0.18);
	--ags-border-focus: currentColor;
	--ags-text: inherit;
	--ags-muted: rgba(0, 0, 0, 0.55);
	--ags-panel-bg: #fff;
	--ags-panel-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
	--ags-mark: rgba(255, 214, 0, 0.45);

	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	color: var(--ags-text);
	line-height: 1.4;
	box-sizing: border-box;
}

.ags-search *,
.ags-modal *,
.ags-search *::before,
.ags-modal *::before,
.ags-search *::after,
.ags-modal *::after {
	box-sizing: border-box;
}

/* ---------- formularul ---------- */

.ags-form {
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
	width: var(--ags-width);
	max-width: 100%;
	height: var(--ags-height);
	padding: 0 6px 0 10px;
	margin: 0;
	background: var(--ags-bg);
	border: 1px solid var(--ags-border);
	border-radius: var(--ags-radius);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ags-form:focus-within {
	border-color: var(--ags-border-focus);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.ags-form-icon {
	display: inline-flex;
	flex: 0 0 auto;
	opacity: 0.6;
	pointer-events: none;
}

.ags-search .ags-input,
.ags-modal .ags-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0 4px;
	background: none;
	border: 0;
	outline: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-size: 15px;
	line-height: normal;
	border-radius: 0;
}

.ags-search .ags-input::placeholder,
.ags-modal .ags-input::placeholder {
	color: var(--ags-muted);
	opacity: 1;
}

.ags-search .ags-input::-webkit-search-cancel-button,
.ags-modal .ags-input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.ags-search button,
.ags-modal button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--ags-radius);
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.ags-search .ags-submit-icon,
.ags-modal .ags-submit-icon {
	width: calc(var(--ags-height) - 10px);
	height: calc(var(--ags-height) - 10px);
	opacity: 0.75;
}

.ags-search .ags-submit-icon:hover,
.ags-modal .ags-submit-icon:hover,
.ags-search .ags-toggle:hover,
.ags-modal .ags-toggle:hover {
	opacity: 1;
}

.ags-search .ags-submit-text,
.ags-modal .ags-submit-text {
	height: calc(var(--ags-height) - 10px);
	padding: 0 14px;
	background: currentColor;
	font-size: 14px;
}

.ags-search .ags-submit-text::after,
.ags-modal .ags-submit-text::after {
	content: none;
}

.ags-search button:focus-visible,
.ags-modal button:focus-visible,
.ags-search .ags-input:focus-visible,
.ags-modal .ags-input:focus-visible {
	outline: 2px solid var(--ags-border-focus);
	outline-offset: 2px;
}

/* lupa: doar pe mobil */
.ags-search .ags-toggle,
.ags-modal .ags-toggle,
.ags-search .ags-close,
.ags-modal .ags-close {
	display: none;
	width: var(--ags-height);
	height: var(--ags-height);
	opacity: 0.85;
}

/* ---------- rezultate live ---------- */

.ags-results {
	position: absolute;
	top: calc(100% + 8px);
	z-index: 9999;
	width: 380px;
	max-width: min(92vw, 460px);
	max-height: min(70vh, 520px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px;
	background: var(--ags-panel-bg);
	border-radius: 10px;
	box-shadow: var(--ags-panel-shadow);
	color: #1a1a1a;
	text-align: left;
}

.ags-align-right .ags-results {
	right: 0;
}

.ags-align-left .ags-results {
	left: 0;
}

.ags-results[hidden] {
	display: none;
}

.ags-item {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 9px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
}

.ags-item:hover,
.ags-item.is-active {
	background: rgba(0, 0, 0, 0.05);
	text-decoration: none;
	color: inherit;
}

.ags-item img {
	width: 44px;
	height: 44px;
	flex: 0 0 44px;
	object-fit: cover;
	border-radius: 6px;
	margin: 2px 0 0;
	display: block;
}

.ags-item-body {
	min-width: 0;
}

.ags-item-title {
	display: block;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.35;
	margin-bottom: 2px;
}

.ags-item-snippet {
	display: block;
	font-size: 12.5px;
	line-height: 1.45;
	color: rgba(0, 0, 0, 0.6);
}

.ags-item-snippet mark,
.ags-item-title mark {
	background: var(--ags-mark);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

.ags-item-meta {
	display: block;
	margin-top: 3px;
	font-size: 11.5px;
	color: rgba(0, 0, 0, 0.45);
}

.ags-status,
.ags-more {
	display: block;
	padding: 12px 12px;
	font-size: 13px;
	color: rgba(0, 0, 0, 0.6);
}

.ags-more {
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	margin-top: 4px;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
}

.ags-more:hover {
	text-decoration: underline;
}

/* ---------- lupa + modal ---------- */

.ags-search.ags-is-mobile .ags-toggle,
.ags-search.ags-popup-always .ags-toggle {
	display: inline-flex;
}

.ags-search.ags-is-mobile > .ags-form,
.ags-search.ags-popup-always > .ags-form {
	display: none;
}

/* Modalul e mutat de JS direct în <body>, ca să scape de header-ul sticky
   (un ancestor cu transform anulează position:fixed). */
.ags-modal {
	--ags-height: 54px;
	--ags-radius: 0;
	--ags-panel-bg: #fff;
	--ags-muted: rgba(0, 0, 0, 0.5);
	--ags-mark: rgba(255, 214, 0, 0.45);

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: clamp(48px, 8vh, 96px) 14px 14px;
	box-sizing: border-box;
	font-size: 16px;
}

.ags-modal *,
.ags-modal *::before,
.ags-modal *::after {
	box-sizing: border-box;
}

.ags-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 12, 16, 0.55);
	animation: ags-fade 0.18s ease-out;
}

.ags-modal-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 560px;
	max-height: 100%;
	overflow: hidden;
	background: var(--ags-panel-bg);
	color: #1a1a1a;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
	animation: ags-pop 0.18s ease-out;
}

.ags-modal .ags-form {
	flex: 0 0 auto;
	display: flex;
	width: 100%;
	height: 54px;
	padding: 0 8px 0 14px;
	background: none;
	border: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 0;
	color: inherit;
}

.ags-modal .ags-form:focus-within {
	box-shadow: none;
}

.ags-modal .ags-input {
	/* minim 16px, altfel iOS face zoom la focus */
	font-size: 16px;
}

.ags-modal .ags-close {
	display: inline-flex;
	width: 40px;
	height: 40px;
	opacity: 0.6;
}

.ags-modal .ags-results {
	position: static;
	flex: 1 1 auto;
	width: auto;
	max-width: none;
	max-height: none;
	min-height: 0;
	padding: 6px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: 0;
	box-shadow: none;
}

.ags-modal .ags-results[hidden] {
	display: none;
}

.ags-modal .ags-item.is-active {
	background: rgba(0, 0, 0, 0.06);
}

/* Blochează scroll-ul paginii cât e modalul deschis. */
html.ags-locked,
body.ags-locked {
	overflow: hidden;
}

@keyframes ags-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes ags-pop {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: none; }
}

/* Fără animații pentru cine le-a dezactivat din sistem. */
@media (prefers-reduced-motion: reduce) {
	.ags-form {
		transition: none;
	}

	.ags-modal-backdrop,
	.ags-modal-panel {
		animation: none;
	}
}

/* Ascunde eticheta doar vizual, dacă tema nu are deja clasa. */
.ags-search .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
