/**
 * Checkout and sign-in gate styles.
 *
 * Deliberately restrained: colours and type are inherited from the theme so
 * the form does not fight the surrounding page.
 *
 * @package ICF_Cohort_Payments
 */

.icf-checkout {
	--icf-border: rgba(0, 0, 0, 0.15);
	--icf-muted: rgba(0, 0, 0, 0.62);
	--icf-accent: currentColor;

	/*
	 * The button needs a guaranteed contrast pair. currentColor cannot supply
	 * one: on a dark theme it resolves to the same near-white as the text.
	 */
	--icf-button-bg: #1a1a1a;
	--icf-button-fg: #ffffff;
	--icf-radius: 8px;
	--icf-gap: 1.25rem;

	box-sizing: border-box;
	margin: 0 auto;
	max-width: 34rem;
	text-align: left;
}

.icf-checkout *,
.icf-checkout *::before,
.icf-checkout *::after {
	box-sizing: inherit;
}

.icf-checkout__title,
.icf-auth__title {
	margin: 0 0 0.35em;
}

.icf-checkout__lede,
.icf-auth__lede {
	margin: 0 0 var(--icf-gap);
	color: var(--icf-muted);
}

/* Messages */

.icf-alert {
	border: 1px solid var(--icf-border);
	border-radius: var(--icf-radius);
	margin-bottom: var(--icf-gap);
	padding: 0.75rem 1rem;
}

.icf-alert--error {
	background: rgba(180, 30, 30, 0.08);
	border-color: rgba(180, 30, 30, 0.4);
}

.icf-alert--notice {
	background: rgba(0, 0, 0, 0.04);
}

.icf-alert[hidden] {
	display: none;
}

/* Payment options */

.icf-options {
	border: 0;
	display: grid;
	gap: 0.75rem;
	margin: 0 0 var(--icf-gap);
	padding: 0;
}

.icf-options__legend {
	font-weight: 600;
	margin-bottom: 0.5rem;
	padding: 0;
}

.icf-option {
	align-items: flex-start;
	border: 1px solid var(--icf-border);
	border-radius: var(--icf-radius);
	cursor: pointer;
	display: flex;
	gap: 0.75rem;
	padding: 1rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.icf-option:hover {
	border-color: var(--icf-accent);
}

.icf-option:has(.icf-option__input:checked) {
	border-color: var(--icf-accent);
	box-shadow: inset 0 0 0 1px var(--icf-accent);
}

.icf-option:has(.icf-option__input:focus-visible) {
	outline: 2px solid var(--icf-accent);
	outline-offset: 2px;
}

.icf-option:has(.icf-option__input:disabled) {
	cursor: not-allowed;
	opacity: 0.55;
}

.icf-option__input {
	flex: 0 0 auto;
	margin-top: 0.25rem;
}

.icf-option__body {
	display: block;
	flex: 1 1 auto;
}

.icf-option__head {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: space-between;
}

.icf-option__name {
	font-weight: 600;
}

.icf-option__price {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.icf-option__detail,
.icf-option__totals {
	color: var(--icf-muted);
	display: block;
	font-size: 0.9em;
	margin-top: 0.35rem;
}

.icf-option__difference {
	display: block;
}

/* Summary */

.icf-summary {
	border-top: 1px solid var(--icf-border);
	margin-bottom: var(--icf-gap);
	padding-top: 0.9rem;
}

.icf-summary__due {
	display: flex;
	font-weight: 600;
	justify-content: space-between;
	margin: 0 0 0.4rem;
}

.icf-summary__value {
	font-variant-numeric: tabular-nums;
}

.icf-summary__tax {
	color: var(--icf-muted);
	font-size: 0.875em;
	margin: 0;
}

/* Payment element */

.icf-payment__element {
	margin-bottom: var(--icf-gap);
	min-height: 6rem;
}

.icf-payment__loading {
	color: var(--icf-muted);
	font-size: 0.9em;
	margin: 0;
}

.icf-payment__note {
	color: var(--icf-muted);
	font-size: 0.85em;
	margin: 0.75rem 0 0;
}

/* Forms */

.icf-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin: 0 0 1rem;
}

.icf-field label {
	font-weight: 600;
}

.icf-field input {
	border: 1px solid var(--icf-border);
	border-radius: var(--icf-radius);
	font: inherit;
	padding: 0.6rem 0.7rem;
	width: 100%;
}

.icf-field--hp {
	height: 0;
	overflow: hidden;
	position: absolute;
	width: 0;
}

.icf-required {
	color: var(--icf-muted);
	font-weight: 400;
}

.icf-hint {
	color: var(--icf-muted);
	font-size: 0.85em;
}

.icf-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin: 0;
}

.icf-button {
	border: 1px solid transparent;
	border-radius: var(--icf-radius);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 0.7rem 1.4rem;
}

.icf-button--primary {
	background: var(--icf-button-bg);
	color: var(--icf-button-fg);
}

.icf-button[disabled] {
	cursor: progress;
	opacity: 0.6;
}

/* Tabs */

.icf-tabs {
	border-bottom: 1px solid var(--icf-border);
	display: flex;
	gap: 0.25rem;
	margin-bottom: var(--icf-gap);
}

.icf-tab {
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	font: inherit;
	margin-bottom: -1px;
	padding: 0.6rem 0.9rem;
}

.icf-tab.is-active {
	border-bottom-color: var(--icf-accent);
	font-weight: 600;
}

.icf-panel.is-hidden {
	display: none;
}

@media (prefers-color-scheme: dark) {
	.icf-checkout {
		--icf-border: rgba(255, 255, 255, 0.22);
		--icf-muted: rgba(255, 255, 255, 0.7);
		--icf-button-bg: #f2f2f2;
		--icf-button-fg: #111111;
	}

	.icf-alert--notice {
		background: rgba(255, 255, 255, 0.06);
	}
}

/* Summary lines */

.icf-summary__line {
	color: var(--icf-muted);
	display: flex;
	justify-content: space-between;
	margin: 0 0 0.3rem;
}
