/*
 * A field with its button beside it: the promo code (the cart page's Cart block, the card checkout of the main site,
 * PS IN and Xbox TR, the classic checkout of /digital/, /retro/, /xbox-games-us/ and the main site's /checkout/) and
 * the wishlist page's link to the list. One look (Kirill, 2026-10-22): a 48px field with 12px corners and no label
 * of its own (the panel, the notice or the line above it says what it is for), and the accent pill beside it. On the
 * dark pages the field takes the card colour, like the catalog's search field; on the classic checkout it keeps the
 * form's own colours (light on /digital/). Loaded on every page: the wishlist page is any page with the shortcode.
 *
 * Before: the cart page had WooCommerce's white field with a pale floating "Введите код", the card checkout square
 * corners (giftcard-checkout-page.css), the classic checkout a full-width upper-case button (snippet 28, then
 * checkout.css), the wishlist a small framed field and a "Copy" button with a glow.
 * The words are in storefront.php and js/wc-strings.js.
 */

/* ── The look ───────────────────────────────────────────────────────────────── */

:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__form .wc-block-components-text-input input[type="text"],
.woocommerce form.checkout_coupon input#coupon_code,
.woosw-list .woosw-copy input#woosw_copy_url {
	box-sizing: border-box;
	width: 100%;
	height: 48px;
	min-height: 0;
	margin: 0;
	padding: 0 16px;
	border-radius: 12px;
	font-family: Onest, sans-serif;
	font-size: 16px;
	line-height: normal;
	box-shadow: none;
	outline: none;
}

:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__form .wc-block-components-text-input input[type="text"],
body.gp-card-checkout-shell form.checkout_coupon input#coupon_code,
.woosw-list .woosw-copy input#woosw_copy_url {
	border: 1px solid transparent;
	background: var(--wp--preset--color--custom-card-background);
	color: var(--wp--preset--color--primary);
	transition: border-color 0.2s ease;
}

:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__form .wc-block-components-text-input input[type="text"]:focus,
body.gp-card-checkout-shell form.checkout_coupon input#coupon_code:focus,
.woosw-list .woosw-copy input#woosw_copy_url:focus {
	border-color: var(--wp--preset--color--accent);
}

body.gp-card-checkout-shell form.checkout_coupon input#coupon_code::placeholder {
	color: #7A7A7A;
	opacity: 1;
}

:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__button,
.woocommerce form.checkout_coupon button[name="apply_coupon"],
.woosw-list .woosw-copy button#woosw_copy_btn {
	flex: none;
	width: auto;
	height: 48px;
	min-height: 0;
	margin: 0;
	padding: 0 24px;
	border: 0;
	border-radius: 30px;
	background: var(--wp--preset--color--accent);
	box-shadow: none;
	color: #121212;
	font-family: Onest, sans-serif;
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
}

/* ── Promo code ─────────────────────────────────────────────────────────────── */

.wc-block-components-totals-coupon__form,
.woocommerce form.checkout_coupon {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

/* The classic form starts hidden by an inline display: none, which WooCommerce's script takes off when the notice's
   link is clicked; then this flex row shows. Its two rows lose their floats and widths. */
.woocommerce form.checkout_coupon .form-row {
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
}

.woocommerce form.checkout_coupon .form-row-first {
	flex: 1 1 auto;
	min-width: 0;
}

.woocommerce form.checkout_coupon .form-row-last {
	flex: none;
}

.woocommerce form.checkout_coupon .clear {
	display: none;
}

:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__form .wc-block-components-text-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

/* The floating "Введите код": the field keeps it as its aria-label */
:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__form .wc-block-components-text-input label {
	display: none;
}

/* Until a code is typed WooCommerce disables the button and fades its label; the faded accent says enough, the label
   stays readable (from snippet 102) */
:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) .wc-block-components-totals-coupon__button .wc-block-components-button__text {
	color: #121212;
	opacity: 1 !important;
}

/* ── The wishlist's link ────────────────────────────────────────────────────── */

/* "Ссылка на список" above, the field and "Скопировать" under it (js/wishlist.js copies it) */
.woosw-list .woosw-actions {
	display: block;
	margin-top: 24px;
}

.woosw-list .woosw-copy {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.woosw-list .woosw-copy .woosw-copy-label {
	flex: 0 0 100%;
	color: #A4A4A4;
	font-size: 14px;
}

.woosw-list .woosw-copy .woosw-copy-url {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}
