/* MMS 2.0 — نوار جست‌وجوی افقی + پنجره‌ی جست‌وجو */
:root { --mms-c: #0a2540; --mms-a: #e0a526; }
@property --mms-ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
html.mms-lock, html.mms-lock body { overflow: hidden !important; }

/* ============ نوار افقی کنار هدر ============ */
.mms-hbar { display: none; direction: rtl; width: 100%; z-index: 9990; padding: 8px 12px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid rgba(10, 37, 64, .07); box-sizing: border-box; }
.mms-hbar *, .mms-hbar *::before, .mms-hbar *::after { box-sizing: border-box; }
.mms-hbar.mms-sticky { position: -webkit-sticky; position: sticky; top: var(--mms-top, 0); }
body.admin-bar .mms-hbar.mms-sticky { --mms-top: 46px; }
@media (min-width: 783px) { body.admin-bar .mms-hbar.mms-sticky { --mms-top: 32px; } }
.mms-hbar.is-inside { position: relative; top: auto; padding: 6px 10px; border-bottom: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

.mms-hbar-in { position: relative; padding: 1.5px; border-radius: 999px; background: conic-gradient(from var(--mms-ang), var(--mms-c), var(--mms-a), #fff 55%, var(--mms-c)); animation: mms-spin 5s linear infinite; box-shadow: 0 6px 18px -8px rgba(10, 37, 64, .35); }
.mms-hbar-fill { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 6px; min-height: 44px; border-radius: 999px; background: #fff; }
.mms-hbar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 4px; border: 0; background: transparent; color: #6b7686; font: inherit; font-size: 14px; text-align: right; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mms-hbar-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--mms-c); color: #fff; }
.mms-hbar-tx { flex: 1; min-width: 0; height: 30px; padding: 2px 0; overflow: hidden; position: relative; }
.mms-hbar-ph { display: inline-block; line-height: 26px; white-space: nowrap; animation: mms-slide .45s cubic-bezier(.2, .8, .2, 1) both; }
/* متن بلندتر از نوار: به‌جای بریده شدن، آرام می‌لغزد تا کامل خوانده شود */
.mms-hbar-ph.is-long { animation: mms-slide .45s cubic-bezier(.2, .8, .2, 1) both, mms-pan 4.2s ease-in-out .5s infinite alternate; }
.mms-hbar-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--mms-c); cursor: pointer; transition: background .15s, transform .15s; -webkit-tap-highlight-color: transparent; }
.mms-hbar-btn[hidden] { display: none; }
.mms-hbar-btn:active { background: #eef2f7; transform: scale(.92); }
.mms-hbar-main:active .mms-hbar-ic { transform: scale(.92); }

/* ============ پنجره‌ی جست‌وجو ============ */
.mms-overlay[hidden] { display: none !important; }
.mms-overlay { position: fixed; inset: 0; z-index: 2147483000; background: #fff; color: #1b2433; font-family: inherit; direction: rtl; opacity: 0; transform: translateY(14px); transition: opacity .2s ease, transform .2s ease; }
.mms-overlay.is-open { opacity: 1; transform: none; }
.mms-overlay *, .mms-overlay *::before, .mms-overlay *::after { box-sizing: border-box; }
.mms-panel { display: flex; flex-direction: column; height: 100%; width: 100%; padding-top: env(safe-area-inset-top, 0); }

.mms-bar { display: flex; align-items: center; gap: 4px; padding: 10px; border-bottom: 1px solid #e3e8ef; background: #fff; margin: 0; }
.mms-back, .mms-clear, .mms-mic, .mms-cam { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--mms-c); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mms-bar .mms-cam { width: 42px; }
.mms-back:active, .mms-clear:active, .mms-mic:active, .mms-bar .mms-cam:active { background: #eef2f7; }
.mms-clear[hidden], .mms-mic[hidden] { display: none; }
.mms-mic.is-hidden { display: none; }
.mms-mic.is-listening { background: var(--mms-a); color: #fff; animation: mms-pulse 1s infinite; }
.mms-input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 1.5px solid #d5dce6; border-radius: 999px; background: #f6f8fb; color: #1b2433; font: inherit; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; transition: border-color .15s, background .15s, box-shadow .15s; }
.mms-input:focus { border-color: var(--mms-c); background: #fff; box-shadow: 0 0 0 4px rgba(10, 37, 64, .08); }
.mms-input::-webkit-search-cancel-button { display: none; }

/* فیلترها */
.mms-filters[hidden] { display: none; }
.mms-filters { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #eef1f5; background: #fbfcfe; }
.mms-cats { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; }
.mms-cats::-webkit-scrollbar { display: none; }
.mms-cat { flex: none; padding: 7px 14px; border: 1px solid #d5dce6; border-radius: 999px; background: #fff; color: #334155; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; transition: .15s; -webkit-tap-highlight-color: transparent; }
.mms-cat.on { background: var(--mms-c); border-color: var(--mms-c); color: #fff; font-weight: 700; }
.mms-stock { flex: none; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: #475569; cursor: pointer; user-select: none; }
.mms-stock input { position: absolute; opacity: 0; width: 0; height: 0; }
.mms-sw { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background .2s; }
.mms-sw::after { content: ""; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.mms-stock input:checked + .mms-sw { background: var(--mms-c); }
.mms-stock input:checked + .mms-sw::after { transform: translateX(-14px); }
.mms-stock input:focus-visible + .mms-sw { outline: 3px solid rgba(10, 37, 64, .25); outline-offset: 2px; }

.mms-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 14px calc(24px + env(safe-area-inset-bottom, 0)); }
.mms-sec { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; font-size: .92em; color: var(--mms-c); }
.mms-recent-clear { border: 0; background: none; color: #6b7686; font: inherit; font-size: .85em; cursor: pointer; padding: 4px 6px; }
.mms-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.mms-chip { padding: 8px 14px; border: 1px solid #d5dce6; border-radius: 999px; background: #fff; color: #1b2433; font: inherit; font-size: .9em; cursor: pointer; }
.mms-chip:active { background: var(--mms-a); border-color: var(--mms-a); }
.mms-hint { margin: 28px 0 0; text-align: center; color: #8a94a3; font-size: .9em; }

/* کارت جست‌وجو با عکس */
.mms-imgcard { display: flex; align-items: center; gap: 14px; width: 100%; margin: 2px 0 18px; padding: 14px; border: 0; border-radius: 16px; background: linear-gradient(135deg, var(--mms-c), color-mix(in srgb, var(--mms-c) 70%, #000)); color: #fff; text-align: right; font: inherit; cursor: pointer; box-shadow: 0 12px 24px -14px var(--mms-c); -webkit-tap-highlight-color: transparent; }
.mms-imgcard:active { transform: scale(.985); }
.mms-imgcard-ic { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--mms-a); color: #1b2433; }
.mms-imgcard-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mms-imgcard-tx b { font-size: 1em; }
.mms-imgcard-tx small { font-size: .8em; opacity: .85; line-height: 1.6; }

/* پیش‌نمایش عکس انتخاب‌شده */
.mms-imgstrip[hidden] { display: none; }
.mms-imgstrip { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px; border: 1px dashed #c3ccd9; border-radius: 14px; background: #f8fafc; flex-wrap: wrap; }
.mms-imgstrip img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.mms-imgstrip-tx { flex: 1; min-width: 120px; font-size: .86em; color: #475569; line-height: 1.7; }
.mms-imgstrip-tx b { display: block; color: #1b2433; }
.mms-imgstrip-x { border: 0; background: #e8edf4; color: #334155; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .82em; cursor: pointer; }
.mms-ocr { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8em; color: #64748b; }

/* نتایج */
.mms-list { display: flex; flex-direction: column; }
.mms-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #eef1f5; color: inherit; -webkit-tap-highlight-color: transparent; animation: mms-in .3s ease both; }
.mms-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.mms-item:active { background: #f3f6fa; }
.mms-thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: #eef2f7; display: block; }
.mms-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mms-ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #e6ebf2, #f3f6fa); }
.mms-off { position: absolute; top: 0; right: 0; padding: 1px 7px; border-radius: 0 0 0 10px; background: #e11d2e; color: #fff; font-size: 11px; font-weight: 800; }
.mms-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.mms-title { font-size: .95em; font-weight: 700; line-height: 1.7; color: #1b2433; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mms-title mark { background: rgba(224, 165, 38, .35); color: inherit; border-radius: 3px; padding: 0 1px; }
.mms-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .82em; color: #5b6575; }
.mms-type { font-style: normal; padding: 1px 8px; border-radius: 999px; background: #eef2f7; color: var(--mms-c); font-weight: 700; }
.mms-out { font-style: normal; padding: 1px 8px; border-radius: 999px; background: #fde8e8; color: #b42318; font-weight: 700; }
.mms-price { font-weight: 800; color: var(--mms-c); }
.mms-price del { opacity: .55; font-weight: 400; margin-inline-end: 4px; }
.mms-price ins { text-decoration: none; }
.mms-add { flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--mms-a); color: #1b2433; cursor: pointer; transition: transform .15s, background .2s; -webkit-tap-highlight-color: transparent; }
.mms-add:active { transform: scale(.9); }
.mms-add.is-busy { opacity: .6; pointer-events: none; }
.mms-add.is-done { background: #16a34a; color: #fff; }
.mms-add.is-err { background: #e11d2e; color: #fff; }
.mms-all { display: block; margin-top: 16px; padding: 13px; border-radius: 12px; background: var(--mms-c); color: #fff; text-align: center; text-decoration: none; font-weight: 700; }
.mms-empty { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 48px 16px; color: #5b6575; }
.mms-empty strong { color: #1b2433; }
.mms-head { margin: 2px 0 6px; font-size: .88em; color: #64748b; font-weight: 700; }

.mms-skel .mms-thumb, .mms-skel .mms-line { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: mms-shim 1.3s ease infinite; }
.mms-line { display: block; height: 12px; border-radius: 6px; width: 85%; }
.mms-line--s { width: 40%; }

/* شورت‌کدها */
.mms-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; border-radius: 999px; background: var(--mms-c); color: #fff; font: inherit; cursor: pointer; }
.mms-inline { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border: 1.5px solid #d5dce6; border-radius: 999px; background: #f6f8fb; color: #7a8493; cursor: text; font-size: 15px; }
.mms-inline span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* حالت پنجره‌ی وسط‌صفحه (دسکتاپ) */
.mms-overlay.mms-modal { background: rgba(10, 20, 35, .55); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.mms-overlay.mms-modal .mms-panel { height: auto; max-height: 80vh; max-width: 640px; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }

@keyframes mms-spin { to { --mms-ang: 360deg; } }
@keyframes mms-pan { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--mms-sh, 0px)); } }
@keyframes mms-slide { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mms-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mms-shim { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes mms-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 165, 38, .6); } 50% { box-shadow: 0 0 0 10px rgba(224, 165, 38, 0); } }

@media (max-width: 380px) {
	.mms-hbar { padding: 6px 8px; }
	.mms-hbar-main { font-size: 13px; gap: 8px; }
	.mms-hbar-btn { width: 36px; }
	.mms-thumb { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
	.mms-overlay, .mms-hbar-ph, .mms-hbar-ph.is-long, .mms-item { transition: none; animation: none; }
	.mms-hbar-ph.is-long { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
	.mms-hbar-in, .mms-skel .mms-thumb, .mms-skel .mms-line, .mms-mic.is-listening { animation: none; }
}
