/* Gift Cards for WooCommerce – storefront styles. Inherits theme fonts and colours where possible. */

.wcgc-fields {
	margin: 0 0 1.5em;
}

.wcgc-fieldset {
	border: 0;
	margin: 0 0 1.25em;
	padding: 0;
	min-width: 0;
}

.wcgc-legend {
	font-weight: 600;
	margin: 0 0 0.6em;
	padding: 0;
}

.wcgc-amounts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.wcgc-amount {
	position: relative;
	cursor: pointer;
	margin: 0;
}

.wcgc-amount input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.wcgc-amount span {
	display: inline-block;
	min-width: 4.5em;
	padding: 0.6em 1.1em;
	border: 1px solid;
	border-color: color-mix(in srgb, currentColor 25%, transparent);
	border-radius: var(--wp--custom--border--radius, 999px);
	text-align: center;
	font-weight: 600;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.wcgc-amount:hover span {
	border-color: currentColor;
}

/* Selected amount uses the theme's button colours (block themes) or inverts the text colour (classic themes). */
.wcgc-amount input:checked + span {
	background: var(--wp--preset--color--contrast, currentColor);
	border-color: var(--wp--preset--color--contrast, currentColor);
}

.wcgc-amount input:checked + span,
.wcgc-amount input:checked + span * {
	color: var(--wp--preset--color--base, #fff);
}

.wcgc-amount input:focus-visible + span {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.wcgc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0 1em;
}

.wcgc-field {
	margin: 0 0 0.9em;
}

.wcgc-field label {
	display: block;
	font-size: 0.9em;
	margin-bottom: 0.3em;
}

.wcgc-field input,
.wcgc-field textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.wcgc-field textarea {
	resize: vertical;
}

.wcgc-custom-amount {
	margin-top: 0.9em;
	max-width: 260px;
}

.wcgc-hint {
	display: block;
	opacity: 0.7;
	margin-top: 0.3em;
}

/* Redemption + balance boxes */

.wcgc-redeem,
.wcgc-balance {
	margin: 0 0 1.5em;
	padding: 1em 1.25em;
	border: 1px dashed;
	border-color: color-mix(in srgb, currentColor 25%, transparent);
	border-radius: 8px;
}

.wcgc-redeem__label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5em;
}

.wcgc-redeem__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
}

.wcgc-redeem__row .input-text {
	flex: 1 1 220px;
	min-width: 0;
	width: auto;
	margin: 0;
	text-transform: uppercase;
}

.wcgc-redeem__row .input-text::placeholder {
	text-transform: none;
}

.wcgc-redeem__row .button {
	flex: 0 0 auto;
	margin: 0;
}

.wcgc-redeem.is-loading,
.wcgc-balance.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.wcgc-message {
	margin: 0.75em 0 0;
	font-size: 0.95em;
}

.wcgc-message--error {
	color: #b32d2e;
}

.wcgc-message--success {
	color: #1a7f37;
}

.wcgc-balance__result {
	margin-top: 0.9em;
}

.wcgc-balance__amount {
	font-size: 1.8em;
	font-weight: 700;
	margin: 0;
}

.wcgc-balance__meta {
	margin: 0.2em 0 0;
	opacity: 0.75;
}

.wcgc-applied-row .wcgc-remove {
	font-size: 0.85em;
	margin-left: 0.4em;
}

/* Cart and Checkout blocks ------------------------------------------------ */

.wcgc-block-applied .wc-block-components-totals-item__value {
	white-space: nowrap;
}

.wcgc-block-remove {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	font-size: 0.875em;
	text-decoration: underline;
	cursor: pointer;
	opacity: 0.8;
}

.wcgc-block-remove:hover,
.wcgc-block-remove:focus-visible {
	opacity: 1;
}

.wcgc-block-remove:disabled {
	cursor: wait;
	opacity: 0.5;
}

/* The form re-uses WooCommerce's panel and text-input classes, so only layout is set here. */
.wcgc-block-redeem {
	margin: 0;
}

.wcgc-block-redeem__row {
	display: flex;
	align-items: stretch;
	gap: 0.5em;
	margin: 0;
}

.wcgc-block-redeem__field.wc-block-components-text-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

.wcgc-block-redeem__field input {
	text-transform: uppercase;
}

.wcgc-block-redeem__apply {
	flex: 0 0 auto;
	min-height: 3em;
	padding: 0 1.25em;
}

.wcgc-block-redeem__apply:disabled,
.wcgc-block-redeem__input:disabled {
	opacity: 0.6;
	cursor: wait;
}

.wcgc-block-message {
	margin: 0.6em 0 0;
	font-size: 0.875em;
}

.wcgc-block-message--error {
	color: #cc1818;
}

.wcgc-block-message--success {
	color: #00733f;
}
