/*
 * Quick View layout fix — стили окна «Быстрый просмотр» (YITH 1.43.0) поверх плагина и темы.
 * Подключается с зависимостью от handle `yith-quick-view`, поэтому печатается после плагина;
 * !important стоит только там, где плагин или lptheme задают то же свойство жёстко.
 *
 * Палитра снята с боевого сайта: текст #334141, синий #296DC1, шрифт Montserrat.
 */

/* ---------- окно: размер по содержимому вместо жёстких 1000x600 ---------- */

#yith-quick-view-modal .yith-wcqv-wrapper {
	width: auto !important;
	height: auto !important;
	max-width: 900px;
	max-height: calc(100vh - 32px);
}

#yith-quick-view-modal .yith-wcqv-main,
#yith-quick-view-modal.open .yith-wcqv-main {
	height: auto !important;
	max-height: 85vh;
	padding: 0 !important;
	overflow-x: hidden !important;
	overflow-y: auto !important; /* было scroll — полоса рисовалась всегда */
	border-radius: 4px;
	box-shadow: 0 18px 50px rgba(10, 20, 20, .28);
}

#yith-quick-view-modal #yith-quick-view-content {
	height: auto !important;
	padding: 32px;
}

/* ---------- сетка: колонки вместо float, чтобы контейнер не схлопывался ---------- */

#yith-quick-view-content .product .product {
	display: flex;
	gap: 32px;
	align-items: flex-start;
}

#yith-quick-view-content div.images,
#yith-quick-view-content .woocommerce-product-gallery {
	flex: 0 0 38%;
	max-width: 38%;
	width: auto !important;
	float: none !important;
	margin: 0 !important;
}

/* lptheme задаёт галерее фиксированную высоту ради страницы товара
   (.woocommerce div.product div.images .woocommerce-product-gallery__wrapper — 530px,
   430px с 1024 и 330px с 768). В окне это оставляет до 190 точек пустоты под фотографией,
   поэтому здесь высота идёт по содержимому, а размер ограничивает сама картинка. */
#yith-quick-view-content div.images .woocommerce-product-gallery__wrapper,
#yith-quick-view-content .woocommerce-product-gallery__wrapper,
#yith-quick-view-content .woocommerce-product-gallery__image {
	height: auto;
}

#yith-quick-view-content .woocommerce-product-gallery img {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 380px;
	margin: 0 auto;
}

#yith-quick-view-content div.summary {
	flex: 1 1 auto;
	min-width: 0;
	width: auto !important;
	float: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

#yith-quick-view-content .summary-content {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

#yith-quick-view-content .summary-content > * {
	margin: 0 !important;
}

#yith-quick-view-content .product_title {
	font-size: 24px;
	line-height: 1.25;
}

/* ---------- цена ---------- */

#yith-quick-view-content .price {
	font-size: 22px;
	font-weight: 600;
}

#yith-quick-view-content .bkr-qv-ask {
	font-size: 19px;
	font-weight: 500;
	color: #334141;
}

#yith-quick-view-content .bkr-qv-ask-hint {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	font-weight: 400;
	color: #7b8888;
}

/* ---------- описание: шесть строк и ссылка в карточку ---------- */

#yith-quick-view-content .woocommerce-product-details__short-description {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 6;
	overflow: hidden;
	font-size: 14px;
	line-height: 1.55;
	color: #4a5757;
}

#yith-quick-view-content .woocommerce-product-details__short-description p:last-child,
#yith-quick-view-content .woocommerce-product-details__short-description ul:last-child {
	margin-bottom: 0;
}

#yith-quick-view-content .bkr-qv-more {
	align-self: flex-start;
	font-size: 14px;
	color: #296DC1;
	text-decoration: none;
	border-bottom: 1px solid rgba(41, 109, 193, .35);
}

#yith-quick-view-content .bkr-qv-more::after {
	content: " \2192";
}

#yith-quick-view-content .bkr-qv-more:hover {
	border-bottom-color: #296DC1;
}

/* ---------- кнопки: одна строка, одна высота ---------- */

#yith-quick-view-content form.cart {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: stretch;
	margin: 0 !important;
}

#yith-quick-view-content form.cart::before,
#yith-quick-view-content form.cart::after {
	content: none !important; /* clearfix темы ломает flex-строку */
}

#yith-quick-view-content form.cart .quantity {
	flex: 0 0 auto;
	float: none !important;
	margin: 0 !important;
}

/* тема целится в #awooc-custom-order-button, а в окне у кнопки id с номером товара,
   поэтому здесь и ниже — только класс */
#yith-quick-view-content form.cart .single_add_to_cart_button,
#yith-quick-view-content form.cart .awooc-custom-order-button,
#yith-quick-view-content .awooc-custom-order-button {
	flex: 1 1 150px;
	min-width: 142px;
	height: 46px;
	padding: 0 14px;
	margin: 0 !important;
	float: none !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	line-height: 1;
}

/* пустой маркер режима «цена по запросу»: в потоке его быть не должно,
   но как соседний селектор он продолжает работать и скрытым */
#yith-quick-view-content .bkr-qv-ask-mode {
	display: none;
}

/* товар без цены: корзину и счётчик гасит сам AWOOC, заявка остаётся одна — делаем её главной */
#yith-quick-view-content .bkr-qv-ask-mode ~ form.cart .awooc-custom-order-button,
#yith-quick-view-content .bkr-qv-ask-mode ~ .awooc-custom-order-button {
	background: #296DC1 !important;
	border-color: #296DC1 !important;
	color: #fff !important;
	flex: 1 1 100%;
}

/* ---------- артикул и категория ---------- */

#yith-quick-view-content .product_meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	padding-top: 14px;
	border-top: 1px solid #e4e8e8;
	font-size: 13px;
	color: #7b8888;
}

/* ---------- одна кнопка закрытия вместо квадрата и отдельного крестика ---------- */

#yith-quick-view-close {
	top: 8px !important;
	right: 8px !important;
	width: 40px !important;
	height: 40px !important;
	border: 0 !important;
	border-radius: 3px;
	font-size: 0 !important;
	line-height: 0 !important;
	opacity: 1 !important;
	background: transparent;
	display: flex !important;
	align-items: center;
	justify-content: center;
}

#yith-quick-view-close:hover {
	background: #f1f4f4;
}

#yith-quick-view-close::after {
	content: "" !important;
	position: static !important;
	right: auto !important;
	top: auto !important;
	width: 18px !important;
	height: 18px !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1' viewBox='0 0 24 24'%3E%3Cpath d='M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z' fill='%23334141'%3E%3C/path%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

/* ---------- планшет и телефон ---------- */

@media (max-width: 768px) {
	#yith-quick-view-modal .yith-wcqv-wrapper {
		max-width: calc(100vw - 20px);
	}

	#yith-quick-view-modal .yith-wcqv-main,
	#yith-quick-view-modal.open .yith-wcqv-main {
		max-height: 90vh;
	}

	#yith-quick-view-modal #yith-quick-view-content {
		padding: 20px;
	}

	#yith-quick-view-content .product .product {
		flex-direction: column;
		gap: 18px;
	}

	#yith-quick-view-content div.images,
	#yith-quick-view-content .woocommerce-product-gallery {
		flex: none;
		max-width: 60%;
		margin: 0 auto !important;
	}

	#yith-quick-view-content .product_title {
		font-size: 19px;
	}

	#yith-quick-view-content .woocommerce-product-gallery img {
		max-height: 260px;
	}

	#yith-quick-view-content form.cart .quantity,
	#yith-quick-view-content form.cart .single_add_to_cart_button,
	#yith-quick-view-content form.cart .awooc-custom-order-button,
	#yith-quick-view-content .awooc-custom-order-button {
		flex: 1 1 100%;
	}
}

@media (max-width: 600px) {
	#yith-quick-view-content .woocommerce-product-details__short-description {
		-webkit-line-clamp: 4;
	}
}
