/* ============================================================
 * BAMMAT — СТРАНИЦЫ МАГАЗИНА
 * Витрина, товар, корзина, оформление, аккаунт, подвал.
 * Грузится только там, где нужно.
 * ========================================================== */

/* ── ЗАГОЛОВОК ВИТРИНЫ ─────────────────────────────────────── */

.bmt-archive-head { margin-bottom: var(--bm-4); }
.bmt-archive-head h1 { font-size: var(--bm-t-2xl); }
.bmt-archive-desc { color: var(--bm-ink-2); font-size: var(--bm-t-sm); margin: var(--bm-1) 0 0; }

.bmt-chips { margin: var(--bm-4) 0; }

.bmt-back {
	display: inline-flex; align-items: center; gap: var(--bm-1);
	padding: var(--bm-2) var(--bm-3) var(--bm-2) var(--bm-2);
	margin-left: calc(var(--bm-2) * -1);
	border-radius: var(--bm-r-pill);
	color: var(--bm-ink); font-size: var(--bm-t-sm); font-weight: 650;
	flex: 1 1 auto; min-width: 0;
	transition: transform var(--bm-fast) var(--bm-spring), background var(--bm-fast) linear;
}
.bmt-back:active { transform: scale(.95); background: var(--bm-sunken); }
.bmt-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bmt-back svg { flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2.2; }

.bmt-more { display: flex; justify-content: center; margin: var(--bm-6) 0; }

/* ── СТРАНИЦА ТОВАРА ───────────────────────────────────────── */

.bmt-single {
	background: var(--bm-card);
	border-radius: var(--bm-r-lg);
	overflow: hidden;
	box-shadow: var(--bm-sh-sm);
	/* Запас снизу под закреплённую кнопку покупки. */
	padding-bottom: var(--bm-4);
	margin-bottom: calc(76px + var(--bm-safe-b));
}
@media (min-width: 900px) {
	.bmt-single {
		display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--bm-8); padding: var(--bm-6); margin-bottom: var(--bm-8);
	}
}

.bmt-single__media { background: var(--bm-card); padding: var(--bm-5); }
.bmt-single__media img { margin: 0 auto; max-height: 380px; width: auto; object-fit: contain; }
.bmt-single__media .flex-control-thumbs {
	display: flex; gap: var(--bm-2); list-style: none; padding: 0;
	margin: var(--bm-4) 0 0; overflow-x: auto; scrollbar-width: none;
}
.bmt-single__media .flex-control-thumbs::-webkit-scrollbar { display: none; }
.bmt-single__media .flex-control-thumbs li { flex: 0 0 60px; }
.bmt-single__media .flex-control-thumbs img {
	border-radius: var(--bm-r-xs); border: 1.5px solid var(--bm-line); padding: 3px;
	cursor: pointer; transition: border-color var(--bm-fast) linear;
}
.bmt-single__media .flex-control-thumbs img.flex-active { border-color: var(--bm-blue); }

.bmt-single__body { padding: 0 var(--bm-5); display: flex; flex-direction: column; gap: var(--bm-2); }
@media (min-width: 900px) { .bmt-single__body { padding: 0; } }

.bmt-single__vendor {
	display: inline-flex; align-items: center; gap: var(--bm-1);
	font-size: var(--bm-t-sm); font-weight: 650; color: var(--bm-blue);
}
.bmt-single__vendor svg { stroke: currentColor; fill: none; stroke-width: 1.9; }

.bmt-single__price {
	font-size: var(--bm-t-3xl); font-weight: 800; color: var(--bm-ink);
	letter-spacing: -.03em; line-height: 1.1;
}
.bmt-single__price del { font-size: var(--bm-t-lg); font-weight: 600; color: var(--bm-ink-3); margin-right: var(--bm-2); }
.bmt-single__unit { font-size: var(--bm-t-sm); color: var(--bm-ink-3); }
.bmt-single__title { font-size: var(--bm-t-xl); font-weight: 650; color: var(--bm-ink-2); letter-spacing: -.01em; }
.bmt-single__short { color: var(--bm-ink-2); font-size: var(--bm-t-md); }

.bmt-single__section { margin-top: var(--bm-6); }
.bmt-single__section h2 { font-size: var(--bm-t-lg); margin-bottom: var(--bm-3); }
.bmt-single__section table { width: 100%; border-collapse: collapse; font-size: var(--bm-t-sm); }
.bmt-single__section th, .bmt-single__section td {
	text-align: left; padding: var(--bm-3) 0; border-bottom: 1px solid var(--bm-line);
}
.bmt-single__section th { color: var(--bm-ink-3); font-weight: 600; width: 40%; }
.bmt-single__section td p { margin: 0; }

/* ── ЗАКРЕПЛЁННАЯ КНОПКА ПОКУПКИ ───────────────────────────── */

.bmt-buybar {
	position: fixed; z-index: calc(var(--bm-z-nav) - 1);
	left: 0; right: 0; bottom: calc(var(--bm-nav-h) + var(--bm-safe-b));
	display: flex; align-items: center; gap: var(--bm-3);
	padding: var(--bm-3) var(--bm-4);
	background: color-mix(in srgb, var(--bm-card) 94%, transparent);
	backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
	border-top: 1px solid var(--bm-line);
}
@media (min-width: 900px) {
	.bmt-buybar {
		position: static; background: none; border: none; backdrop-filter: none;
		padding: var(--bm-5) 0 0;
	}
}
.bmt-buybar__price { flex: 0 0 auto; }
.bmt-buybar__amount { font-size: var(--bm-t-xl); font-weight: 800; letter-spacing: -.02em; }
.bmt-buybar__add { flex: 1 1 auto; }
.bmt-buybar__stepper { display: none; flex: 1 1 auto; align-items: center; gap: var(--bm-3); }
.bmt-buybar__go { flex: 1 1 auto; }
.bmt-buybar.has-qty .bmt-buybar__add { display: none; }
.bmt-buybar.has-qty .bmt-buybar__stepper { display: flex; }

/* ── СТРОКИ И ГРУППЫ В КОРЗИНЕ ─────────────────────────────── */

.bmt-cart-group { margin-bottom: var(--bm-5); }
.bmt-cart-group__head {
	display: flex; align-items: center; gap: var(--bm-2);
	font-size: var(--bm-t-sm); font-weight: 700; color: var(--bm-ink);
	padding-bottom: var(--bm-2); border-bottom: 1px solid var(--bm-line);
}
.bmt-cart-group__head svg { stroke: var(--bm-blue); fill: none; stroke-width: 1.9; }

.bmt-line__controls {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--bm-3); margin-top: var(--bm-2);
}
.bmt-cart-loading { display: flex; flex-direction: column; gap: var(--bm-3); padding: var(--bm-4) 0; }

/* ── КОРЗИНА И ОФОРМЛЕНИЕ ──────────────────────────────────── */

.woocommerce-cart-form,
.woocommerce-checkout {
	background: var(--bm-card); border-radius: var(--bm-r);
	padding: var(--bm-5); box-shadow: var(--bm-sh-sm);
}

.woocommerce-checkout .form-row { margin-bottom: var(--bm-4); display: flex; flex-direction: column; gap: var(--bm-1); }
.woocommerce-checkout label { font-size: var(--bm-t-sm); font-weight: 650; color: var(--bm-ink); }

.woocommerce input[type="text"],
.woocommerce input[type="email"],
.woocommerce input[type="tel"],
.woocommerce input[type="password"],
.woocommerce input[type="number"],
.woocommerce textarea,
.woocommerce select {
	width: 100%; min-height: 48px;
	padding: 0 var(--bm-4);
	background: var(--bm-card); color: var(--bm-ink);
	border: 1.5px solid var(--bm-line-2); border-radius: var(--bm-r-sm);
	/* 16px — иначе Safari на iOS зумит при фокусе. */
	font-size: 16px; font-family: inherit;
	transition: border-color var(--bm-fast) linear, box-shadow var(--bm-fast) linear;
}
.woocommerce textarea { min-height: 96px; padding: var(--bm-3) var(--bm-4); resize: vertical; }
.woocommerce input:focus, .woocommerce textarea:focus, .woocommerce select:focus {
	outline: none; border-color: var(--bm-blue); box-shadow: 0 0 0 4px var(--bm-blue-ring);
}

.woocommerce .button,
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--bm-2);
	min-height: 48px; padding: 0 var(--bm-5);
	background: var(--bm-blue); color: var(--bm-ink-on);
	border: none; border-radius: var(--bm-r-sm);
	font-size: var(--bm-t-md); font-weight: 700; cursor: pointer;
	box-shadow: 0 4px 14px var(--bm-blue-ring);
	transition: transform var(--bm-fast) var(--bm-spring), background var(--bm-fast) linear;
}
.woocommerce .button:active { transform: scale(.97); background: var(--bm-blue-press); }
.woocommerce .button.alt { background: var(--bm-blue); }

#place_order { width: 100%; min-height: 54px; font-size: var(--bm-t-lg); border-radius: var(--bm-r); }

.woocommerce-message, .woocommerce-info, .woocommerce-error {
	padding: var(--bm-3) var(--bm-4); border-radius: var(--bm-r-sm);
	font-size: var(--bm-t-sm); margin-bottom: var(--bm-4); list-style: none;
	border-left: 3px solid;
}
.woocommerce-message { background: var(--bm-green-tint); color: var(--bm-green); border-color: var(--bm-green); }
.woocommerce-info    { background: var(--bm-blue-tint);  color: var(--bm-blue-dark); border-color: var(--bm-blue); }
.woocommerce-error   { background: var(--bm-red-tint);   color: var(--bm-red); border-color: var(--bm-red); }

/* ── АККАУНТ ───────────────────────────────────────────────── */

.woocommerce-MyAccount-navigation ul {
	display: flex; gap: var(--bm-2); list-style: none; padding: 0; margin: 0 0 var(--bm-5);
	overflow-x: auto; scrollbar-width: none;
}
.woocommerce-MyAccount-navigation ul::-webkit-scrollbar { display: none; }
.woocommerce-MyAccount-navigation li a {
	display: inline-flex; align-items: center; height: 38px; padding: 0 var(--bm-4);
	background: var(--bm-card); border: 1.5px solid var(--bm-line);
	border-radius: var(--bm-r-pill); white-space: nowrap;
	font-size: var(--bm-t-sm); font-weight: 650; color: var(--bm-ink-2);
}
.woocommerce-MyAccount-navigation li.is-active a {
	background: var(--bm-blue); border-color: var(--bm-blue); color: var(--bm-ink-on);
}
.woocommerce-MyAccount-content {
	background: var(--bm-card); border-radius: var(--bm-r);
	padding: var(--bm-5); box-shadow: var(--bm-sh-sm);
}

.woocommerce table.shop_table {
	width: 100%; border-collapse: collapse; font-size: var(--bm-t-sm);
	display: block; overflow-x: auto;
}
.woocommerce table.shop_table th, .woocommerce table.shop_table td {
	padding: var(--bm-3); border-bottom: 1px solid var(--bm-line); text-align: left;
}
.woocommerce table.shop_table th { color: var(--bm-ink); font-weight: 700; white-space: nowrap; }

/* ── ПОДВАЛ ────────────────────────────────────────────────── */

.bmt-footer {
	background: var(--bm-card); border-top: 1px solid var(--bm-line);
	margin-top: var(--bm-12);
	padding: var(--bm-8) var(--bm-4) calc(var(--bm-nav-h) + var(--bm-safe-b) + var(--bm-6));
}
@media (min-width: 900px) { .bmt-footer { padding-bottom: var(--bm-8); } }
.bmt-footer__inner {
	max-width: 1180px; margin: 0 auto;
	display: grid; grid-template-columns: 1fr; gap: var(--bm-6);
}
@media (min-width: 700px) { .bmt-footer__inner { grid-template-columns: 1.4fr 1fr 1fr; } }
.bmt-footer__tag { color: var(--bm-ink-3); font-size: var(--bm-t-sm); max-width: 40ch; margin: var(--bm-2) 0 0; }
.bmt-footer__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--bm-2); }
.bmt-footer__list a { font-size: var(--bm-t-sm); color: var(--bm-ink-2); }
.bmt-footer__list a:hover { color: var(--bm-blue); }
.bmt-footer__legal {
	max-width: 1180px; margin: var(--bm-6) auto 0; padding-top: var(--bm-4);
	border-top: 1px solid var(--bm-line);
	font-size: var(--bm-t-xs); color: var(--bm-ink-3);
}

/* ── ТЕКСТОВЫЕ СТРАНИЦЫ ────────────────────────────────────── */

.bmt-page-head { margin-bottom: var(--bm-5); }
.bmt-page-head h1 { font-size: var(--bm-t-3xl); }

.bmt-content { max-width: 68ch; color: var(--bm-ink-2); }
.bmt-content h2 { font-size: var(--bm-t-xl); margin: var(--bm-8) 0 var(--bm-3); }
.bmt-content h3 { font-size: var(--bm-t-lg); margin: var(--bm-6) 0 var(--bm-2); }
.bmt-content ul, .bmt-content ol { padding-left: var(--bm-5); }
.bmt-content li { margin: var(--bm-2) 0; }
.bmt-content img { border-radius: var(--bm-r); }
.bmt-content table { width: 100%; border-collapse: collapse; font-size: var(--bm-t-sm); display: block; overflow-x: auto; }

/* ── ЛЕНТА ЗАПИСЕЙ ─────────────────────────────────────────── */

.bmt-posts { display: grid; grid-template-columns: 1fr; gap: var(--bm-4); }
@media (min-width: 700px) { .bmt-posts { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.bmt-post__media img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.bmt-post__title { font-size: var(--bm-t-lg); margin-bottom: var(--bm-2); }
.bmt-post__title a { color: var(--bm-ink); }
.bmt-post__excerpt { color: var(--bm-ink-2); font-size: var(--bm-t-sm); margin: 0; }

/* ── ПАГИНАЦИЯ ─────────────────────────────────────────────── */

.pagination, .woocommerce-pagination { display: flex; justify-content: center; margin: var(--bm-8) 0; }
.pagination .page-numbers, .woocommerce-pagination .page-numbers {
	display: flex; gap: var(--bm-2); list-style: none; padding: 0; margin: 0;
}
.page-numbers a, .page-numbers span {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 40px; height: 40px; padding: 0 var(--bm-3);
	background: var(--bm-card); border: 1px solid var(--bm-line);
	border-radius: var(--bm-r-sm); font-size: var(--bm-t-sm); font-weight: 650;
	color: var(--bm-ink-2);
}
.page-numbers .current { background: var(--bm-blue); border-color: var(--bm-blue); color: var(--bm-ink-on); }

/* ============================================================
 * SINGLE STORE PAGE
 *
 * Dokan's stock layout puts a sidebar next to the products with the
 * whole category tree and a seven-day opening table. Woodmart hid it
 * with its own CSS; our template drops it entirely and shows the same
 * information as a header plus a chip row.
 * ========================================================== */

.bmt-store-page { width: 100%; }

/* Kill the sidebar wherever Dokan still manages to print it —
   store list pages and vendor widgets go through other templates. */
.dokan-store-sidebar,
.dokan-widget-area.widget-collapse,
.bmt-store-page .dokan-store-sidebar { display: none !important; }

.bmt-store-page .dokan-single-store,
.bmt-store-page .dokan-store-wrap { width: 100%; float: none; margin: 0; }

/* ---- header ---- */
.bmt-storehead {
	background: var(--bm-card);
	border-radius: var(--bm-r-lg);
	overflow: hidden;
	box-shadow: var(--bm-sh-sm);
	margin-bottom: var(--bm-4);
}
.bmt-storehead__cover { aspect-ratio: 16 / 6; background: var(--bm-sunken); }
.bmt-storehead__cover img { width: 100%; height: 100%; object-fit: cover; }

.bmt-storehead__bar {
	display: flex; gap: var(--bm-3); align-items: flex-start;
	padding: var(--bm-4);
}
.bmt-storehead__logo {
	flex: 0 0 auto; width: 56px; height: 56px;
	border-radius: var(--bm-r-sm); background: var(--bm-card);
	box-shadow: var(--bm-sh); overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	/* Pull the logo up over the cover, as on the store cards. */
	margin-top: -34px;
}
.bmt-storehead__logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.bmt-storehead__body { flex: 1 1 auto; min-width: 0; }
.bmt-storehead__name { font-size: var(--bm-t-xl); font-weight: 800; letter-spacing: -.02em; }
.bmt-storehead__meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: var(--bm-2);
	margin-top: var(--bm-2); font-size: var(--bm-t-sm); color: var(--bm-ink-2);
}
.bmt-storehead__addr,
.bmt-storehead__hours {
	display: inline-flex; align-items: center; gap: 5px;
	font-size: var(--bm-t-sm); color: var(--bm-ink-2);
}
.bmt-storehead__addr svg, .bmt-storehead__hours svg { stroke: var(--bm-ink-3); fill: none; stroke-width: 1.9; }
.bmt-storehead__hours {
	background: none; border: none; padding: 0; cursor: pointer;
	text-decoration: underline; text-underline-offset: 3px;
}

/* ---- opening hours, collapsed ---- */
.bmt-store-hours {
	border-top: 1px solid var(--bm-line);
	padding: var(--bm-3) var(--bm-4);
	display: flex; flex-direction: column; gap: 2px;
}
.bmt-store-hours__row {
	display: flex; justify-content: space-between;
	font-size: var(--bm-t-sm); color: var(--bm-ink-2);
	padding: 3px 0;
}
.bmt-store-hours__row.is-today { color: var(--bm-ink); font-weight: 700; }

/* ============================================================
 * LAYERING FIX FOR bammat-core
 *
 * PART 7 pins the store bar with position:fixed and top:0, so on a
 * store page it landed on top of the theme header while scrolling.
 * The theme header is sticky and already occupies that strip, so the
 * bar is pushed below it. Height comes from the same token the header
 * uses, so the two stay in step.
 * ========================================================== */

.bmt-store-page [class*="store-bar"][style*="fixed"],
.bmt-store-page .bammat-store-bar,
.bmt-store-page #bammat-store-bar {
	top: calc(var(--bm-header-h) + var(--bm-safe-t)) !important;
	z-index: calc(var(--bm-z-header) - 10) !important;
}

/* The in-app back button from PART 8 sits next to the bottom nav —
   without this it overlaps the first tab. */
.webview-back-button { z-index: calc(var(--bm-z-nav) - 5) !important; }

/* ---- cart page ---- */
.bmt-cartpage__group { margin-bottom: var(--bm-4); padding: var(--bm-4); }
.bmt-cartpage__vendor {
	display: flex; align-items: center; gap: var(--bm-2);
	font-size: var(--bm-t-sm); font-weight: 700; color: var(--bm-ink);
	padding-bottom: var(--bm-3); margin-bottom: var(--bm-2);
	border-bottom: 1px solid var(--bm-line);
}
.bmt-cartpage__vendor svg { stroke: var(--bm-blue); fill: none; stroke-width: 1.9; }
.bmt-cartpage__coupon { display: flex; gap: var(--bm-2); padding: var(--bm-4); margin-bottom: var(--bm-4); }
.bmt-cartpage__coupon input { flex: 1 1 auto; }
.bmt-cartpage__totals .cart-collaterals {
	background: var(--bm-card); border-radius: var(--bm-r);
	padding: var(--bm-5); box-shadow: var(--bm-sh-sm);
}
.bmt-cartpage__totals h2 { font-size: var(--bm-t-lg); margin-bottom: var(--bm-3); }
.bmt-cartpage__totals .checkout-button { width: 100%; margin-top: var(--bm-3); }
