/**
 * MR Stiff Product Manual Tab — AJAX Search drawer.
 */

.mspmt-search {
	display: inline-flex;
}

.mspmt-search__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	background: none;
	border: 0;
	cursor: pointer;
	color: inherit;
	line-height: 0;
}

/* ---- Drawer (right side) ----------------------------------------------- */

.mspmt-search-drawer {
	position: fixed;
	inset: 0;
	z-index: 99999;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.mspmt-search-drawer.is-open {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.25s ease;
}

.mspmt-search-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
	/* Hide native cursor so only the custom "+" indicator shows. */
	cursor: none;
}

.mspmt-search-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	left: auto;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min( 480px, 94vw );
	background: #fff;
	box-shadow: -4px 0 24px rgba( 0, 0, 0, 0.18 );
	transform: translateX( 100% );
	transition: transform 0.28s ease;
}

.mspmt-search-drawer.is-open .mspmt-search-drawer__panel {
	transform: translateX( 0 );
}

.mspmt-search-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 22px 26px 10px;
	flex-shrink: 0;
}

.mspmt-search-drawer__title {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.mspmt-search-drawer__close {
	width: 32px;
	height: 32px;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	background: none;
	border: 0;
	color: #333;
}

/* ---- Search form ------------------------------------------------------- */

.mspmt-search__form {
	position: relative;
	flex-shrink: 0;
	margin: 0 26px 18px;
}

.mspmt-search__input {
	width: 100%;
	padding: 12px 40px 12px 4px;
	font-size: 17px;
	background: transparent;
	border: 0;
	border-bottom: 2px solid #111;
	outline: none;
}

.mspmt-search__submit {
	position: absolute;
	top: 50%;
	right: 0;
	transform: translateY( -50% );
	padding: 4px;
	line-height: 0;
	background: none;
	border: 0;
	cursor: pointer;
	color: #111;
}

/* ---- Results grid ------------------------------------------------------ */

.mspmt-search__results {
	flex: 1;
	overflow-y: auto;
	padding: 4px 26px 20px;
	display: grid;
	grid-template-columns: repeat( var( --mspmt-search-cols, 2 ), minmax( 0, 1fr ) );
	gap: 20px;
	align-content: start;
}

.mspmt-search__results:empty {
	display: block;
}

.mspmt-search__empty {
	grid-column: 1 / -1;
	color: #767676;
}

.mspmt-search__all {
	flex-shrink: 0;
	margin: 0 26px 24px;
	padding: 14px;
	text-align: center;
	font-weight: 600;
	text-decoration: none;
	color: #fff;
	background: #17a673;
	border-radius: 8px;
}

/* ---- Card -------------------------------------------------------------- */

.mspmt-search-card {
	display: flex;
	flex-direction: column;
}

.mspmt-search-card__media {
	position: relative;
}

.mspmt-search-card__imglink {
	display: block;
	text-decoration: none;
	color: inherit;
}

.mspmt-search-card__tags {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.mspmt-search-card__tags:empty {
	display: none;
}

.mspmt-search-tag {
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.7;
	border-radius: 4px;
}

.mspmt-search-tag--sale {
	color: #1a1a1a;
	background: #f4e409;
}

.mspmt-search-tag--best {
	color: #fff;
	background: #2b2b2b;
}

.mspmt-search-card__img img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #f6f6f6;
	border-radius: 6px;
}

.mspmt-search-card__title {
	display: block;
	margin: 10px 0 4px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
	text-decoration: none;
}

.mspmt-search-card__price {
	font-weight: 600;
}

.mspmt-search-card__price del {
	margin-left: 6px;
	font-weight: 400;
	opacity: 0.6;
}

.mspmt-search-card__from {
	margin-right: 2px;
	font-weight: 400;
}

/* ---- Loading spinner --------------------------------------------------- */

.mspmt-search__loader {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 0;
	flex-shrink: 0;
}

.mspmt-search-drawer.is-loading .mspmt-search__loader {
	display: flex;
}

.mspmt-search__spinner {
	width: 30px;
	height: 30px;
	border: 3px solid rgba( 0, 0, 0, 0.15 );
	border-top-color: #111;
	border-radius: 50%;
	animation: mspmt-search-spin 0.7s linear infinite;
}

@keyframes mspmt-search-spin {
	to {
		transform: rotate( 360deg );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.mspmt-search__spinner {
		animation-duration: 2s;
	}
}

/* Hover add-to-cart "+" button, overlaid at the image's bottom-left. */

.mspmt-search-card__cart {
	position: absolute;
	left: 8px;
	bottom: 8px;
	z-index: 3;
	opacity: 0;
	transform: translateY( 6px );
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.mspmt-search-card:hover .mspmt-search-card__cart,
.mspmt-search-card:focus-within .mspmt-search-card__cart {
	opacity: 1;
	transform: none;
}

.mspmt-search-card__cart-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	line-height: 0;
	border-radius: 8px;
}

.mspmt-search-plus {
	font-size: 26px;
	font-weight: 400;
	line-height: 1;
}

/* Keep the WooCommerce "View cart" link from disrupting the overlay. */
.mspmt-search-card__cart .added_to_cart {
	display: none;
}

/* ---- Pointer "+" indicator over the overlay ---------------------------- */

.mspmt-search-drawer__cursor {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 100000;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.25 );
	opacity: 0;
	pointer-events: none;
	transform: translate( -50%, -50% );
	transition: opacity 0.12s ease;
}

.mspmt-search-drawer__cursor.is-visible {
	opacity: 1;
}

.mspmt-search-drawer__cursor::before,
.mspmt-search-drawer__cursor::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: #1a1a1a;
	transform: translate( -50%, -50% );
}

.mspmt-search-drawer__cursor::before {
	width: 20px;
	height: 2px;
}

.mspmt-search-drawer__cursor::after {
	width: 2px;
	height: 20px;
}

/* ---- Responsive -------------------------------------------------------- */

@media ( max-width: 600px ) {
	.mspmt-search__results {
		grid-template-columns: minmax( 0, 1fr );
	}
}
