/*
 * Packing panel — storefront panel styles (view layer, genesis-b2b-wkqc.22).
 * Loaded only on packing product pages; everything is scoped under
 * .packing-pb- and the native options block is never restyled.
 */

.packing-pb-panel {
	--packing-pb-accent: #0d6efd;
	--packing-pb-accent-soft: #f2f7ff;
	--packing-pb-border: #e3e9f0;
	min-width: 0;
	max-width: 100%;
}

.packing-pb-panel > .hpm-block-prd {
	margin: 0 0 8px;
}

.packing-pb-panel > .hpm-block-prd .hpm-button > .hpmcircle,
.packing-pb-panel > .hpm-block-prd .hpm-button > .hpmsquare,
.packing-pb-panel > .hpm-block-prd .hpm-button > img {
	width: 50px !important;
	height: 40px !important;
}

.packing-pb-panel > .hpm-block-prd .hpmcircle img,
.packing-pb-panel > .hpm-block-prd .hpmsquare img,
.packing-pb-panel > .hpm-block-prd .hpm-button > img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Unit price line above the choice (fnbu.3): FOOD «/ шт.», footwear «/ пара». */
.packing-pb-unit-price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 6px;
	margin-bottom: 2px;
	line-height: 1.2;
}

.packing-pb-unit-price-value {
	font-size: 28px;
	font-weight: 700;
	color: #25314c;
	white-space: nowrap;
}

.packing-pb-unit-price-old,
.packing-pb-unit-price-from,
.packing-pb-unit-price-unit {
	font-size: 16px;
	font-weight: 400;
	color: #6b7a90;
}

.packing-pb-unit-price-from[hidden],
.packing-pb-unit-price-base[hidden],
.packing-pb-unit-price-badge[hidden],
.packing-pb-total-saving[hidden],
.packing-pb-bar-saving[hidden] {
	display: none;
}

/* Personal discount (s50y.4.7): struck base unit price and «−N%», green unlike the theme's promo stickers. */
.packing-pb-unit-price-base {
	font-size: 16px;
	color: #6b7a90;
	text-decoration: line-through;
	white-space: nowrap;
}

.packing-pb-unit-price-badge {
	padding: 2px 8px;
	border-radius: 6px;
	background: #1f9d55;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

/* РРЦ on the unit / pair line (genesis-b2b-7nce): at the right, never struck; a narrow line wraps it whole onto a
 * line of its own. Layout only: undoes the full-row basis of the listing .fila-rrp and keeps the body line height
 * it had as a line of its own, so its look does not change. */
.packing-pb-unit-price > .fila-rrp {
	flex-basis: auto;
	width: auto;
	margin-left: auto;
	line-height: var(--bs-body-line-height);
}

/* Readability (genesis-b2b-m398): the РРЦ label stays muted, its amount is dark and a touch heavier; the panel only. */
.packing-pb-unit-price > .fila-rrp {
	color: #6b7a90;
}

.packing-pb-unit-price > .fila-rrp .packing-pb-rrp-value {
	color: #25314c;
	font-weight: 500;
}

/* Short supplier note line (genesis-b2b-7nce): «ⓘ label | Умови» reads as text and a link, without the
 * disclosure marker; the text inherits the note's classes. */
.packing-pb-panel .fila-supplier-note-summary {
	display: block;
	color: #4a5568;
	list-style: none;
}

.packing-pb-panel .fila-supplier-note-summary::-webkit-details-marker {
	display: none;
}

.packing-pb-panel .fila-supplier-note-summary::before {
	content: "\24D8";
	margin-right: 4px;
}

/* Toggle label (genesis-b2b-m398): «Умови ▾» closed, «Згорнути ▴» open, by details[open] alone. */
.packing-pb-panel .fila-note-less,
.packing-pb-panel details[open] .fila-note-more {
	display: none;
}

.packing-pb-panel details[open] .fila-note-less {
	display: inline;
}

.packing-pb-panel .fila-note-more::after,
.packing-pb-panel .fila-note-less::after {
	content: " \25BE";
	font-size: 0.85em;
}

.packing-pb-panel .fila-note-less::after {
	content: " \25B4";
}

/* The short note is a card like a packing row (genesis-b2b-bpox): border, radius, light background; the
 * summary is the whole card's click target. */
.packing-pb-panel details.fila-supplier-note {
	margin-top: 10px !important;
	padding: 8px 12px;
	border: 1px solid var(--packing-pb-border);
	border-radius: 8px;
	background: #f8fafc;
}

.packing-pb-panel .fila-supplier-note-summary {
	cursor: pointer;
}

/* The opened full note unfolds inside the same card under a thin rule (replaces the m398 accent box);
 * readable dark text, it overrides the light-text / fsz-12 of the details. */
.packing-pb-panel .fila-supplier-note-summary + div {
	margin-top: 8px !important;
	padding-top: 8px;
	border-top: 1px solid var(--packing-pb-border);
	font-size: 14px;
	line-height: 1.45;
	color: #25314c;
}

/* The block gap sits above the heading, so it holds with or without a supplier note under the price line. */
.packing-pb-heading {
	margin-top: 20px;
}

/* The HPMrr per-type title (FOOD «Інші види») reads as a panel heading. */
.packing-pb-heading,
.packing-pb-panel > .hpm-block-prd > h3 {
	font-size: 16px;
	font-weight: 600;
	color: #25314c;
	margin-bottom: 8px;
}

.packing-pb-rows {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.packing-pb-row {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 4px 6px;
	min-height: 44px;
	padding: 8px 10px;
	border: 1px solid var(--packing-pb-border);
	border-radius: 8px;
	cursor: pointer;
	background: #fff;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.packing-pb-row:hover {
	border-color: var(--packing-pb-accent);
}

.packing-pb-row:focus-within {
	outline: 2px solid var(--packing-pb-accent);
	outline-offset: 2px;
}

.packing-pb-row.packing-pb-row-selected {
	border-color: var(--packing-pb-accent);
	border-width: 2px;
	background: var(--packing-pb-accent-soft);
	padding: 7px 9px;
}

/* The selected border already marks the focused row; the outline would read as a second ring. */
.packing-pb-row.packing-pb-row-selected:focus-within {
	outline: none;
}

.packing-pb-radio {
	flex: 0 0 auto;
	margin: 0;
	width: 18px;
	height: 18px;
}

.packing-pb-row-code,
.packing-pb-row-range,
.packing-pb-row-pairs {
	font-size: 14px;
	color: #25314c;
	white-space: nowrap;
}

.packing-pb-row-pairs {
	color: #6b7a90;
}

.packing-pb-row-sep {
	color: #c3ccd8;
}

.packing-pb-row-price {
	margin-left: auto;
	font-size: 14px;
	font-weight: 700;
	color: #25314c;
	white-space: nowrap;
}

.packing-pb-row-price-unit {
	font-weight: 500;
	color: #6b7a90;
}

/* Composition block (Склад одного ящика) */

.packing-pb-composition {
	margin-top: 10px;
}

.packing-pb-composition[hidden],
.packing-pb-qty[hidden],
.packing-pb-total[hidden],
.packing-pb-bar-total[hidden] {
	display: none;
}

.packing-pb-block {
	background: var(--packing-pb-accent-soft);
	border-radius: 8px;
	padding: 10px 12px;
}

.packing-pb-comp-title {
	font-size: 14px;
	font-weight: 600;
	color: #25314c;
	margin-bottom: 8px;
}

.packing-pb-comp-scroll {
	overflow-x: auto;
}

.packing-pb-comp-scroll:focus {
	outline: 2px solid var(--packing-pb-accent);
	outline-offset: 2px;
}

.packing-pb-comp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	background: #fff;
	border: 1px solid #dce6f2;
}

.packing-pb-comp-table th,
.packing-pb-comp-table td {
	padding: 5px 8px;
	text-align: center;
	border: 1px solid #dce6f2;
	white-space: nowrap;
}

.packing-pb-comp-table th {
	text-align: left;
	font-weight: 600;
	color: #25314c;
}

.packing-pb-food-comp-table thead th {
	text-align: center;
}

.packing-pb-comp-footer {
	margin-top: 6px;
	font-size: 12px;
	color: #6b7a90;
}

.packing-pb-comp-text {
	font-size: 13px;
	color: #25314c;
}

/* FOOD compact composition: case metric strip and pallet 2x2 grid */

.packing-pb-case-strip {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	background: #fff;
	border-radius: 8px;
	padding: 10px 0;
}

.packing-pb-case-cell {
	min-width: 0;
	padding: 2px 10px;
	text-align: center;
}

.packing-pb-case-cell + .packing-pb-case-cell {
	border-left: 1px solid #dce6f2;
}

.packing-pb-case-label {
	font-size: 12px;
	color: #6b7a90;
}

.packing-pb-case-value {
	margin-top: 2px;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.2;
	color: #25314c;
}

.packing-pb-pallet-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	row-gap: 10px;
	column-gap: 12px;
	background: #fff;
	border-radius: 8px;
	padding: 10px 12px;
}

.packing-pb-pallet-item {
	display: flex;
	align-items: baseline;
	gap: 10px;
	min-width: 0;
}

.packing-pb-pallet-item:nth-child(even) {
	border-left: 1px solid #d3e2f0;
	padding-left: 12px;
}

.packing-pb-pallet-label {
	font-size: 14px;
	color: #25314c;
	min-width: 0;
}

.packing-pb-pallet-value {
	flex: 0 0 auto;
	font-size: 20px;
	font-weight: 700;
	color: #25314c;
	white-space: nowrap;
}

/* Quantity stepper + summary */

.packing-pb-qty {
	margin-top: 12px;
	display: grid;
	grid-template-columns: max-content minmax(86px, 1fr);
	grid-template-areas:
		"label label"
		"stepper summary"
		"error error"
		"total total";
	align-items: end;
	gap: 6px 12px;
}

/* Label line (xfc5): «Кількість ящиків» left, the selected box stock right; the stock wraps under it on a narrow phone. */
.packing-pb-qty-head {
	grid-area: label;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 2px 12px;
	min-width: 0;
}

.packing-pb-qty-stock {
	margin-left: auto;
	font-size: 13px;
	color: #6b7a90;
	text-align: right;
}

.packing-pb-qty-label {
	font-size: 14px;
	font-weight: 600;
	color: #25314c;
}

/* Footwear (hd0p): no label line; the stock caption sits right of − [N] + and wraps under it when the row is too narrow. */
.packing-pb-panel[data-kind="footwear"] .packing-pb-qty:not([hidden]) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
}

.packing-pb-panel[data-kind="footwear"] .packing-pb-qty-error,
.packing-pb-panel[data-kind="footwear"] .packing-pb-total {
	flex: 1 0 100%;
}

.packing-pb-stepper {
	grid-area: stepper;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.packing-pb-step {
	width: 44px;
	height: 44px;
	border: 1px solid var(--packing-pb-border);
	border-radius: 8px;
	background: #fff;
	font-size: 18px;
	line-height: 1;
	color: #25314c;
	cursor: pointer;
}

.packing-pb-step:hover {
	border-color: var(--packing-pb-accent);
}

.packing-pb-qty-input {
	width: 64px;
	height: 44px;
	text-align: center;
	border: 1px solid var(--packing-pb-border);
	border-radius: 8px;
}

.packing-pb-summary {
	grid-area: summary;
	min-width: 0;
	align-self: end;
	justify-self: end;
	text-align: right;
}

.packing-pb-summary-boxes {
	font-size: 13px;
	color: #6b7a90;
}

/* «Разом» row under the stepper and breakdown (fnbu.3); on a phone the bottom bar carries it. */
.packing-pb-total {
	grid-area: total;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0 12px;
	margin-top: 6px;
	padding-top: 12px;
	border-top: 1px solid var(--packing-pb-border);
}

.packing-pb-total-label {
	font-size: 16px;
	font-weight: 600;
	color: #25314c;
}

.packing-pb-total-value {
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	color: #25314c;
}

/* «економія N ₴» on its own line under the sum (s50y.4.7). */
.packing-pb-total-saving {
	flex: 1 0 100%;
	text-align: right;
	font-size: 13px;
	color: #6b7a90;
}

.packing-pb-bar-saving {
	font-size: 12px;
	font-weight: 400;
	color: #6b7a90;
}

.packing-pb-qty-error {
	grid-area: error;
	width: 100%;
	font-size: 13px;
}

/* CTA + note */

.packing-pb-cart-wrap {
	margin-top: 14px;
}

.packing-pb-cart {
	width: 100%;
	min-height: 44px;
}

.packing-pb-note {
	margin-top: 10px;
	font-size: 12px;
	color: #6b7a90;
}

.packing-pb-bar-total {
	font-size: 15px;
	font-weight: 700;
	color: #25314c;
	white-space: nowrap;
}

/* Responsive: compact rows stay on one line and the native CTA moves into a mobile bar. */

@media (max-width: 767.98px) {
	.packing-pb-row {
		gap: 3px 4px;
		padding-right: 8px;
		padding-left: 8px;
	}

	.packing-pb-row.packing-pb-row-selected {
		padding-right: 7px;
		padding-left: 7px;
	}

	.packing-pb-row-code,
	.packing-pb-row-range,
	.packing-pb-row-pairs,
	.packing-pb-row-price {
		font-size: clamp(11px, 3.35vw, 13px);
	}

	.packing-pb-row-price-unit {
		font-size: 0.92em;
	}

	.packing-pb-case-label {
		font-size: 11px;
	}

	.packing-pb-case-value {
		font-size: 20px;
	}

	.packing-pb-pallet-label {
		font-size: clamp(12px, 3.35vw, 14px);
	}

	.packing-pb-pallet-value {
		font-size: 18px;
	}

	.packing-pb-qty {
		grid-template-areas:
			"label label"
			"stepper summary"
			"error error"
			"total total";
		gap: 6px 8px;
	}

	.packing-pb-unit-price-value {
		font-size: 24px;
	}

	.packing-pb-total {
		display: none;
	}

	.packing-pb-bar-total--stacked {
		display: flex;
		flex-direction: column;
		line-height: 1.2;
	}

	.packing-pb-bar-total-label {
		font-size: 12px;
		font-weight: 400;
		color: #6b7a90;
	}

	.packing-pb-bar-total--stacked .packing-pb-bar-total-value {
		font-size: 19px;
	}

	/* FOOD (epic D3 c, e): composition as one line in the selected row; package prices on one line. */
	.packing-pb-panel[data-kind="food"] .packing-pb-composition {
		display: none;
	}

	.packing-pb-panel[data-kind="food"] .packing-pb-row-selected .packing-pb-row-comp {
		display: block;
	}

	/* One line down to 360 px for the longest pallet chain («56 ящиків × 6 дисплеїв × 150 шт. = 50400 шт.»). */
	.packing-pb-panel[data-kind="food"] .packing-pb-row-comp {
		padding-left: 0;
		white-space: nowrap;
		font-size: clamp(10px, calc((100vw - 72px) / 28), 12px);
	}

	.packing-pb-panel[data-kind="food"] .packing-pb-row-main {
		flex: 1 1 auto;
	}

	.packing-pb-panel[data-kind="food"] .packing-pb-row-price {
		font-size: clamp(11px, 3.1vw, 12px);
	}

	.packing-pb-summary-boxes {
		font-size: 12px;
		white-space: nowrap;
	}

	.packing-pb-bar-total {
		flex: 0 0 auto;
	}

	.packing-pb-cart-wrap {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
	}

	.packing-pb-panel:has(.packing-pb-cart-wrap--fixed) {
		padding-bottom: 90px;
	}

	/* Leave the last footer links scrollable above the anchored purchase bar. */
	body:has(.packing-pb-cart-wrap--fixed) .ds-footer {
		padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
	}

	body:has(.packing-pb-cart-wrap--fixed):has(.ds-mobile-bottom-nav) .ds-footer {
		padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
	}

	.packing-pb-cart-wrap--fixed {
		--packing-pb-border: #e3e9f0;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1040;
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
		background: #fff;
		border-top: 1px solid var(--packing-pb-border);
		box-shadow: 0 -4px 14px rgba(37, 49, 76, 0.08);
	}

	body:has(.ds-mobile-bottom-nav) .packing-pb-cart-wrap--fixed {
		bottom: 69px;
	}

	.packing-pb-cart {
		flex: 1 1 0;
		width: auto;
		min-width: 0;
		margin: 0;
		padding-right: 8px;
		padding-left: 8px;
		white-space: normal;
		overflow-wrap: anywhere;
	}
}

@media (max-width: 359.98px) {
	.packing-pb-panel {
		padding-right: 8px !important;
		padding-left: 8px !important;
	}

	.packing-pb-row {
		gap: 2px;
		padding-right: 6px;
		padding-left: 6px;
	}

	.packing-pb-row.packing-pb-row-selected {
		padding-right: 5px;
		padding-left: 5px;
	}

	.packing-pb-radio {
		width: 16px;
		height: 16px;
	}

	.packing-pb-row-code,
	.packing-pb-row-range,
	.packing-pb-row-pairs,
	.packing-pb-row-price {
		font-size: 11px;
	}

	.packing-pb-row-price-unit {
		font-size: 0.92em;
	}

	.packing-pb-case-cell {
		padding: 2px 6px;
	}

	.packing-pb-case-label {
		font-size: 10px;
	}

	.packing-pb-case-value {
		font-size: 18px;
	}

	.packing-pb-pallet-item {
		gap: 6px;
	}

	.packing-pb-pallet-item:nth-child(even) {
		padding-left: 8px;
	}

	.packing-pb-pallet-label {
		font-size: 11px;
	}

	.packing-pb-pallet-value {
		font-size: 16px;
	}

	.packing-pb-qty {
		grid-template-columns: 140px minmax(0, 1fr);
		gap: 6px;
	}

	.packing-pb-stepper {
		gap: 4px;
	}

	.packing-pb-qty-input {
		width: 44px;
	}

	.packing-pb-summary-boxes {
		font-size: 11px;
	}

	/* Narrower than 360 px the composition line may wrap rather than overflow the row. */
	.packing-pb-panel[data-kind="food"] .packing-pb-row-comp {
		white-space: normal;
	}

}

@media (min-width: 768px) {
	.packing-pb-bar-total {
		display: none !important;
	}
}

.packing-pb-row-disabled {
	opacity: .58;
	cursor: not-allowed;
}

.packing-pb-panel[data-kind="food"] .packing-pb-row {
	flex-wrap: wrap;
}

.packing-pb-row-main {
	flex: 1 1 180px;
	min-width: 0;
	font-size: 14px;
	color: #25314c;
}

.packing-pb-row-comp {
	display: none;
	flex: 1 0 100%;
	padding-left: 24px;
	font-size: 12px;
	color: #6b7a90;
}

.packing-pb-unit-price-old {
	color: #6b7a90;
	text-decoration: line-through;
}

/* Size grid mode (00da.3, 00da.6): packing rows with a compact stepper instead of a radio and a price. */
.packing-pb-panel[data-kind="sizes"] .packing-pb-row {
	padding-top: 6px;
	padding-bottom: 6px;
	cursor: default;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-row.packing-pb-row-selected {
	padding-top: 5px;
	padding-bottom: 5px;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-row-label {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 6px;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-stepper {
	flex: 0 0 auto;
	margin-left: auto;
	gap: 4px;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-step {
	width: 30px;
	height: 30px;
	font-size: 16px;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-step:disabled {
	opacity: .4;
	cursor: not-allowed;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-step:disabled:hover {
	border-color: var(--packing-pb-border);
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-qty-input {
	width: 44px;
	height: 30px;
	padding: 0 2px;
}

.packing-pb-panel[data-kind="sizes"] .packing-pb-summary {
	margin-top: 12px;
}

.packing-pb-unavailable {
	margin: 12px 0;
	padding: 12px;
	border-radius: 8px;
	background: #fff4e5;
}

@media (max-width: 767.98px) {
	.packing-pb-row-main {
		font-size: clamp(12px, 3.7vw, 14px);
	}
}

/* Guest product page (genesis-b2b-ktke.4, genesis-b2b-an1c): the mobile bottom bar. */
@media (max-width: 767.98px) {
	.fila-guest-bar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1040;
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
		background: #fff;
		border-top: 1px solid #e3e9f0;
		box-shadow: 0 -4px 14px rgba(37, 49, 76, 0.08);
	}

	body:has(.ds-mobile-bottom-nav) .fila-guest-bar {
		bottom: 69px;
	}

	body:has(.fila-guest-bar) .ds-footer {
		padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
	}

	body:has(.fila-guest-bar):has(.ds-mobile-bottom-nav) .ds-footer {
		padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
	}
}
