/* =====================================================================
   Balance — страница товара
   ===================================================================== */

.bal-pdp { padding-bottom: 48px; }
.bal-pdp__notices { padding-top: 16px; }

.bal-pdp__top {
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	gap: 48px;
	padding-top: 32px;
	margin-bottom: 48px;
}

/* ---------- Галерея (WooCommerce) ---------- */
.bal-pdp__gallery .woocommerce-product-gallery { position: relative; }
.bal-pdp__gallery .woocommerce-product-gallery__wrapper { margin: 0; }
.bal-pdp__gallery .woocommerce-product-gallery__image,
.bal-pdp__gallery-ph {
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: var(--bg-gray);
}
.bal-pdp__gallery-ph { position: relative; aspect-ratio: 1/1; }
.bal-pdp__gallery img { border-radius: var(--radius-lg); }

/* Кнопка приближения (лайтбокс). WooCommerce вставляет её через JS как эмодзи-лупу 🔍 —
   прячем эмодзи и переоформляем в аккуратную круглую кнопку с иконкой «развернуть». */
.bal-pdp__gallery .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border-radius: 9999px;
	background: #fff;
	border: 1px solid var(--border);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
	overflow: hidden;
	text-indent: 0;   /* сбрасываем стандартный сдвиг WooCommerce */
	font-size: 0;     /* прячем эмодзи-лупу */
	color: transparent;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.bal-pdp__gallery .woocommerce-product-gallery__trigger::before {
	content: "";
	width: 20px;
	height: 20px;
	background: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%231A2E12'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M15%203h6v6M9%2021H3v-6M21%203l-7%207M3%2021l7-7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.bal-pdp__gallery .woocommerce-product-gallery__trigger:hover {
	border-color: var(--green);
	box-shadow: var(--shadow-card);
}
.bal-pdp__gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 12px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}
.bal-pdp__gallery .flex-control-thumbs li { list-style: none; }
.bal-pdp__gallery .flex-control-thumbs img {
	border: 2px solid transparent;
	border-radius: var(--radius);
	cursor: pointer;
	transition: border-color .15s;
}
.bal-pdp__gallery .flex-control-thumbs img:hover,
.bal-pdp__gallery .flex-control-thumbs .flex-active { border-color: var(--green); }
.bal-pdp__gallery .onsale,
.bal-pdp__gallery .bal-badge--sale {
	position: absolute;
	top: 16px;
	left: 16px;
	z-index: 2;
	margin: 0;
}

/* ---------- Кастомная галерея по фасовкам (вариативные товары) ---------- */
.bal-pdp__gallery-main {
	aspect-ratio: 1 / 1;
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: var(--bg-gray);
	display: flex;
	align-items: center;
	justify-content: center;
}
.bal-pdp__gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bal-pdp__gallery-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 10px;
	margin-top: 14px;
}
.bal-pdp__gthumb {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 4px;
	background: #fff;
	border: 2px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	transition: border-color .15s;
}
.bal-pdp__gthumb:hover { border-color: var(--gold); }
.bal-pdp__gthumb.is-active { border-color: var(--green); }
.bal-pdp__gthumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: calc(var(--radius) - 2px); background: var(--bg-gray); display: block; }
.bal-pdp__gthumb-label { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1; }
.bal-pdp__gthumb.is-active .bal-pdp__gthumb-label { color: var(--green-dark); }

/* ---------- Сводка ---------- */
.bal-pdp__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.bal-pdp__instock { color: var(--green); font-weight: 600; }
.bal-pdp__outstock { color: var(--red); font-weight: 600; }
.bal-pdp__title { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 16px; }

.bal-pdp__price { margin-bottom: 20px; }
.bal-pdp__price .price { font-size: 36px; font-weight: 800; color: var(--green-dark); letter-spacing: -0.01em; }
.bal-pdp__price .price del { font-size: 18px; color: var(--muted-2); font-weight: 400; margin-left: 10px; }
.bal-pdp__price .price ins { text-decoration: none; }

/* ---------- Форма «в корзину» (WooCommerce) ---------- */
.bal-pdp__form { margin-bottom: 24px; }
.bal-pdp__form .variations { width: 100%; margin-bottom: 16px; border-collapse: collapse; }
.bal-pdp__form .variations th { text-align: left; padding: 8px 12px 8px 0; font-size: 14px; font-weight: 600; vertical-align: middle; }
.bal-pdp__form .variations td { padding: 8px 0; }
.bal-pdp__form .variations select {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: var(--radius-btn);
	padding: 12px 16px;
	font-size: 14px;
	font-family: inherit;
	outline: none;
}
.bal-pdp__form .variations select:focus { border-color: var(--green); }
.bal-pdp__form .reset_variations { font-size: 13px; color: var(--muted); margin-left: 8px; }

.bal-pdp__form .quantity { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-btn); overflow: hidden; height: 56px; margin-right: 12px; }
.bal-pdp__form .quantity input.qty {
	width: 56px; height: 56px;
	border: 0; text-align: center;
	font-size: 16px; font-weight: 600;
	outline: none;
	-moz-appearance: textfield;
}
.bal-pdp__form .quantity input.qty::-webkit-outer-spin-button,
.bal-pdp__form .quantity input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.bal-pdp__form .single_add_to_cart_button,
.bal-pdp__form button[type="submit"] {
	height: 56px;
	min-width: 220px;
	background: var(--green);
	color: #fff;
	border: 0;
	border-radius: var(--radius-btn);
	font-weight: 700;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: .03em;
	cursor: pointer;
	transition: background-color .15s;
}
.bal-pdp__form .single_add_to_cart_button:hover { background: var(--green-hover); }
.bal-pdp__form .woocommerce-variation-add-to-cart { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.bal-pdp__form .woocommerce-variation-price .price { font-size: 24px; font-weight: 800; color: var(--green-dark); }
.bal-pdp__form .woocommerce-variation-price .price del { font-size: 16px; color: var(--muted-2); font-weight: 400; margin-left: 8px; }
.bal-pdp__form .woocommerce-variation-price .price ins { text-decoration: none; }
.bal-pdp__form .cart { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

/* ---------- Кастомная форма покупки (вес кнопками) ---------- */
.bal-pdp__buy { margin-bottom: 24px; }
.bal-pdp__weights { margin-bottom: 16px; }
.bal-pdp__weights-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.bal-pdp__weights-row { display: flex; flex-wrap: wrap; gap: 8px; }
.bal-pdp__weights-row .bal-variation { min-width: 64px; height: 44px; padding: 0 18px; font-size: 14px; }

.bal-pdp__buy-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 12px; position: relative; }

.bal-pdp__buy-row .bal-product-card__fav {
	position: static;
	width: 56px;
	height: 56px;
	border-radius: var(--radius-btn);
	border-width: 2px;
}
.bal-pdp__add {
	flex: 1;
	min-width: 220px;
	height: 56px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: .03em;
}

/* Цена под выбранный вес (JS заменяет содержимое .bal-pdp__price). */
.bal-pdp__price .bal-price { font-size: 36px; font-weight: 800; color: var(--green-dark); letter-spacing: -0.01em; }
.bal-pdp__price .bal-price--old { font-size: 18px; margin-left: 10px; }

/* Цена за 100 г */
.bal-pdp__per100 { font-size: 13px; color: var(--muted); margin-bottom: 16px; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bal-pdp__per100-val { font-weight: 700; color: var(--text); }
.bal-pdp__per100-val .woocommerce-Price-amount { color: inherit; }
/* Бейдж экономии при крупной фасовке */
.bal-pdp__save {
	display: inline-block;
	background: var(--green-bg, #EAF5E2);
	color: var(--green-dark, #2f7d16);
	font-weight: 700;
	font-size: 12px;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 999px;
}
.bal-pdp__save[hidden] { display: none; }

/* Кнопка «Купить в 1 клик» */
.bal-pdp__quick {
	height: 52px;
	margin-top: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: .03em;
}

@media (max-width: 480px) {
	/* Форма покупки: количество + сердечко в один ряд, кнопка «В корзину» — во всю ширину под ними. */
	.bal-pdp__buy-row .bal-qty { flex: 1 1 auto; }
	.bal-pdp__buy-row .bal-product-card__fav { order: 2; }
	.bal-pdp__add { order: 3; flex-basis: 100%; min-width: 0; }
}

/* ---------- Блок доставки ---------- */
.bal-pdp__delivery { background: var(--bg-gray); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.bal-pdp__delivery-item { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; }
.bal-pdp__delivery-item .bal-icon { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.bal-pdp__delivery-title { font-weight: 600; margin-bottom: 2px; }

/* ---------- Табы ---------- */
.bal-pdp__tabs { margin-bottom: 48px; }
.bal-pdp__tabnav { display: flex; gap: 32px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.bal-pdp__tab {
	background: none; border: 0;
	padding: 0 0 12px;
	font-size: 14px; font-weight: 600;
	color: var(--muted);
	position: relative;
	transition: color .15s;
}
.bal-pdp__tab:hover { color: var(--text); }
.bal-pdp__tab.is-active { color: var(--text); }
.bal-pdp__tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--gold); }
.bal-pdp__panel { display: none; font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 760px; }
.bal-pdp__panel.is-active { display: block; }
.bal-pdp__panel p { margin-bottom: 12px; }
.bal-pdp__pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bal-pdp__list { list-style: disc; padding-left: 20px; margin-top: 8px; }
.bal-pdp__list li { margin-bottom: 8px; }

/* Таблица характеристик WooCommerce */
.bal-pdp__panel .woocommerce-product-attributes { width: 100%; border-collapse: collapse; font-size: 14px; }
.bal-pdp__panel .woocommerce-product-attributes th,
.bal-pdp__panel .woocommerce-product-attributes td { padding: 12px 0; border-bottom: 1px solid var(--border); text-align: left; }
.bal-pdp__panel .woocommerce-product-attributes th { color: var(--muted); font-weight: 400; width: 40%; }
.bal-pdp__panel .woocommerce-product-attributes td { font-weight: 600; color: var(--text); }

/* ---------- Преимущества ---------- */
.bal-pdp__features { background: var(--bg-gray); border-radius: var(--radius-lg); padding: 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.bal-pdp__feature { display: flex; align-items: flex-start; gap: 12px; }
.bal-pdp__feature-icon { font-size: 24px; }
.bal-pdp__feature-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }

/* ---------- Похожие товары ---------- */
.related.products { margin-top: 48px; }
.related.products > h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.related.products ul.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; list-style: none; margin: 0; padding: 0; }
.related.products ul.products li.product { list-style: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
	.bal-pdp__top { grid-template-columns: 1fr; gap: 24px; }
	.bal-pdp__features { grid-template-columns: 1fr 1fr; }
	.related.products ul.products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
	.bal-pdp__features { grid-template-columns: 1fr; }
	.bal-pdp__price .price { font-size: 28px; }
	.bal-pdp__title { font-size: 22px; }
	/* Табы: 4 длинных пункта — компактный gap, горизонтальная прокрутка вместо рыхлого переноса. */
	.bal-pdp__tabnav { gap: 16px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.bal-pdp__tab { white-space: nowrap; }
}
