/* ==========================================================================
   Mobile menu: a full-screen sheet (header.php #mobile-sidedar, markup from functions/menu.php).
   Level 1 = a calm list (icon tile, title, chevron; no descriptions); a row with children slides a full-screen panel in (.mn-panel): back bar, link to
   the section page, then rows of icon + title, grouped under small titles. A bar with the quote and call buttons stays at the bottom.
   Below xl only (the toggle is hidden from xl up). Colours, shape and motion come from css/identity.css (--av-*).
   The old drawer rules (#mobile-sidedar, #sidemenu in chrome.css) are overridden here; selectors start with the two ids so they win
   over the old `#sidemenu > ul > li > ul ...` chains no matter how many elements those count.
   ========================================================================== */

#mobile-sidedar.mn { --mn-gutter: max(15px, calc((100vw - 560px) / 2)); /* a centred column on a tablet; 15px on a phone = the header's side, so the icons stand in one column with the X */ --mn-top: 76px; /* the header bar stays on top of the sheet: logo and the X */
	background: #fff; z-index: 90; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility 0s .22s; }
#mobile-sidedar.mn.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .22s ease, visibility 0s; }
@media (min-width: 1280px) { #mobile-sidedar.mn { display: none; } }
@media (max-width: 767px) { #mobile-sidedar.mn { --mn-top: 60px; } } /* the lower header bar of a phone (src/input.css) */

#mobile-sidedar > .mn-body,
#mobile-sidedar.open > .mn-body { position: absolute; inset: var(--mn-top) 0 0 0; width: auto; max-width: none; height: auto; padding: 0; overflow: hidden;
	background: #fff; box-shadow: none; transform: none; will-change: auto; }
#mobile-sidedar .mn-body, #mobile-sidedar .mn-body * { box-sizing: border-box; }
#mobile-sidedar .mn-root, #mobile-sidedar .mn-panel { scrollbar-width: thin; scrollbar-color: #d9c7f0 transparent; }

/* ---------- level 1 ---------- */
#mobile-sidedar #sidemenu { font-size: var(--av-fs-small, 14px); height: 100%; }
#mobile-sidedar #sidemenu .mn-root { height: 100%; max-height: none; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 8px var(--mn-gutter) 120px;
	display: flex; flex-direction: column; gap: 0; }
#mobile-sidedar #sidemenu li { line-height: 1.6; }
#mobile-sidedar #sidemenu .mn-item { list-style: none; }

/* the cards rise one after the other when the menu opens */
@keyframes mn-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* (not on the li itself: an animated transform would make it the containing block of its panel) */
#mobile-sidedar.open #sidemenu .mn-root > .mn-item > .mn-card, #mobile-sidedar.open #sidemenu .mn-root > .mn-item > .mn-search { animation: mn-rise .45s var(--av-ease) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }

/* the search field: the look of the search window (header.php #search-modal), but live in the menu */
#mobile-sidedar #sidemenu .mn-search { width: 100%; height: 44px; display: flex; align-items: center; gap: 0; margin: 0 0 6px; padding: 3px; border: 1px solid rgba(0, 0, 0, .15); border-radius: 8px; background: #fff; }
#mobile-sidedar #sidemenu .mn-search:focus-within { border-color: var(--av-purple); }
#mobile-sidedar #sidemenu .mn-search .search-field { flex: 1 1 auto; width: auto; min-width: 0; height: 36px; margin: 0; padding: 0 13px; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0;
	color: #000; font: inherit; font-size: var(--av-fs-body, 16px); /* 16px: iOS does not zoom the page on focus */ line-height: 36px; text-align: right; }
#mobile-sidedar #sidemenu .mn-search .search-field::placeholder { color: #7d7090; }
/* a quiet key (purple icon on a light square): the one strong button of the sheet is «درخواست قیمت» at the bottom */
#mobile-sidedar #sidemenu .mn-search .av-btn { flex: none; width: 36px; height: 36px; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 6px; box-shadow: none;
	background: var(--av-purple-50); color: var(--av-purple); transition: background .15s, color .15s; }
#mobile-sidedar #sidemenu .mn-search .av-btn:active, #mobile-sidedar #sidemenu .mn-search:focus-within .av-btn { background: var(--av-purple-100); }
#mobile-sidedar #sidemenu .mn-search .av-btn svg { width: 20px; height: 20px; }

/* the account key (functions/account.php avadis_account_menu_button): in the header bar next to the menu's X, only while the menu is open
   (body.out, js/header.js). Absolute in .hdr-bar so the bar's own layout (button | logo) does not change. Phones: the X is on the right;
   tablet / laptop: on the left (src/input.css .menu-toggle order). */
#header .mn-accbtn { display: none; }
@media (max-width: 1279.98px) {
	body.out #header .mn-accbtn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
		height: 40px; min-width: 40px; padding: 0; border: 1px solid #e6e1ee; border-radius: 999px; background: var(--av-purple-50); color: var(--av-purple);
		font: inherit; font-size: var(--av-fs-body, 16px); font-weight: var(--av-fw-bold, 700); line-height: 1; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
		animation: mn-fade .25s ease both; }
	body.out #header .mn-accbtn--guest { padding: 0 14px 0 12px; font-size: var(--av-fs-small, 14px); }
	body.out #header .mn-accbtn svg { width: 20px; height: 20px; }
	/* a customer: the letter circle and the name in one pill (a long name ends in «…») */
	body.out #header .mn-accbtn--user { padding-block: 0; padding-inline: 3px 13px; gap: 8px; }
	body.out #header .mn-accbtn__av { position: relative; flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #fff;
		box-shadow: inset 0 0 0 1px #e4d8f5; font-size: var(--av-fs-small, 14px); }
	body.out #header .mn-accbtn__name { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--av-fs-small, 14px); line-height: 1.6; }
	body.out #header .mn-accbtn:active, body.out #header .mn-accbtn[aria-expanded="true"] { background: var(--av-purple-100); border-color: #d9c7f0; }
	body.out #header .mn-accbtn:focus-visible { outline: var(--av-focus); outline-offset: 2px; }
	body.out #header .mn-accbtn .av-account__badge { top: -4px; right: -4px; }
}
@media (max-width: 767px) { body.out #header .mn-accbtn { right: 50px; } }                       /* X on the right (40px) + 10px */
@media (min-width: 768px) and (max-width: 1279.98px) { body.out #header .mn-accbtn { left: 52px; } } /* X on the left (42px) + 10px */
@keyframes mn-fade { from { opacity: 0; } to { opacity: 1; } }

/* the customer's panel lives in the sheet; its li takes no room in the list */
#mobile-sidedar #sidemenu .mn-acc { list-style: none; margin: 0; padding: 0; }

/* the customer's entries in its panel: rows like the other panels (icon tile, title), the unread count at the end, «خروج» red under a line */
#mobile-sidedar #sidemenu .mn-acc__list { display: flex; flex-direction: column; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
/* the old drawer gave every link in a sub list a dot (#sidemenu ... a::before) */
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item::before { content: none; }
#mobile-sidedar #sidemenu .mn-acc__list > li { list-style: none; margin: 0; padding: 0; border: 0; }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__sep { margin-top: 8px !important; padding-top: 8px !important; border-top: 1px solid var(--av-line); }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 8px; margin: 0 -8px; border: 0; border-radius: 14px;
	background: none; color: var(--av-ink); font: inherit; font-size: var(--av-fs-body, 16px); font-weight: var(--av-fw-medium, 500); line-height: 1.6; text-align: right; -webkit-tap-highlight-color: transparent; }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item svg { box-sizing: content-box; width: 20px; height: 20px; padding: 10px; border-radius: 11px; background: var(--av-purple-100); color: var(--av-purple); }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item:active { background: var(--av-purple-50); }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item.is-danger { color: #d92d20; }
#mobile-sidedar #sidemenu .mn-acc__list .av-account__item.is-danger svg { background: #fef3f2; color: #d92d20; }
#mobile-sidedar #sidemenu .mn-acc__list form { margin: 0; }

/* level 1 = a calm list: icon, title, a small chevron, hairlines between; no boxes, no descriptions (they live on the desktop hover card) */
#mobile-sidedar #sidemenu .mn-card { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: flex-start; gap: 14px; padding-block: 10px; padding-inline: 0 4px; /* no side room on the icon's side: the icon lines up with the X above */ line-height: 1.6; text-align: right;
	border: 0; border-bottom: 1px solid var(--av-line); border-radius: 0; background: transparent; color: var(--av-ink); font: inherit; cursor: pointer;
	box-shadow: none; transition: background .15s; -webkit-tap-highlight-color: transparent; }
#mobile-sidedar #sidemenu .mn-card:active { background: var(--av-purple-50); }
#mobile-sidedar #sidemenu .mn-card .mn-ic { width: 40px; height: 40px; border-radius: 11px; } /* = the X button (40px) */
#mobile-sidedar #sidemenu .mn-card .mn-ic svg { width: 20px; height: 20px; }
#mobile-sidedar #sidemenu .mn-card b { font-size: var(--av-fs-body, 16px); }
#mobile-sidedar #sidemenu .mn-next { flex: none; width: 24px; height: 24px; display: grid; place-items: center; color: var(--av-muted); }
#mobile-sidedar #sidemenu .mn-next svg { width: 16px; height: 16px; transform: rotate(90deg); /* the chevron points to the side the panel comes from (RTL: left) */ }

/* ---------- shared: icon tile, text ---------- */
#mobile-sidedar #sidemenu .mn-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--av-purple-100); color: var(--av-purple); }
#mobile-sidedar #sidemenu .mn-ic svg { width: 20px; height: 20px; }
#mobile-sidedar #sidemenu .mn-tx { flex: 1 1 auto; min-width: 0; display: block; }
#mobile-sidedar #sidemenu .mn-tx b { display: block; font-weight: var(--av-fw-bold, 700); font-size: var(--av-fs-body, 16px); line-height: 1.7; color: var(--av-ink); }

/* ---------- level 2: the panel slides over the list ---------- */
#mobile-sidedar #sidemenu .mn-panel { position: absolute; inset: 0; z-index: 2; margin: 0; padding: 0 var(--mn-gutter) 120px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
	background: #fff; flex-direction: column; gap: 0; list-style: none; }
/* js/header.js puts .is-open on the open panel (display is animated too, so it can fade out; without allow-discrete it just shows / hides) */
.avadis-chrome[data-chrome-driver="js"] #mobile-sidedar #sidemenu .mn-panel { display: none; opacity: 0; transform: translateX(-36px); /* RTL: the next level comes in from the left */
	transition: transform .2s ease, opacity .16s ease, display .2s allow-discrete; }
.avadis-chrome[data-chrome-driver="js"] #mobile-sidedar #sidemenu .mn-panel.is-open { display: block; opacity: 1; transform: none;
	transition: transform .32s var(--av-ease), opacity .22s ease, display .32s allow-discrete; }
@starting-style { .avadis-chrome[data-chrome-driver="js"] #mobile-sidedar #sidemenu .mn-panel.is-open { opacity: 0; transform: translateX(-36px); } }
/* the Laravel front drives the same markup with .is-open (chrome/src/_behavior.css) */
.avadis-chrome[data-chrome-driver="vue"] #mobile-sidedar .mn-panel { transform: translateX(-36px); flex-direction: column; }
.avadis-chrome[data-chrome-driver="vue"] #mobile-sidedar .mn-panel.is-open { transform: none; }

#mobile-sidedar #sidemenu .mn-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 10px 0 12px; margin-bottom: 6px;
	background: #fff; border-bottom: 1px solid var(--av-line); }
#mobile-sidedar #sidemenu .mn-back { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--av-line); border-radius: 12px;
	background: #fff; color: var(--av-ink); cursor: pointer; }
#mobile-sidedar #sidemenu .mn-back svg { width: 18px; height: 18px; transform: scaleX(-1); /* the arrow of the icon set points left; back in RTL points right */ }
#mobile-sidedar #sidemenu .mn-back:active { background: var(--av-purple-50); }
#mobile-sidedar #sidemenu .mn-bar__title { font-weight: var(--av-fw-heading, 800); font-size: var(--av-fs-h4, 17px); color: var(--av-ink); }

/* the section's own page: a small link at the far (left) end of the back bar */
#mobile-sidedar #sidemenu .mn-bar__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mobile-sidedar #sidemenu .mn-all { flex: none; margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 10px;
	border-radius: 999px; background: var(--av-purple-50); color: var(--av-purple); font-size: var(--av-fs-caption, 13px); font-weight: var(--av-fw-bold, 700); line-height: 1;
	white-space: nowrap; -webkit-tap-highlight-color: transparent; }
#mobile-sidedar #sidemenu .mn-all:active { background: var(--av-purple-100); }
#mobile-sidedar #sidemenu .mn-all svg { flex: none; width: 16px; height: 16px; }
#mobile-sidedar #sidemenu .mn-all::before { content: none; }

#mobile-sidedar #sidemenu .mn-grp { list-style: none; }
#mobile-sidedar #sidemenu .mn-lab { margin: 20px 4px 2px; font-size: var(--av-fs-caption, 13px); font-weight: var(--av-fw-heading, 800); letter-spacing: 0; color: var(--av-purple-700, #6a12cb); }
#mobile-sidedar #sidemenu .mn-group { display: flex; flex-direction: column; gap: 0; padding: 4px 0 0; margin: 0; list-style: none; }
#mobile-sidedar #sidemenu .mn-group > li { list-style: none; }
#mobile-sidedar #sidemenu .mn-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 6px 8px; margin: 0 -8px; min-height: 52px; line-height: 1.6;
	border-radius: 14px; color: var(--av-ink); -webkit-tap-highlight-color: transparent; transition: background .15s; }
#mobile-sidedar #sidemenu .mn-row .mn-ic { width: 40px; height: 40px; border-radius: 11px; }
#mobile-sidedar #sidemenu .mn-row .mn-tx b { font-size: var(--av-fs-body, 16px); font-weight: var(--av-fw-medium, 500); }
#mobile-sidedar #sidemenu .mn-row::before { content: none; }
#mobile-sidedar #sidemenu .mn-row:active { background: var(--av-purple-50); }
#mobile-sidedar #sidemenu .mn-row:active .mn-ic { background: var(--av-purple); color: #fff; }

/* ---------- bottom bar ---------- */
/* the capsule of the sticky page bar (parts/bottom-dock.php, css/bottom-dock.css), pinned to the bottom of the sheet; shown on every device
   that sees this menu (bottom-dock.css hides the page bars on mouse screens, not this one) */
#mobile-sidedar .av-dock.mn-cta { inset-inline: var(--mn-gutter); position: absolute; z-index: 5; display: flex !important; transform: none; visibility: visible; transition: none; }

/* the live-chat button (js/chat.js, fixed bottom-left) would sit on the call button of the bottom bar */
body.out .av-chat-btn { display: none !important; }

#mobile-sidedar a:focus-visible, #mobile-sidedar button:focus-visible { outline: var(--av-focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
	#mobile-sidedar.open #sidemenu .mn-root > .mn-item > * { animation: none !important; }
	.avadis-chrome[data-chrome-driver="js"] #mobile-sidedar #sidemenu .mn-panel, .avadis-chrome[data-chrome-driver="js"] #mobile-sidedar #sidemenu .mn-panel.is-open { transform: none; transition: opacity .15s ease, display .15s allow-discrete; }
}
