/*
 * Bitrix adaptation layer.
 *
 * This file contains only migration-specific rules and WP runtime fragments
 * that have to be adapted to Bitrix markup or local asset paths. Do not add
 * migration changes to lib/woodmart/css: that directory is reserved for
 * untouched Woodmart source assets.
 */

/* Checkout review and the copied CDEK pickup widget. */
.woocommerce-checkout-review-order-table { display: flex; flex-direction: column; margin-bottom: 0; }
.woocommerce-checkout-review-order-table tr { display: flex; border-bottom: 1px solid var(--brdcolor-gray-300); }
.woocommerce-checkout-review-order-table :is(th, td) { border: none; }
.woocommerce-checkout-review-order-table thead tr { border-width: 2px; }
.woocommerce-checkout-review-order-table thead th { flex-basis: 50%; }
.woocommerce-checkout-review-order-table tfoot tr { align-items: center; }
.woocommerce-checkout-review-order-table tfoot tr:last-child { border: none; }
.woocommerce-checkout-review-order-table tfoot td,
.woocommerce-checkout-review-order-table .cart_item .product-name { flex-grow: 1; }
.checkout-order-review > .woocommerce-checkout-review-order .wd-table-wrapper { overflow-x: auto; margin-bottom: 20px; padding: 5px 25px; border-radius: var(--wd-brd-radius); background-color: var(--bgcolor-white); box-shadow: 1px 1px 2px rgba(0, 0, 0, .05); }
.payment_methods { --li-mb: 15px; margin: 0; padding: 0; list-style: none; }
.payment_methods li > label { display: inline; margin-bottom: 0; }
.payment_methods .payment_box { position: relative; margin-top: 15px; padding: 15px; background-color: var(--bgcolor-white); box-shadow: 1px 1px 2px rgba(0, 0, 0, .05); border-radius: var(--wd-brd-radius); }
.payment_methods .payment_box::before { content: ""; position: absolute; inset-inline-start: 25px; bottom: 100%; width: 15px; height: 15px; background-color: inherit; clip-path: polygon(50% 50%, 0% 103%, 100% 103%); }
.payment_methods .payment_box p:last-child,
.woocommerce-terms-and-conditions-wrapper p:last-child { margin-bottom: 0; }
.woocommerce-terms-and-conditions-wrapper { padding-top: 20px; border-top: 1px solid var(--brdcolor-gray-300); }
.woocommerce-terms-and-conditions-wrapper a { font-weight: 600; }
.woocommerce-privacy-policy-text:not(:last-child) { margin-bottom: 20px; border-bottom: 1px solid var(--brdcolor-gray-300); }
.vm-checkout-delivery-note { color: red; }
.vm-checkout-delivery-note mark { color: red; background-color: #fffe4e; }
#place_order { padding: 5px 28px; min-height: 48px; font-size: 14px; border-radius: var(--btn-accented-brd-radius); color: var(--btn-accented-color); box-shadow: var(--btn-accented-box-shadow); background-color: var(--btn-accented-bgcolor); text-transform: var(--btn-accented-transform, var(--btn-transform, uppercase)); font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600)); font-family: var(--btn-accented-font-family, var(--btn-font-family, inherit)); font-style: var(--btn-accented-font-style, var(--btn-font-style, unset)); }
.wd-builder-off #place_order { width: 100%; }
@media (max-width: 576px) { .checkout-order-review > .woocommerce-checkout-review-order .wd-table-wrapper { padding: 5px 10px; } }
.vm-cdek-pvz { margin: 8px 0 0; }
.vm-cdek-pvz-selected { background: #d3d3d3; border-radius: 4px; color: #111; font-size: 13px; line-height: 1.4; margin: 5px 0 7px; padding: 7px 10px; }
.vm-cdek-pvz-button { background: #2daa51; border: 0; border-radius: 4px; color: #fff; cursor: pointer; display: block; font-size: 11px; font-weight: 700; line-height: 1.2; padding: 8px 12px; text-align: center; width: 100%; }
.vm-cdek-pvz-button:hover { background: #238e42; }
#cdek-map:empty { display: none; }

/* #customer_login grid vars: on the real site these come from Woodmart's dynamic
 * per-page "predefined" CSS, not an inline style attribute — the markup itself has
 * none, so we keep the values in a stylesheet instead of on the wrapper element. */
#customer_login { --wd-col-lg: 2; --wd-col-sm: 1; --wd-gap-lg: 80px; --wd-gap-md: 40px; --wd-gap-sm: 30px; }

/* Account rules absent from the copied Woodmart bundle. */
.woocommerce-MyAccount-content > h2,
.woocommerce-MyAccount-content header > h2 { text-transform: uppercase; font-size: 22px; }
.woocommerce-MyAccount-content > p { font-size: 110%; }
.woocommerce-MyAccount-content .woocommerce-Message { margin-bottom: 30px !important; }
.woocommerce-MyAccount-content > .col-1 { max-width: 100%; padding: 0; }
.woocommerce-EditAccountForm fieldset { margin-top: 40px; }
.woocommerce-MyAccount-navigation ul li.is-active > a { cursor: default; }
.woocommerce-MyAccount-navigation ul li:last-child { border-bottom: none; }
.woocommerce-orders-table td.woocommerce-orders-table__cell-order-actions { padding-bottom: 5px; }
.woocommerce-orders-table td.woocommerce-orders-table__cell-order-actions > a { margin-bottom: 10px; }
.wd-my-account-links .dashboard-link { display: none; }
.global-color-scheme-light .wd-my-account-links a { background-color: var(--bgcolor-gray-200); }
header.title { margin-bottom: 10px; }
.woocommerce-Address-title > h2 { text-transform: none; }
.woocommerce-Address-title .edit { color: var(--wd-link-color); font-weight: var(--wd-text-font-weight); font-style: var(--wd-text-font-style); font-family: var(--wd-text-font); font-size: 1.1em; }
.woocommerce-Address-title .edit:before { margin-inline-end: 7px; font-weight: 400; content: "\f116"; font-family: "woodmart-font"; }
.woocommerce-address-add-form { display: inline; }
.woocommerce-address-add-form .edit { border: 0; background: transparent; padding: 0; }
.woocommerce-form__label { cursor: pointer; }
button[name="save_account_details"],
button[name="save_address"] { border-radius: var(--btn-shop-brd-radius); color: var(--btn-shop-color); box-shadow: var(--btn-shop-box-shadow); background-color: var(--btn-shop-bgcolor); }
.woocommerce-address-fields__field-wrapper { display: flex; flex-wrap: wrap; gap: 0 20px; }
.woocommerce-address-fields__field-wrapper > .form-row { box-sizing: border-box; flex: 0 0 100%; width: 100%; }
.woocommerce-address-fields__field-wrapper > .form-row-first,
.woocommerce-address-fields__field-wrapper > .form-row-last { flex-basis: calc(50% - 10px); width: calc(50% - 10px); }

/* Cart-specific Bitrix markup fixes. */
.woocommerce-cart-form__contents .product-thumbnail img { display: block; width: 100%; height: auto; }
.woocommerce-cart-form__contents .wd-product-detail { margin: 5px 0; color: var(--color-gray-500); font-size: 90%; }
.woocommerce-cart-form__contents .quantity { display: inline-flex; align-items: center; }
.woocommerce-cart-form__contents .quantity .minus,
.woocommerce-cart-form__contents .quantity .plus { cursor: pointer; }
@media (min-width: 1025px) {
	.cart-content-wrapper { flex-wrap: nowrap; }
	.cart-content-wrapper > .woocommerce-cart-form,
	.cart-content-wrapper > .cart-totals-section { min-width: 0; }
}

/* Exact Woodmart source fragment previously held in a Bitrix-only file. */
:is(.wd-empty-block-title, .wd-empty-block-text, .return-to-shop) { text-align: center; }
.cart-empty { --wd-empty-block-icon: "\f147"; }

/* Woodmart 404 page: keep the original theme geometry and typography. */
.error404 .page-header { position: relative; margin-bottom: 20px; font-size: clamp(32px, 4.2vw, 82px); }
.error404 .page-header:before { content: "404"; position: absolute; top: 50%; left: 50%; color: var(--color-gray-200); font-weight: 700; font-size: 5em; line-height: 1; transform: translate(-50%, -50%); }
.error404 .page-header h3 { position: relative; padding: 1.5em 0; text-align: center; text-transform: uppercase; font-weight: 900; font-size: inherit; line-height: 1; color: var(--wd-primary-color); }
.error404 .page-content { text-align: center; }
.error404 .page-content p { font-size: 110%; }
.error404 .page-content > .wd-search-form { margin: 0 auto; max-width: 400px; }

/* Product detail gallery. Woodmart's `autoHeight` follows the current source
 * image. Our migrated source files have different native geometry, so that
 * calculation moves the thumbnail rail after a slide switch. Keep only the
 * visible main stage and its slides at the production desktop height; leave
 * the Swiper track and the outer wrappers to Woodmart. */
.single-product-page .woocommerce-product-gallery .wd-gallery-images { position: relative; }

.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight,
.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .wd-carousel-item {
	height: 581px;
}

.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .product-image-wrap,
.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .woocommerce-product-gallery__image,
.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .woocommerce-product-gallery__image > a {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .woocommerce-product-gallery__image > a > img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
}

@media (max-width: 1024px) {
	.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight,
	.single-product-page .woocommerce-product-gallery .wd-gallery-images .wd-carousel.wd-autoheight .wd-carousel-item {
		height: min(581px, calc(100vw - 30px));
	}
}

/* Woodmart stock notification replaces the disabled add-to-cart action. */
.single-product-page .wd-stock-notify-component { margin-top: 20px; }
.single-product-page .wd-stock-notify-button { display: block; width: 100%; min-height: 42px; padding: 12px 20px; border: 0; background: #f5f5f5; color: #111; font-size: 13px; line-height: 1.4; text-transform: uppercase; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.single-product-page .wd-stock-notify-button:hover { background: #e9e9e9; }
.single-product-page .wd-stock-notify-label { display: block; margin-top: 14px; margin-bottom: 7px; font-size: 13px; }
.single-product-page .wd-stock-notify-form-row { display: flex; gap: 10px; }
.single-product-page .wd-stock-notify-form input { flex: 1 1 auto; min-width: 0; height: 42px; padding: 0 14px; border: 1px solid #d9d9d9; }
.single-product-page .wd-stock-notify-submit { flex: 0 0 auto; padding: 0 16px; border: 0; background: #f5f5f5; color: #111; font-size: 12px; text-transform: uppercase; cursor: pointer; }
.single-product-page .wd-stock-notify-message { margin-top: 14px; color: #159c2a; line-height: 1.6; }
.single-product-page .wd-stock-notify-error { margin-top: 10px; color: #e22; line-height: 1.5; }
/* Main-gallery image sizing also remains native: the production CSS defines
 * only the carousel geometry and lets the image keep its own source ratio. */
.single-product-page .woocommerce-product-gallery > .product-labels { position: absolute; z-index: 10; top: 15px; inset-inline-end: 15px; display: flex; flex-direction: column; align-items: flex-end; }
.single-product-page .woocommerce-product-gallery > .product-labels .product-label.wd-shape-round { min-width: 55px; min-height: 55px; }

/* Search suggestions: on WordPress every suggestion thumbnail is a square
 * woocommerce_thumbnail (200x200), so the rows of the dropdown line up. Bitrix
 * resizes proportionally, which leaves images of different heights and makes the
 * cards ragged. Keep the file proportional (never crop a product) and restore the
 * production canvas here. Category suggestions keep their own 18px icon rules. */
.wd-suggestions-group:not(.wd-type-categories) .wd-suggestion-thumb img {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	object-position: 50% 50%;
}

@media (max-width: 1024px) {
	body:not(.single-product) .woocommerce-breadcrumb .wd-last-link ~ span {
		display: inline;
	}
}

@media (max-width: 768.98px) {
	.wd-registration-page .wd-grid-f-col {
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	.wd-registration-page .wd-grid-f-col > .wd-col {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
}

.wc-checkout-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wc-checkout-popup-overlay.active {
	opacity: 1;
	visibility: visible;
}

.wc-checkout-popup-container {
	width: 90%;
	max-width: 600px;
	max-height: 90vh;
	overflow-y: auto;
	transform: scale(0.7);
	transition: transform 0.3s ease;
}

.wc-checkout-popup-overlay.active .wc-checkout-popup-container {
	transform: scale(1);
}

.wc-checkout-popup-content {
	position: relative;
	padding: 30px;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	background-color: #ffffff;
	color: #333333;
}

.wc-checkout-popup-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: none;
	border: none;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: 0.6;
	transition: opacity 0.2s ease;
	padding: 0;
	width: 30px;
	height: 30px;
}

.wc-checkout-popup-close:hover {
	opacity: 1;
}

.wc-checkout-popup-title {
	margin: 0 0 20px 0;
	font-size: 24px;
	font-weight: bold;
	text-align: center;
}

.wc-checkout-popup-body {
	margin-bottom: 25px;
	line-height: 1.6;
}

.wc-checkout-popup-body p {
	text-align: center;
}

.wc-checkout-popup-body p:last-child {
	margin-bottom: 0;
}

.wc-checkout-popup-accent {
	color: red;
}

.wc-checkout-popup-footer {
	text-align: center;
}

.wc-checkout-popup-button {
	padding: 12px 30px;
	border: none;
	border-radius: 4px;
	background-color: #c90000;
	color: #ffffff;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.wc-checkout-popup-button:hover {
	opacity: 0.9;
}

@media (max-width: 768px) {
	.wc-checkout-popup-content {
		padding: 20px;
	}

	.wc-checkout-popup-title {
		font-size: 20px;
		margin-bottom: 15px;
	}

	.wc-checkout-popup-close {
		top: 10px;
		right: 10px;
		font-size: 25px;
	}
}

@media (max-width: 480px) {
	.wc-checkout-popup-container {
		width: 95%;
	}

	.wc-checkout-popup-content {
		padding: 15px;
	}

	.wc-checkout-popup-title {
		font-size: 18px;
	}

	.wc-checkout-popup-button {
		padding: 10px 20px;
		font-size: 14px;
	}
}
