/*
 * Systema Tip Checkout Manager — Cart/Checkout tip inner block.
 *
 * Deliberately inherits the active theme + checkout styling: no hardcoded
 * font-family / font-size and no fixed palette. Colours come from theme.json
 * presets (var(--wp--preset--color--*)) with currentColor fallbacks, spacing
 * uses em so it tracks the surrounding totals text, and the controls reuse the
 * WooCommerce totals rhythm. Tuned to read as part of the Cart/Checkout totals
 * in the active theme (Twenty Twenty-Five / TT5).
 */
.stcm-tip {
	margin: 0;
	padding: 0.75em 0;
	color: inherit;
	/* Inherit the theme's font family, but size the control from the theme's
	   "small" preset so it stays compact wherever the block is placed (the
	   checkout context font can be large). */
	font-family: inherit;
	font-size: var( --wp--preset--font-size--small, 0.9rem );
	line-height: 1.4;
}

.stcm-tip__prompt {
	font-weight: 600;
	margin-bottom: 0.5em;
}

.stcm-tip__presets {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.5em;
}

/* The pills carry .wp-element-button so the active theme's button styles
   (theme.json elements.button) provide the colour, padding, radius and type.
   We only add layout + a selected/idle distinction so we do not fight the
   theme's button design. */
.stcm-tip__btn {
	cursor: pointer;
	/* Share the row equally so all presets sit on one line; keep the theme
	   button's vertical padding (height) but trim the horizontal padding so the
	   set fits the totals column. */
	flex: 1 1 0;
	min-width: 0;
	padding-left: 0.6em;
	padding-right: 0.6em;
	text-align: center;
	white-space: nowrap;
	transition: opacity 0.12s ease;
}

.stcm-tip__btn--idle {
	opacity: 0.5;
}

.stcm-tip__btn:hover,
.stcm-tip__btn:focus-visible {
	opacity: 1;
}

.stcm-tip__btn--active {
	opacity: 1;
	box-shadow: 0 0 0 2px var( --wp--preset--color--contrast, currentColor );
}

.stcm-tip__custom {
	display: flex;
	align-items: stretch; /* input + Apply button share the same height */
	gap: 0.5em;
	flex-wrap: nowrap;
	margin-bottom: 0.6em; /* sits above the preset buttons */
}

.stcm-tip__custom-label {
	display: flex;
	align-items: center; /* label text vertically centred on the row */
	white-space: nowrap;
	font: inherit;
}

.stcm-tip__custom-input {
	flex: 1 1 auto;
	align-self: stretch; /* match the Apply button's height */
	min-width: 4em;
	box-sizing: border-box;
	padding: 0.35em 0.5em;
	border: 1px solid currentColor;
	border-radius: 0.3em;
	background: transparent;
	color: inherit;
	font: inherit;
}

.stcm-tip__custom-input:focus-visible {
	outline: 2px solid var( --wp--preset--color--primary, currentColor );
	outline-offset: 1px;
}

/* .stcm-tip__custom-apply carries .wp-element-button too; the theme styles it. */
.stcm-tip__custom-apply {
	cursor: pointer;
	flex: 0 0 auto;
	white-space: nowrap;
}

/* Editor preview: non-interactive pills rendered as spans. */
.stcm-tip--preview .stcm-tip__btn,
.stcm-tip--preview .stcm-tip__custom-input,
.stcm-tip--preview .stcm-tip__custom-apply {
	cursor: default;
}
