/* Cart and checkout comfort (Shturko_Cart_UX). Soft UI tokens: --sh-* from shturko-soft-ui.css.
   Every rule is scoped to body.woocommerce-cart / body.woocommerce-checkout. */

/* 1. #main already clears the fixed header; the global .content-bg offset added the
   header height a second time (same fix as My Account in class-account.php). */
html body:is(.woocommerce-cart, .woocommerce-checkout):not(.home) .entry.content-bg {
	padding-top: 0 !important;
	margin-top: 0 !important;
}
body:is(.woocommerce-cart, .woocommerce-checkout) .entry-content-wrap {
	padding-top: 0 !important;
}

/* 2. Secondary controls stay small: the one big button is «Към плащане». */
html body.woocommerce-cart .woocommerce-cart-form :is(button[name="apply_coupon"], button[name="update_cart"]),
html body.woocommerce-checkout .checkout_coupon button[name="apply_coupon"] {
	min-height: 40px !important;
	height: auto !important;
	padding: 0.45rem 1.1rem !important;
	font-size: 0.95rem !important;
	line-height: 1.2 !important;
	/* Design system secondary: white pill, navy label, no border, soft shadow. */
	background: rgba(255, 255, 255, 0.92) !important;
	color: #123b64 !important;
	border: 0 !important;
	box-shadow: 0 5px 14px rgba(31, 51, 67, 0.12) !important;
	transition: transform 180ms ease, box-shadow 180ms ease !important;
}
html body.woocommerce-cart .woocommerce-cart-form :is(button[name="apply_coupon"], button[name="update_cart"]):is(:hover, :focus-visible),
html body.woocommerce-checkout .checkout_coupon button[name="apply_coupon"]:is(:hover, :focus-visible) {
	background: rgba(255, 255, 255, 0.92) !important;
	color: #123b64 !important;
	transform: translateY(-2px) !important;
	box-shadow: 0 10px 22px rgba(31, 51, 67, 0.16) !important;
}

/* Quantities update by themselves (shturko-cart.js), so the update button is not needed. */
html.sh-cart-auto body.woocommerce-cart .woocommerce-cart-form button[name="update_cart"] {
	display: none !important;
}

body:is(.woocommerce-cart, .woocommerce-checkout) #coupon_code {
	height: 40px;
	min-height: 40px;
	min-width: 15rem;
	padding: 0.45rem 0.85rem;
	font-size: 1rem; /* 16px: phones do not zoom into the field */
	border: 1px solid var(--sh-line, rgba(31, 69, 104, 0.12));
	border-radius: var(--sh-radius-sm, 14px);
	background: #fff;
	box-shadow: none;
	transition: border-color 180ms ease, box-shadow 180ms ease;
}

body:is(.woocommerce-cart, .woocommerce-checkout) #coupon_code:hover {
	border-color: rgba(31, 69, 104, 0.3);
}

/* Focus as in the profile fields: navy border + soft halo, one line instead of the
   site-wide double ring. Same layer as that rule so the id selector wins it. */
@layer shturko-quiet-controls {
	html body:is(.woocommerce-cart, .woocommerce-checkout) #coupon_code:focus {
		border-color: var(--sh-ink, #1f4568) !important;
		box-shadow: 0 0 0 3px rgba(31, 69, 104, 0.08) !important;
		outline: none !important;
	}
}

/* Coupon field with the voucher list. */
.sh-vpick-wrap {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	max-width: 100%;
}

.checkout_coupon .sh-vpick-wrap {
	display: block;
}

/* WooCommerce floats the cart field; the box takes over that place. */
.woocommerce-cart .coupon .sh-vpick-wrap {
	float: left;
	margin: 0 0.5rem 0 0;
}

body:is(.woocommerce-cart, .woocommerce-checkout) .sh-vpick-wrap #coupon_code {
	float: none;
	width: 100%;
	margin: 0;
	padding-right: 2.6rem;
}

/* Arrow inside the field: shows the field is also a list. */
body:is(.woocommerce-cart, .woocommerce-checkout) .sh-vpick-toggle {
	position: absolute;
	top: 0;
	right: 0;
	width: 2.5rem;
	height: 40px; /* the field's height: an error line under the field must not move it */
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	cursor: pointer;
}

.sh-vpick-toggle::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 2px solid var(--sh-ink, #1f4568);
	border-bottom: 2px solid var(--sh-ink, #1f4568);
	transform: translate(-50%, -70%) rotate(45deg);
	transition: transform 0.15s;
}

.sh-vpick-wrap.is-open .sh-vpick-toggle::before {
	transform: translate(-50%, -30%) rotate(-135deg);
}

.sh-vpick {
	position: absolute;
	z-index: 30;
	top: 44px;
	left: 0;
	width: max(100%, min(26rem, calc(100vw - 2rem)));
	max-height: 18rem;
	overflow-y: auto;
	margin: 0;
	padding: 0.35rem;
	list-style: none;
	background: #fff;
	border: 1px solid var(--sh-line, rgba(31, 69, 104, 0.12));
	border-radius: var(--sh-radius-sm, 14px);
	box-shadow: 0 12px 34px rgba(31, 69, 104, 0.16);
	text-align: left;
}

.sh-vpick__opt {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0;
	padding: 0.55rem 0.65rem;
	border-radius: 10px;
	cursor: pointer;
	color: var(--sh-text, #34506a);
	font-size: 0.95rem;
	line-height: 1.3;
}

.sh-vpick__opt:hover,
.sh-vpick__opt[aria-selected="true"] {
	background: var(--sh-tint, #fbebe3);
}

.sh-vpick__opt[aria-disabled="true"] {
	cursor: default;
	background: none;
	opacity: 0.7;
}

.sh-vpick__amount {
	flex: none;
	min-width: 3.4rem;
	padding: 0.3rem 0.45rem;
	border: 1.5px dashed currentColor;
	border-radius: 8px;
	color: var(--sh-tint-ink, #b83a14);
	text-align: center;
	white-space: nowrap;
}

.sh-vpick__opt.is-applied .sh-vpick__amount {
	color: #2e7d4f;
}

.sh-vpick__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.sh-vpick__name {
	color: var(--sh-ink, #1f4568);
}

.sh-vpick__meta {
	font-size: 0.85rem;
	color: var(--sh-text-muted, #5a7088);
	overflow-wrap: anywhere;
}

.sh-vpick-msg {
	margin: 0.35rem 0 0;
	font-size: 0.9rem;
	color: var(--sh-tint-ink, #b83a14);
}

/* 4. «Добавете и» — quiet row under the cart table. */
.sh-cart-more {
	margin: 1.75rem 0 0.5rem;
}

.sh-cart-more__h {
	margin: 0 0 0.75rem;
	font-size: 1.1rem !important;
	line-height: 1.3;
	color: var(--sh-ink, #1f4568);
}

.sh-cart-more__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
	gap: 0.6rem;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
}

.sh-cart-more__item {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	margin: 0;
	padding: 0.55rem 0.7rem;
	background: #fff;
	border: 1px solid var(--sh-line, rgba(31, 69, 104, 0.12));
	border-radius: var(--sh-radius-sm, 14px);
}

.sh-cart-more__img {
	flex: none;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 10px;
	background: #f5f7f9;
}

.sh-cart-more__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	margin: 0 !important;
}

.sh-cart-more__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
	font-size: 0.9rem;
	line-height: 1.3;
}

html body .sh-cart-more__name {
	color: var(--sh-ink, #1f4568) !important;
	text-decoration: none !important;
}

html body .sh-cart-more__name:is(:hover, :focus-visible) {
	text-decoration: underline !important;
}

.sh-cart-more__price {
	color: var(--sh-text-muted, #5a7088);
}

html body.woocommerce-cart .sh-cart-more a.sh-cart-more__add {
	flex: none;
	min-height: 34px !important;
	height: auto !important;
	padding: 0.35rem 0.8rem !important;
	font-size: 0.875rem !important;
	line-height: 1.2 !important;
	background: var(--sh-tint, #fbebe3) !important;
	color: var(--sh-tint-ink, #b83a14) !important;
	box-shadow: none !important;
}

html body.woocommerce-cart .sh-cart-more a.sh-cart-more__add:is(:hover, :focus-visible) {
	background: var(--sh-tint-hover, #f7dccf) !important;
	transform: none !important;
}

/* WooCommerce adds «Преглед на количката» after a quick add; the cart reloads anyway. */
.sh-cart-more .added_to_cart {
	display: none !important;
}

@media (max-width: 560px) {
	body:is(.woocommerce-cart, .woocommerce-checkout) #coupon_code {
		min-width: 0;
		width: 100%;
	}

	.sh-vpick-wrap {
		display: block;
		width: 100%;
	}
}

/* "Added to cart" notice: text first, then the button with a gap, both on the left
   edge; WooCommerce focuses the notice on load, so no dark focus outline on it. */
html body.woocommerce-cart .woocommerce-notices-wrapper .woocommerce-message,
html body.woocommerce-checkout .woocommerce-notices-wrapper .woocommerce-message {
	flex-direction: column !important;
	align-items: flex-start !important;
	gap: 0.85rem !important;
}
html body.woocommerce-cart .woocommerce-message::before { display: none !important; }
html body.woocommerce-cart .woocommerce-message > .button { margin: 0 !important; float: none !important; }
html body :is(.woocommerce-message, .woocommerce-info, .woocommerce-error):focus { outline: none !important; }

/* Coupon: the apply button sits under the field with a gap, on one line. */
html body.woocommerce-cart .coupon {
	display: flex !important;
	flex-direction: column !important;
	align-items: flex-start !important;
	gap: 0.75rem !important;
}
html body.woocommerce-cart .coupon .sh-vpick-wrap { width: 100%; }
html body.woocommerce-cart .coupon button[name="apply_coupon"] { white-space: nowrap !important; width: auto !important; margin: 0 !important; }

/* Product picture: the 60px placeholder box with 22px padding left a ~16px picture. */
html body.woocommerce-cart td.product-thumbnail img {
	width: 180px !important;
	height: auto !important;
	max-width: 100% !important;
	aspect-ratio: 16 / 9 !important;
	padding: 0 !important;
	object-fit: contain;
	border-radius: 14px;
}
