/* ==========================================================
   DAF Marketplace — Premium Header Search
   Location: /wp-content/plugins/daf-marketplace/assets/css/header/header-search.css

   Purpose:
   - Style the plugin-owned inline header search.
   - Keep typed input text clearly visible in black/dark navy.
   - Protect search UI from theme form/input styles.
   - Support desktop, tablet, mobile, and live results dropdown.
   ========================================================== */

/* 1. Main Wrapper */
.daf-mp-inline-search-wrap {
	position: relative;
	display: flex;
	align-items: center;
	max-width: 100%;
	min-width: 0;
	padding: 2px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	transition:
		background-color 220ms ease,
		border-color 220ms ease,
		box-shadow 220ms ease;
}

.daf-mp-inline-search-wrap.is-active {
	background: #ffffff;
	border-color: #e2e8f0;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* 2. Search Toggle Button */
.daf-mp-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	min-width: 38px;
	min-height: 38px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #64748b;
	box-shadow: none;
	cursor: pointer;
	transition:
		color 180ms ease,
		background-color 180ms ease,
		transform 180ms ease;
}

.daf-mp-search-toggle:hover,
.daf-mp-search-toggle:focus {
	background: #f4f8f5;
	color: #0f9f49;
	outline: none;
	transform: translateY(-1px);
}

.daf-mp-search-icon-svg {
	display: block;
	width: 18px !important;
	height: 18px !important;
}

/* 3. Search Form */
.daf-mp-search-form {
	display: flex;
	align-items: center;
	width: 0;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
	opacity: 0;
	overflow: hidden;
	transition:
		width 260ms cubic-bezier(0.4, 0, 0.2, 1),
		opacity 180ms ease,
		padding 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.daf-mp-inline-search-wrap.is-active .daf-mp-search-form {
	width: min(350px, calc(100vw - 160px));
	max-width: 100%;
	padding: 0 10px 0 4px;
	opacity: 1;
}

/* 4. Input — force readable typed text */
.daf-mp-search-input,
.daf-mp-search-form .search-field,
.daf-mp-search-form__field,
.daf-mp-inline-search-wrap input[type="search"],
.daf-mp-inline-search-wrap input[type="text"] {
	width: 100%;
	min-width: 0;
	height: 36px;
	margin: 0;
	padding: 0 2px;
	border: 0 !important;
	border-radius: 0;
	background: transparent !important;
	color: #0f172a !important;
	-webkit-text-fill-color: #0f172a !important;
	caret-color: #0f9f49;
	outline: none !important;
	box-shadow: none !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 36px;
	letter-spacing: -0.01em;
	appearance: none;
}

.daf-mp-search-input:focus,
.daf-mp-search-form .search-field:focus,
.daf-mp-search-form__field:focus,
.daf-mp-inline-search-wrap input[type="search"]:focus,
.daf-mp-inline-search-wrap input[type="text"]:focus {
	color: #0f172a !important;
	-webkit-text-fill-color: #0f172a !important;
	background: transparent !important;
	border-color: transparent !important;
	outline: none !important;
	box-shadow: none !important;
}

.daf-mp-search-input::placeholder,
.daf-mp-search-form .search-field::placeholder,
.daf-mp-search-form__field::placeholder,
.daf-mp-inline-search-wrap input[type="search"]::placeholder,
.daf-mp-inline-search-wrap input[type="text"]::placeholder {
	color: #64748b;
	-webkit-text-fill-color: #64748b;
	opacity: 1;
	font-weight: 500;
}

/* Chrome search decoration cleanup */
.daf-mp-inline-search-wrap input[type="search"]::-webkit-search-decoration,
.daf-mp-inline-search-wrap input[type="search"]::-webkit-search-cancel-button,
.daf-mp-inline-search-wrap input[type="search"]::-webkit-search-results-button,
.daf-mp-inline-search-wrap input[type="search"]::-webkit-search-results-decoration {
	appearance: none;
}

/* 5. Submit button inside expanded form, if present */
.daf-mp-search-form__submit,
.daf-mp-search-form .search-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 32px;
	margin-left: 8px;
	padding: 0 12px;
	border-radius: 999px;
	white-space: nowrap;
}

/* 6. AJAX Live Results Dropdown */
.daf-live-results-dropdown {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	width: min(420px, calc(100vw - 32px));
	max-width: calc(100vw - 32px);
	max-height: 380px;
	margin-top: 0;
	overflow-y: auto;
	border: 1px solid #e2e8f0;
	border-radius: 16px;
	background: #ffffff;
	box-shadow:
		0 22px 55px rgba(15, 23, 42, 0.14),
		0 8px 22px rgba(15, 23, 42, 0.08);
	z-index: 9999;
}

/* Results Header & Footer */
.daf-search-results-header {
	padding: 11px 15px;
	border-bottom: 1px solid #f1f5f9;
	color: #94a3b8;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.daf-search-view-all {
	display: block;
	padding: 12px;
	border-top: 1px solid #f1f5f9;
	background: #f8fafc;
	color: #0f9f49;
	font-size: 13px;
	font-weight: 750;
	text-align: center;
	text-decoration: none;
	transition:
		background-color 180ms ease,
		color 180ms ease;
}

.daf-search-view-all:hover,
.daf-search-view-all:focus {
	background: #f0fdf6;
	color: #087331;
	outline: none;
	text-decoration: none;
}

/* Individual Result Item */
.daf-search-result-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 15px;
	border-bottom: 1px solid #f1f5f9;
	color: inherit;
	text-decoration: none;
	transition:
		background-color 180ms ease,
		transform 180ms ease;
}

.daf-search-result-item:hover,
.daf-search-result-item:focus {
	background: #f8fafc;
	outline: none;
	text-decoration: none;
	transform: translateX(1px);
}

.daf-search-result-thumb img {
	display: block;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	object-fit: cover;
}

.daf-search-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	border-radius: 10px;
	background: #f1f5f9;
	color: #94a3b8;
}

.daf-search-placeholder svg {
	width: 24px;
	height: 24px;
}

.daf-search-result-info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.daf-search-result-title {
	display: block;
	color: #0f172a;
	font-size: 14px;
	font-weight: 750;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.daf-search-result-cat {
	color: #94a3b8;
	font-size: 11px;
	font-weight: 750;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.daf-search-result-price {
	flex: 0 0 auto;
	margin-left: auto;
	color: #10b981;
	font-size: 13px;
	font-weight: 800;
	white-space: nowrap;
}

/* Type badges */
.daf-type-badge {
	display: inline-block;
	width: fit-content;
	margin-top: 4px;
	padding: 2px 6px;
	border-radius: 5px;
	background: #e2e8f0;
	color: #475569;
	font-size: 9px;
	font-weight: 850;
	line-height: 1.4;
	text-transform: uppercase;
}

.type-theme {
	background: #dcfce7;
	color: #15803d;
}

.type-plugin {
	background: #dbeafe;
	color: #1d4ed8;
}

.type-saas {
	background: #fef9c3;
	color: #a16207;
}

.price-free {
	color: #f59e0b;
	font-weight: 850;
}

/* Empty State */
.daf-no-results {
	padding: 30px;
	color: #94a3b8;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
}

/* Scrollbar */
.daf-live-results-dropdown::-webkit-scrollbar {
	width: 5px;
}

.daf-live-results-dropdown::-webkit-scrollbar-thumb {
	border-radius: 10px;
	background: #cbd5e1;
}

.daf-live-results-dropdown::-webkit-scrollbar-track {
	background: transparent;
}

/* Tablet / small desktop */
@media (max-width: 1280px) {
	.daf-mp-inline-search-wrap.is-active .daf-mp-search-form {
		width: min(310px, calc(100vw - 150px));
	}

	.daf-live-results-dropdown {
		width: min(390px, calc(100vw - 28px));
	}
}

@media (max-width: 1100px) {
	.daf-mp-inline-search-wrap.is-active .daf-mp-search-form {
		width: min(250px, calc(100vw - 140px));
	}

	.daf-mp-search-toggle {
		width: 36px;
		height: 36px;
		min-width: 36px;
		min-height: 36px;
	}

	.daf-search-result-title {
		font-size: 13px;
	}
}

/* Mobile safety */
@media (max-width: 768px) {
	.daf-mp-inline-search-wrap {
		width: 100%;
	}

	.daf-mp-inline-search-wrap.is-active .daf-mp-search-form,
	.daf-mp-search-form--mobile {
		width: 100%;
		opacity: 1;
		padding: 0 10px;
	}

	.daf-live-results-dropdown {
		left: 0;
		right: 0;
		width: 100%;
		max-width: 100%;
	}

	.daf-search-result-item {
		padding: 11px 12px;
	}

	.daf-search-result-price {
		font-size: 12px;
	}
}