/* ─────────────────────────────────────────────────────────────────
   MailerPress — Search Autocomplete Dropdown
   ───────────────────────────────────────────────────────────────── */

/* Ensure the search block wrapper is a positioning context */
.wp-block-search__inside-wrapper {
	position: relative;
}

/* ── Keyboard shortcut hint badge ──────────────────────────────── */

.mlp-ac-kbd {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-family: inherit;
	font-size: 11px;
	font-weight: 500;
	line-height: 1;
	color: #94a3b8;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 5px;
	padding: 3px 6px;
	pointer-events: none;
	user-select: none;
	transition: opacity 0.15s;
}

.mlp-ac-kbd[hidden] {
	display: none;
}

@media (max-width: 480px) {
	.mlp-ac-kbd { display: none; }
}

/* ── Dropdown container ────────────────────────────────────────── */

.mlp-autocomplete-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	min-width: 320px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	box-shadow:
		0 4px 6px -1px rgba(0, 0, 0, .06),
		0 20px 50px -10px rgba(15, 23, 42, .18);
	z-index: 999999;
	overflow: hidden;
	max-height: 440px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #e2e8f0 transparent;
}

.mlp-autocomplete-dropdown[hidden] {
	display: none;
}

/* Right-align the dropdown when it would overflow the right edge of the viewport */
.mlp-autocomplete-dropdown.is-flipped {
	left: auto;
	right: 0;
}

/* Subtle reveal animation */
@media (prefers-reduced-motion: no-preference) {
	.mlp-autocomplete-dropdown:not([hidden]) {
		animation: mlp-ac-reveal 0.15s ease-out both;
	}
}

@keyframes mlp-ac-reveal {
	from { opacity: 0; transform: translateY(-6px) scale(.98); }
	to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── List ──────────────────────────────────────────────────────── */

.mlp-ac-list {
	list-style: none;
	margin: 0;
	padding: 6px;
}

/* ── Result item ───────────────────────────────────────────────── */

.mlp-ac-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 9px;
	cursor: pointer;
	transition: background 0.1s ease;
	outline: none;
}

.mlp-ac-item:hover,
.mlp-ac-item.is-active {
	background: #f8fafc;
}

/* Left column: type badge */
.mlp-ac-meta {
	flex-shrink: 0;
	padding-top: 2px;
}

.mlp-ac-type {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #4f46e5;
	background: #eff6ff;
	padding: 2px 7px;
	border-radius: 20px;
	line-height: 1.6;
	white-space: nowrap;
}

/* Right column: text content */
.mlp-ac-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mlp-ac-title {
	font-size: 14px;
	font-weight: 500;
	color: #0f172a;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mlp-ac-title mark {
	background: #fef9c3;
	color: inherit;
	border-radius: 3px;
	padding: 0 1px;
}

.mlp-ac-excerpt {
	font-size: 12px;
	color: #64748b;
	line-height: 1.5;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}

/* ── Empty state ───────────────────────────────────────────────── */

.mlp-ac-empty {
	padding: 16px 12px;
	font-size: 13px;
	color: #94a3b8;
	text-align: center;
}

/* ── Footer: "See all results" link ────────────────────────────── */

.mlp-ac-footer {
	border-top: 1px solid #f1f5f9;
	padding: 8px 12px;
	margin-top: 2px;
}

.mlp-ac-footer a {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #4f46e5;
	text-decoration: none;
	transition: color 0.1s;
}

.mlp-ac-footer a:hover {
	color: #3730a3;
	text-decoration: underline;
}

/* ── Three-dot loading indicator ───────────────────────────────── */

.mlp-ac-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 22px 12px;
}

.mlp-ac-loading span {
	display: block;
	width: 7px;
	height: 7px;
	background: #4f46e5;
	border-radius: 50%;
	animation: mlp-dot 1.2s infinite ease-in-out;
}

.mlp-ac-loading span:nth-child(2) { animation-delay: .2s; }
.mlp-ac-loading span:nth-child(3) { animation-delay: .4s; }

@keyframes mlp-dot {
	0%, 80%, 100% { transform: scale(.55); opacity: .35; }
	40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.mlp-autocomplete-dropdown {
		min-width: 0;
		border-radius: 10px;
	}
	.mlp-ac-excerpt { display: none; }
}
