/* Valabi Mobile Header — phones only. Desktop never sees any of this. */
.vmh-bar,
.vmh-trust,
.vmh-summary,
.vmh-last { display: none; }

@media (max-width: 849px) {
	.vmh-bar,
	.vmh-trust,
	.vmh-summary,
	.vmh-last {
		--vmh-ink: #17150f;
		--vmh-gold: #f2b807;
		--vmh-sand: #f6f4ef;
		--vmh-line: #ece7dc;
		--vmh-mute: #6b6559;
		--vmh-ok: #1e8e4e;
		box-sizing: border-box;
		color: var(--vmh-ink);
	}

	/* Keep the top bar (#top-bar); swap the logo row and the search row. */
	body.vmh-on #masthead,
	body.vmh-on #wide-nav { display: none !important; }
	body.vmh-no-footer #footer,
	body.vmh-no-footer .footer-wrapper { display: none !important; }

	/* ---- The bar ---- */
	.vmh-bar {
		position: sticky; top: 0; z-index: 40;
		display: flex; align-items: center; justify-content: space-between; gap: 8px;
		height: 52px; padding: 0 8px;
		background: #fff; border-bottom: 1px solid var(--vmh-line);
	}
	/* Cart and checkout: the top bar stays pinned with the bar, so nothing
	   scrolls past above it. vmh.js puts the header's height in --vmh-head. */
	html body.vmh-cart #header.header,
	html body.vmh-checkout #header.header { position: sticky !important; top: 0 !important; z-index: 41; }
	body.vmh-cart .vmh-bar,
	body.vmh-checkout .vmh-bar { top: var(--vmh-head, 0px); }

	/* Checkout: the products are in the summary card at the top; the order
	   table further down keeps only the totals. */
	body.vmh-checkout .woocommerce-checkout-review-order-table thead,
	body.vmh-checkout .woocommerce-checkout-review-order-table tr.cart_item { display: none !important; }
	.vmh-btn {
		position: relative;
		display: inline-flex; align-items: center; justify-content: center; gap: 4px;
		min-width: 40px; height: 40px; margin: 0; padding: 0;
		border: 0; border-radius: 12px; background: transparent;
		color: var(--vmh-ink) !important; text-decoration: none !important;
		box-shadow: none; cursor: pointer; line-height: 1;
	}
	.vmh-btn svg { flex: 0 0 20px; }
	.vmh-side { display: flex; align-items: center; gap: 2px; min-width: 84px; justify-content: flex-end; }
	.vmh-bar--product .vmh-close { min-width: 84px; justify-content: flex-start; padding-inline-start: 4px; }
	.vmh-logo { display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; text-decoration: none !important; }
	.vmh-logo img { display: block; height: 32px; width: auto; max-width: 150px; object-fit: contain; }
	.vmh-logo strong { font-size: 16px; font-weight: 900; color: var(--vmh-ink); }

	/* The close button: an icon when there is a page to go back to; a
	   labelled pill «✕ دسته‌ها» when the shopper came from outside. */
	.vmh-close__label { display: none; font-size: 12.5px; font-weight: 800; }
	.vmh-close.is-out {
		height: 34px; min-width: 0; padding: 0 12px 0 10px;
		border: 1px solid var(--vmh-line); border-radius: 999px;
	}
	.vmh-close.is-out svg { width: 15px; height: 15px; flex-basis: 15px; }
	.vmh-close.is-out .vmh-close__label { display: inline; }

	.vmh-count {
		position: absolute; top: 3px; left: 3px;
		min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
		background: var(--vmh-gold); color: var(--vmh-ink);
		font-size: 10.5px; font-weight: 900; line-height: 17px; text-align: center;
	}
	.vmh-count[hidden] { display: none; }

	/* Product page: 15% taller bar, more room between the icons, and the
	   shop header's cart button (dark rounded tile, white bag, gold count). */
	.vmh-bar--product { height: 60px; padding: 0 12px; }
	.vmh-bar--product .vmh-side { gap: 12px; min-width: 96px; }
	.vmh-bar--product .vmh-btn { min-width: 44px; height: 44px; }
	.vmh-bar--product .vmh-btn svg { width: 22px; height: 22px; flex-basis: 22px; }
	.vmh-bar--product .vmh-logo img { height: 37px; max-width: 170px; }
	.vmh-bar--product .vmh-cart {
		min-width: 40px; width: 40px; height: 40px; border-radius: 12px;
		background: var(--vmh-ink); color: #fff !important;
	}
	.vmh-bar--product .vmh-cart svg { width: 20px; height: 20px; flex-basis: 20px; }
	.vmh-bar--product .vmh-cart .vmh-count {
		top: -7px; left: -7px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px;
		box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	}

	/* Cart / checkout: back · title · logo on the left. */
	.vmh-bar--cart .vmh-logo,
	.vmh-bar--checkout .vmh-logo { flex: 0 0 auto; min-width: 84px; justify-content: flex-end; }
	.vmh-bar--cart .vmh-logo img,
	.vmh-bar--checkout .vmh-logo img { height: 26px; max-width: 110px; }
	.vmh-bar--cart .vmh-back,
	.vmh-bar--checkout .vmh-back { min-width: 84px; justify-content: flex-start; }
	.vmh-title { flex: 1; text-align: center; font-size: 15px; font-weight: 900; white-space: nowrap; }
	/* A pill, not «·»: next to Persian digits a middle dot reads as a zero («۳۰ کالا»). */
	.vmh-title__sub {
		display: inline-block; margin-inline-start: 4px; padding: 0 8px; border-radius: 999px;
		background: var(--vmh-sand); color: var(--vmh-mute); font-size: 12px; font-weight: 800; line-height: 22px; vertical-align: 2px;
	}

	/* ---- Trust line ---- */
	.vmh-trust {
		display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
		margin: 12px 0; padding: 10px 12px;
		border: 1px dashed var(--vmh-line); border-radius: 14px;
		font-size: 12px; line-height: 1.6;
	}
	.vmh-trust a, .vmh-trust span { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
	.vmh-trust svg { width: 16px; height: 16px; }
	.vmh-trust__wa { color: var(--vmh-ink) !important; text-decoration: none !important; }
	.vmh-trust__ok { color: var(--vmh-ok); }

	/* ---- Checkout: the products as a card above the form ---- */
	.vmh-summary {
		display: block; margin: 0 0 14px;
		border: 1px solid var(--vmh-line); border-radius: 14px; background: #fff; overflow: hidden;
	}
	.vmh-summary[hidden] { display: none; }
	.vmh-summary > summary {
		display: flex; align-items: center; gap: 10px;
		padding: 10px 12px; background: var(--vmh-sand);
		list-style: none; cursor: pointer;
	}
	.vmh-summary > summary::-webkit-details-marker { display: none; }
	.vmh-summary__thumbs { display: flex; gap: 4px; flex: 0 0 auto; }
	.vmh-summary__thumb { display: flex; flex: 0 0 auto; }
	.vmh-summary__thumb img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; border: 1px solid var(--vmh-line); background: #fff; margin: 0; }
	.vmh-summary__text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.6; }
	.vmh-summary__text strong { font-weight: 800; }
	.vmh-summary__free { color: var(--vmh-ok); font-size: 11.5px; font-weight: 700; }
	.vmh-summary__toggle { flex: 0 0 auto; font-size: 12px; font-weight: 800; }
	.vmh-summary .vmh-close-t,
	.vmh-summary[open] .vmh-open { display: none; }
	.vmh-summary[open] .vmh-close-t { display: inline; }
	.vmh-summary__list { margin: 0; padding: 8px 12px 0; list-style: none; }
	.vmh-summary__row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--vmh-line); font-size: 12.5px; }
	.vmh-summary__row:last-child { border-bottom: 0; }
	.vmh-summary__row .vmh-summary__thumb img { width: 44px; height: 44px; }
	.vmh-summary__name { flex: 1; min-width: 0; line-height: 1.6; }
	.vmh-summary__name small { display: block; color: var(--vmh-mute); font-size: 11px; }
	.vmh-summary__edit { display: inline-block; margin: 6px 12px 10px; font-size: 12px; font-weight: 800; }

	/* ---- «دسته‌ها» page, landed from a product's close button ---- */
	a.vmh-hit { outline: 2.5px solid var(--vmh-gold, #f2b807); outline-offset: 3px; border-radius: 16px; }
	.vmh-last {
		display: flex; align-items: center; gap: 10px;
		margin: 10px 0; padding: 8px 12px;
		border: 1.5px dashed var(--vmh-gold); border-radius: 14px; background: #fffbef;
		text-decoration: none !important;
	}
	.vmh-last img { width: 40px; height: 40px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; margin: 0; }
	.vmh-last span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
	.vmh-last small { font-size: 11px; color: var(--vmh-mute); }
	.vmh-last strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.vmh-last em { font-style: normal; font-size: 12px; font-weight: 800; white-space: nowrap; }
}

/* WordPress's admin bar is fixed only above 600px; below that it scrolls away. */
@media (min-width: 601px) and (max-width: 849px) {
	.admin-bar .vmh-bar { top: 46px; }
	html body.admin-bar.vmh-cart #header.header,
	html body.admin-bar.vmh-checkout #header.header { top: 46px !important; }
	body.admin-bar.vmh-cart .vmh-bar,
	body.admin-bar.vmh-checkout .vmh-bar { top: calc(46px + var(--vmh-head, 0px)); }
}
