/* Modrah Search overlay — uses the theme's --md-* tokens with fallbacks. */
.mdrs-overlay {
	position: fixed; inset: 0; z-index: 100000;
	background: rgba(23, 25, 31, .5);
	backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
	display: flex; justify-content: center; align-items: flex-start;
	padding: 8vh 16px 16px; direction: rtl;
	animation: mdrsFade .18s ease;
}
.mdrs-overlay[hidden] { display: none; }
@keyframes mdrsFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mdrsUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.mdrs-box {
	width: min(680px, 100%);
	background: var(--md-surface, #fff);
	border-radius: var(--md-r-l, 16px);
	box-shadow: var(--md-shadow-lg, 0 12px 32px rgba(23,25,31,.16));
	overflow: hidden; animation: mdrsUp .22s cubic-bezier(.2,.8,.2,1);
	display: flex; flex-direction: column; max-height: 80vh;
}
.mdrs-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--md-line, #E8E6E0); }
.mdrs-bar input {
	flex: 1; border: none; outline: none; font: inherit; font-size: 17px;
	background: transparent; color: var(--md-ink, #17191F); min-width: 0;
}
.mdrs-mag { color: var(--md-ink-3, #9BA0A6); flex-shrink: 0; }
.mdrs-close {
	width: 40px; height: 40px; border: none; background: transparent; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--md-ink, #17191F); border-radius: 10px; flex-shrink: 0;
}
.mdrs-close:hover { background: var(--md-bg-2, #F1F0EC); }
.mdrs-close svg { width: 20px; height: 20px; }

.mdrs-hint { padding: 14px 16px; font-size: 13px; color: var(--md-ink-2, #5C6066); }
.mdrs-results { overflow-y: auto; padding: 6px; }
.mdrs-results[hidden], .mdrs-recent[hidden] { display: none; }

.mdrs-item {
	display: flex; align-items: center; gap: 12px; padding: 8px 10px;
	border-radius: 12px; text-decoration: none; color: inherit;
}
.mdrs-item:hover, .mdrs-item.is-active { background: var(--md-bg-2, #F1F0EC); }
.mdrs-item img, .mdrs-item .mdrs-noimg {
	width: 44px; height: 54px; object-fit: cover; border-radius: 8px;
	background: var(--md-bg-2, #F1F0EC); flex-shrink: 0;
}
.mdrs-item__body { flex: 1; min-width: 0; }
.mdrs-item__title {
	font-family: 'DM Sans', sans-serif; direction: ltr; text-align: right;
	unicode-bidi: isolate; font-size: 13px; font-weight: 600;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	color: var(--md-ink, #17191F);
}
.mdrs-item__price { font-size: 13px; font-weight: 700; color: var(--md-ink, #17191F); }
.mdrs-item__price .mdrs-sale { color: var(--md-danger, #C03A30); font-size: 11px; font-weight: 700; margin-inline-start: 6px; }
.mdrs-item__oos { font-size: 11px; color: var(--md-ink-3, #9BA0A6); }

.mdrs-empty { padding: 28px 16px; text-align: center; color: var(--md-ink-2, #5C6066); font-size: 14px; }
.mdrs-more {
	display: block; text-align: center; padding: 12px; margin: 4px;
	border-radius: 12px; background: var(--md-accent-tint, #EBEFFD);
	color: var(--md-accent-dark, #1733AE); font-size: 13px; font-weight: 700; text-decoration: none;
}
.mdrs-loading { padding: 20px; text-align: center; }
.mdrs-loading::after {
	content: ""; display: inline-block; width: 22px; height: 22px;
	border: 3px solid var(--md-accent-tint, #EBEFFD); border-top-color: var(--md-accent, #2145E6);
	border-radius: 50%; animation: mdrsSpin .8s linear infinite;
}
@keyframes mdrsSpin { to { transform: rotate(360deg); } }

.mdrs-recent { padding: 4px 12px 14px; }
.mdrs-recent__title { font-size: 12px; font-weight: 700; color: var(--md-ink-3, #9BA0A6); padding: 6px 4px; }
.mdrs-recent__items { display: flex; flex-wrap: wrap; gap: 8px; }
.mdrs-chip {
	padding: 7px 14px; border-radius: 999px; border: 1px solid var(--md-line, #E8E6E0);
	background: var(--md-surface, #fff); font: inherit; font-size: 13px; cursor: pointer; color: var(--md-ink, #17191F);
}
.mdrs-chip:hover { background: var(--md-bg-2, #F1F0EC); }

@media (max-width: 480px) {
	.mdrs-overlay { padding: 0; }
	.mdrs-box { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
}
