/**
 * Bundle Selector - front-end styles.
 *
 * @package AusQual
 */

.ausqual-bundle {
	--bundle-green: var(--wp--preset--color--grass, #235C28);
	--bundle-ink: var(--wp--preset--color--fertiliser, #1F2828);
	--bundle-gold: var(--wp--preset--color--grains, #FFD861);
	--bundle-tint: var(--wp--preset--color--light-bg, #F4F7F4);
	--bundle-line: var(--wp--preset--color--border, rgba(31, 40, 40, 0.1));
	--bundle-muted: var(--wp--preset--color--muted, #686868);

	display: flex;
	flex-direction: column;
	gap: clamp(32px, 5vw, 56px);
	color: var(--bundle-ink);
	scroll-margin-top: 120px;
}

.ausqual-bundle__step-title {
	margin: 0 0 20px;
	/* Match the theme's H2 so the steps sit level with the page's other sections. */
	font-size: var(--wp--preset--font-size--xx-large);
}

.ausqual-bundle__price-note {
	margin: 14px 0 0;
	color: var(--bundle-muted);
	font-size: 15px;
}

.ausqual-bundle__intro {
	max-width: 62ch;
	margin: 0 0 20px;
}

/* ---------- Step 1: bundle cards ---------- */

.ausqual-bundle__cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
}

.ausqual-bundle__card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 28px 24px 24px;
	border: 2px solid var(--bundle-line);
	border-radius: 12px;
	background: #fff;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ausqual-bundle__card:hover {
	border-color: var(--bundle-green);
}

.ausqual-bundle__card:focus-visible {
	outline: 3px solid var(--bundle-gold);
	outline-offset: 2px;
}

.ausqual-bundle__card.is-selected {
	border-color: var(--bundle-green);
	background: var(--bundle-tint);
	box-shadow: 0 6px 24px rgba(35, 92, 40, 0.12);
}

.ausqual-bundle__card.is-selected::after {
	content: "";
	position: absolute;
	top: 18px;
	right: 18px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--bundle-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.ausqual-bundle__badge {
	position: absolute;
	top: -12px;
	left: 20px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--bundle-gold);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ausqual-bundle__card-label {
	font-size: 1.125rem;
	font-weight: 600;
}

.ausqual-bundle__card-price {
	font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem);
	font-weight: 600;
	line-height: 1.1;
	color: var(--bundle-green);
}

.ausqual-bundle__card-save {
	padding: 2px 8px;
	border-radius: 4px;
	background: rgba(35, 92, 40, 0.1);
	color: var(--bundle-green);
	font-size: 14px;
	font-weight: 600;
}

.ausqual-bundle__card-per {
	font-size: 14px;
	color: var(--bundle-muted);
}

/* ---------- Step 2: roles + courses ---------- */

.ausqual-bundle__roles-prompt {
	margin: 0 0 10px;
	font-weight: 600;
}

.ausqual-bundle__role-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 24px;
}

.ausqual-bundle__role {
	padding: 8px 16px;
	border: 1px solid var(--bundle-green);
	border-radius: 999px;
	background: #fff;
	color: var(--bundle-green);
	font: inherit;
	font-size: 15px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ausqual-bundle__role:hover {
	background: var(--bundle-tint);
}

.ausqual-bundle__role[aria-pressed="true"] {
	background: var(--bundle-green);
	color: #fff;
}

.ausqual-bundle__role:focus-visible {
	outline: 3px solid var(--bundle-gold);
	outline-offset: 2px;
}

.ausqual-bundle__course-tools {
	display: flex;
	justify-content: flex-end;
	min-height: 1.5em;
	margin-bottom: 8px;
}

.ausqual-bundle__reset {
	padding: 0;
	border: 0;
	background: none;
	color: var(--bundle-green);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.ausqual-bundle__reset[hidden] {
	display: none;
}

.ausqual-bundle__reset:focus-visible {
	outline: 3px solid var(--bundle-gold);
	outline-offset: 2px;
}

.ausqual-bundle__courses {
	margin: 0;
	padding: 0;
	border: 0;
}

.ausqual-bundle__course-list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--bundle-line);
}

.ausqual-bundle__course {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	padding: 14px 4px;
	border-bottom: 1px solid var(--bundle-line);
	transition: background-color 0.15s ease;
}

.ausqual-bundle__course.is-selected {
	background: var(--bundle-tint);
}

.ausqual-bundle__course-label {
	display: flex;
	flex: 1 1 260px;
	align-items: center;
	gap: 12px;
	cursor: pointer;
}

.ausqual-bundle__check {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--bundle-green);
	cursor: pointer;
}

.ausqual-bundle__check:disabled {
	cursor: not-allowed;
}

.ausqual-bundle__check:disabled:not(:checked) + .ausqual-bundle__course-title {
	color: var(--bundle-muted);
}

.ausqual-bundle__course-title {
	font-weight: 500;
}

.ausqual-bundle__tag {
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--bundle-gold);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.ausqual-bundle__course-link {
	margin-left: auto;
	font-size: 14px;
	color: var(--bundle-green);
}

/* ---------- Summary bar ---------- */

.ausqual-bundle__summary {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-top: calc(-1 * clamp(16px, 3vw, 32px));
	padding: 16px 20px;
	border-radius: 12px;
	background: var(--bundle-ink);
	color: #fff;
	box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
}

.ausqual-bundle__count {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
}

.ausqual-bundle__upsell {
	margin: 2px 0 0;
	font-size: 15px;
}

.ausqual-bundle__upsell-btn {
	padding: 0;
	border: 0;
	background: none;
	color: var(--bundle-gold);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.ausqual-bundle__cta.wp-block-button__link {
	border: 0;
	cursor: pointer;
	white-space: nowrap;
}

.ausqual-bundle__cta:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ---------- Course details dialog ---------- */

.ausqual-bundle__info {
	width: min(640px, calc(100vw - 32px));
}

.ausqual-bundle__info-image {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 7;
	margin: 0 0 20px;
	border-radius: 10px;
	object-fit: cover;
}

.ausqual-bundle__info-tagline {
	margin: 0 0 14px;
	color: var(--bundle-green);
	font-weight: 600;
}

.ausqual-bundle__info-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
	font-size: 14px;
}

.ausqual-bundle__info-facts li {
	padding: 4px 10px;
	border-radius: 4px;
	background: var(--bundle-tint);
}

.ausqual-bundle__info-facts span {
	font-weight: 600;
}

.ausqual-bundle__info-summary {
	margin: 0 0 18px;
}

.ausqual-bundle__info-heading {
	margin: 0 0 8px;
	font-size: 1.125rem;
}

.ausqual-bundle__info-learn {
	margin: 0 0 4px;
	padding-left: 1.2em;
}

.ausqual-bundle__info-learn li + li {
	margin-top: 4px;
}

.ausqual-bundle__info-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 20px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--bundle-line);
}

.ausqual-bundle__info-actions .wp-block-button__link {
	border: 0;
	cursor: pointer;
}

.ausqual-bundle__info-actions .wp-block-button__link:disabled {
	opacity: 0.6;
	cursor: default;
}

.ausqual-bundle__info-more {
	color: var(--bundle-green);
	font-weight: 600;
}

/* ---------- Checkout: participants field ----------
 * Matches the course-page booking form (blocks/course-booking/style.css):
 * label and hint on the left, a 46px stepper on the right with a dark 1px
 * border, light green fill and 56px buttons. Selectors are doubled up to win
 * over the generic `.ausqual-bundle__field input` rules.
 */

.ausqual-bundle__field.ausqual-bundle__participants {
	display: grid;
	grid-template-columns: 1fr auto;
	column-gap: 16px;
	align-items: center;
}

.ausqual-bundle__participants-label {
	grid-column: 1;
	grid-row: 1;
	color: var(--bundle-ink);
	font-size: 0.875rem;
	font-weight: 500;
}

.ausqual-bundle__participants-hint {
	grid-column: 1;
	grid-row: 2;
	margin: 4px 0 0;
	color: #6B7280;
	font-size: 0.75rem;
}

.ausqual-bundle__stepper {
	display: flex;
	grid-column: 2;
	grid-row: 1 / span 2;
	align-items: stretch;
	align-self: center;
	height: 46px;
	overflow: hidden;
	border: 1px solid var(--bundle-ink);
	border-radius: 5px;
	background: rgba(231, 239, 230, 0.5);
}

.ausqual-bundle__stepper:focus-within {
	outline: 2px solid var(--bundle-green);
	outline-offset: 1px;
}

.ausqual-bundle__stepper-btn {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 56px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--bundle-ink);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.ausqual-bundle__stepper-btn:hover {
	background: rgba(35, 92, 40, 0.1);
}

.ausqual-bundle__stepper-btn:active {
	background: rgba(35, 92, 40, 0.2);
}

.ausqual-bundle__stepper-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ausqual-bundle__stepper-btn:disabled:hover {
	background: transparent;
}

.ausqual-bundle__participants .ausqual-bundle__stepper-input,
.ausqual-bundle__participants .ausqual-bundle__stepper-input:focus {
	flex: 0 0 auto;
	width: 60px;
	padding: 0;
	border: 0;
	border-inline: 1px solid var(--bundle-ink);
	border-radius: 0;
	outline: none;
	background: transparent;
	color: var(--bundle-ink);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 500;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ausqual-bundle__stepper-input::-webkit-outer-spin-button,
.ausqual-bundle__stepper-input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

/* ---------- Step 3: number of people ---------- */

.ausqual-bundle__people {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 20px;
}

.ausqual-bundle__people-total {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
}

.ausqual-bundle__team-prompt {
	max-width: 62ch;
	margin: 16px 0 0;
	padding: 12px 16px;
	border-left: 4px solid var(--bundle-gold);
	border-radius: 6px;
	background: rgba(255, 216, 97, 0.18);
}

/* ---------- While paying and enrolling ---------- */

.ausqual-bundle__busy-note {
	margin: 12px 0 0;
	padding: 10px 14px;
	border-left: 4px solid var(--bundle-gold);
	border-radius: 6px;
	background: rgba(255, 216, 97, 0.18);
	font-size: 14px;
}

/* ---------- After payment ---------- */

.ausqual-bundle__done-note {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-left: 4px solid var(--bundle-gold);
	border-radius: 6px;
	background: rgba(255, 216, 97, 0.18);
}

.ausqual-bundle__done-signoff {
	margin: 0 0 16px;
	font-weight: 600;
}

/* ---------- Checkout dialog ---------- */

.ausqual-bundle__dialog {
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100dvh - 32px);
	padding: 0;
	border: 0;
	border-radius: 14px;
	color: var(--bundle-ink);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ausqual-bundle__dialog::backdrop {
	background: rgba(31, 40, 40, 0.6);
}

/*
 * Open/close animation for both popups (course details and checkout): fade
 * in and rise slightly, with the backdrop fading. @starting-style animates the
 * open; allow-discrete on display/overlay keeps the dialog on screen while it
 * animates out on close. Browsers without these just open and close instantly.
 */
.ausqual-bundle__dialog {
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition:
		opacity 0.22s ease,
		transform 0.22s ease,
		overlay 0.22s ease allow-discrete,
		display 0.22s ease allow-discrete;
}

.ausqual-bundle__dialog[open] {
	opacity: 1;
	transform: none;
}

.ausqual-bundle__dialog::backdrop {
	opacity: 0;
	transition:
		opacity 0.22s ease,
		overlay 0.22s ease allow-discrete,
		display 0.22s ease allow-discrete;
}

.ausqual-bundle__dialog[open]::backdrop {
	opacity: 1;
}

@starting-style {
	.ausqual-bundle__dialog[open] {
		opacity: 0;
		transform: translateY(16px) scale(0.98);
	}

	.ausqual-bundle__dialog[open]::backdrop {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ausqual-bundle__dialog,
	.ausqual-bundle__dialog::backdrop {
		transform: none;
		transition: none;
	}
}

.ausqual-bundle__dialog-inner {
	position: relative;
	padding: clamp(20px, 4vw, 32px);
}

.ausqual-bundle__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: inherit;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.ausqual-bundle__close:hover {
	background: var(--bundle-tint);
}

.ausqual-bundle__dialog.is-busy .ausqual-bundle__close {
	visibility: hidden;
}

.ausqual-bundle__dialog-title {
	margin: 0 0 4px;
	font-size: 1.5rem;
}

.ausqual-bundle__dialog-bundle {
	margin: 0 0 8px;
	color: var(--bundle-green);
	font-weight: 600;
}

.ausqual-bundle__dialog-courses {
	margin: 0 0 16px;
	padding-left: 20px;
	font-size: 15px;
}

.ausqual-bundle__dialog-total {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 20px;
	padding: 12px 0;
	border-top: 1px solid var(--bundle-line);
	border-bottom: 1px solid var(--bundle-line);
}

.ausqual-bundle__fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 16px;
}

.ausqual-bundle__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	font-size: 14px;
}

.ausqual-bundle__field--wide {
	grid-column: 1 / -1;
}

.ausqual-bundle__field input,
.ausqual-bundle__card-element {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid #C9CFCB;
	border-radius: 6px;
	background: #fff;
	font: inherit;
	font-size: 16px;
	box-sizing: border-box;
}

.ausqual-bundle__field input:focus,
.ausqual-bundle__card-element.StripeElement--focus {
	outline: 2px solid var(--bundle-green);
	outline-offset: 0;
	border-color: var(--bundle-green);
}

.ausqual-bundle__field input[aria-invalid="true"],
.ausqual-bundle__card-element.StripeElement--invalid {
	border-color: #DC2626;
}

.ausqual-bundle__error {
	margin: 14px 0 0;
	padding: 10px 12px;
	border-radius: 6px;
	background: #FEF2F2;
	color: #B91C1C;
	font-size: 14px;
}

.ausqual-bundle__pay.wp-block-button__link {
	width: 100%;
	margin-top: 18px;
	border: 0;
	justify-content: center;
	cursor: pointer;
}

.ausqual-bundle__pay:disabled {
	opacity: 0.6;
	cursor: wait;
}

.ausqual-bundle__note {
	margin: 12px 0 0;
	font-size: 13px;
	color: var(--bundle-muted);
}

.ausqual-bundle__done:focus {
	outline: none;
}

.ausqual-bundle__done-ref {
	margin: 0 0 12px;
}

.ausqual-bundle__closed {
	margin: 0 0 16px;
	font-size: 1.125rem;
}

@media (max-width: 600px) {
	.ausqual-bundle__fields {
		grid-template-columns: 1fr;
	}

	.ausqual-bundle__summary {
		border-radius: 0;
		margin-inline: calc(-1 * var(--wp--style--root--padding-left, 16px));
	}

	.ausqual-bundle__cta.wp-block-button__link {
		width: 100%;
		justify-content: center;
	}

	.ausqual-bundle__course-link {
		margin-left: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ausqual-bundle * {
		transition: none !important;
	}
}
