/*
 * תיקוני כותרת: תת-תפריט Blocksy (רוחב) + חיפוש מובייל (Blocksy / Astra)
 * נטען מ-homer-patuach-bp-tweaks
 */

/* ─── דסקטופ: תת-תפריט לא נמתח לרוחב מלא ─── */
@media (min-width: 769px) {
	.ct-header .menu-container .sub-menu,
	.ct-header [data-id*="menu"] .sub-menu,
	#header .ct-menu .sub-menu,
	header.ct-header .sub-menu,
	.site-header .sub-menu {
		width: auto !important;
		min-width: 11rem;
		max-width: min(22rem, 90vw);
		white-space: nowrap;
	}

	body.rtl .ct-header .menu-item-has-children > .sub-menu,
	body.rtl #header .menu-item-has-children > .sub-menu {
		right: 0;
		left: auto;
	}

	.ct-header .menu-item-has-children > .sub-menu > li > a,
	#header .menu-item-has-children > .sub-menu > li > a {
		white-space: nowrap;
	}
}

/* ─── מובייל: חיפוש Blocksy ─── */
@media (max-width: 768px) {

	.ct-header,
	.ct-header [data-device="mobile"],
	.ct-header-row,
	.ct-header [data-column] {
		overflow: visible !important;
	}

	[data-id="search"],
	.ct-header-search,
	.ct-search-box {
		position: relative !important;
		flex: 0 0 auto !important;
		min-width: 44px !important;
		z-index: 1;
	}

	[data-id="search"].hp-search-open,
	.ct-header-search.hp-search-open,
	.ct-header-search[data-panel="in"]:not([data-panel="out"]) {
		z-index: 100001 !important;
	}

	/* שורת חיפוש מלאה מתחת להדר כשפעיל */
	[data-id="search"].hp-search-open .ct-search-form,
	.ct-header-search.hp-search-open form,
	.ct-header-search[data-panel="in"] form.ct-search-form {
		position: fixed !important;
		top: var(--hp-header-search-top, 54px) !important;
		left: 0 !important;
		right: 0 !important;
		width: 100vw !important;
		max-width: 100vw !important;
		margin: 0 !important;
		padding: 8px 16px !important;
		box-sizing: border-box !important;
		background: #fff !important;
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
		z-index: 999998 !important;
		display: flex !important;
		align-items: center !important;
		gap: 8px !important;
	}

	body.admin-bar [data-id="search"].hp-search-open .ct-search-form,
	body.admin-bar .ct-header-search.hp-search-open form {
		top: var(--hp-header-search-top-admin, 100px) !important;
	}

	[data-id="search"] input[type="search"],
	.ct-header-search input[type="search"],
	.ct-search-form input[type="search"] {
		flex: 1 1 auto !important;
		width: 100% !important;
		min-width: 0 !important;
		max-width: none !important;
		height: 44px !important;
		font-size: 16px !important;
		line-height: 1.4 !important;
		opacity: 1 !important;
		visibility: visible !important;
		direction: rtl !important;
		text-align: right !important;
		padding: 0 16px !important;
		border: 1px solid #ddd !important;
		border-radius: 50px !important;
		background: #fff !important;
		color: #333 !important;
		box-sizing: border-box !important;
		-webkit-appearance: none !important;
		appearance: none !important;
	}

	[data-id="search"] input[type="search"]::placeholder,
	.ct-header-search input[type="search"]::placeholder {
		text-align: right;
		direction: rtl;
	}

	/* Astra – אם עדיין בשימוש */
	.ast-header-break-point .ast-search-menu-icon.is-expanded .search-form input,
	.ast-header-break-point .ast-search-menu-icon:focus-within .search-form input {
		direction: rtl !important;
		text-align: right !important;
	}
}

/* שורטקוד חיפוש חלופי [hp_header_search] */
.hp-header-search-widget {
	display: flex;
	width: 100%;
	max-width: 100%;
}

.hp-header-search-widget form {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	direction: rtl;
}

.hp-header-search-widget input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	font-size: 16px;
	direction: rtl;
	text-align: right;
	padding: 0 16px;
	border: 1px solid #ddd;
	border-radius: 50px;
	box-sizing: border-box;
}

.hp-header-search-widget button[type="submit"] {
	flex-shrink: 0;
	height: 44px;
	padding: 0 16px;
	border: none;
	border-radius: 50px;
	background: #7699f2;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

@media (max-width: 768px) {
	.hp-header-search-widget--compact .hp-header-search-widget__toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: none;
		background: transparent;
		color: #7699f2;
		cursor: pointer;
	}

	.hp-header-search-widget--compact .hp-header-search-widget__panel {
		display: none;
		position: fixed;
		top: var(--hp-header-search-top, 54px);
		left: 0;
		right: 0;
		padding: 8px 16px;
		background: #fff;
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
		z-index: 999998;
	}

	.hp-header-search-widget--compact.is-open .hp-header-search-widget__panel {
		display: block;
	}

	body.admin-bar .hp-header-search-widget--compact .hp-header-search-widget__panel {
		top: var(--hp-header-search-top-admin, 100px);
	}
}
