/**
 * Community Checkout: "Choose options in the cart" dialog (`cart-quick-add.js`).
 * Plain CSS (no build). Colors and radii come from Lite's design variables (`--fluidcheckout--*`), with fallbacks for cart
 * pages where Lite prints no variables (WooCommerce's own cart). Dark mode: `body.has-fc-dark-mode`.
 */

.fc-qa {
	--fc-qa-text: var(--fluidcheckout--color--black, #1e1e1e);
	--fc-qa-muted: var(--fluidcheckout--color--dark-grey, #535156);
	--fc-qa-surface: var(--fluidcheckout--section--background-color, var(--fluidcheckout--color--white, #fff));
	--fc-qa-surface-alt: var(--fluidcheckout--color--lighter-grey, #f3f3f3);
	--fc-qa-border: var(--fluidcheckout--color--grey, #7b7575);
	--fc-qa-border-light: var(--fluidcheckout--color--light-grey, #d8d8d8);
	--fc-qa-radius: var(--fluidcheckout--section--border-radius, 8px);
	--fc-qa-accent: var(--fluidcheckout--button--primary--background-color, var(--fluidcheckout--color--black, #1e1e1e));
	--fc-qa-accent-text: var(--fluidcheckout--button--primary--text-color, var(--fluidcheckout--color--white, #fff));
	--fc-qa-error: var(--fluidcheckout--color--error, #d63638);
	--fc-qa-success: var(--fluidcheckout--color--success, #007a45);
	--fc-qa-focus: var(--fluidcheckout--color--focus, #2271b1);

	box-sizing: border-box;
	width: min( 480px, calc( 100% - 32px ) );
	max-width: 100%;
	max-height: min( 90vh, 720px );
	margin: auto;
	padding: 0;
	overflow: hidden;
	color: var(--fc-qa-text);
	background-color: var(--fc-qa-surface);
	border: 0;
	border-radius: var(--fc-qa-radius);
	box-shadow: 0 12px 40px rgba( 0, 0, 0, .25 );
	font-size: 16px;
	line-height: 1.4;
}

body.has-fc-dark-mode .fc-qa {
	--fc-qa-text: var(--fluidcheckout--color--black, #f3f3f3);
	--fc-qa-muted: var(--fluidcheckout--color--dark-grey, #d8d8d8);
	--fc-qa-surface: var(--fluidcheckout--section--background-color, var(--fluidcheckout--color--white, #1b1b1d));
	--fc-qa-surface-alt: var(--fluidcheckout--color--lighter-grey, #28282a);
	--fc-qa-border: var(--fluidcheckout--color--grey, #7b7575);
	--fc-qa-border-light: var(--fluidcheckout--color--light-grey, #323234);
	--fc-qa-error: var(--fluidcheckout--color--error, #ec5b5b);
	--fc-qa-success: var(--fluidcheckout--color--success, #00cc66);
	--fc-qa-focus: #72aee6;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, .6 ), 0 0 0 1px var(--fc-qa-border-light);
}

.fc-qa *,
.fc-qa *::before,
.fc-qa *::after {
	box-sizing: border-box;
}

.fc-qa::backdrop {
	background-color: rgba( 0, 0, 0, .5 );
}

.fc-qa__inner {
	position: relative;
	max-height: inherit;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px;
}

.fc-qa__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	color: var(--fc-qa-text);
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
}

.fc-qa__close:hover {
	background-color: var(--fc-qa-surface-alt);
}

.fc-qa__header {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding-right: 40px;
	margin-bottom: 16px;
}

.fc-qa__image {
	flex: 0 0 auto;
	width: 96px;
	height: 96px;
	object-fit: cover;
	background-color: var(--fc-qa-surface-alt);
	border-radius: calc( var(--fc-qa-radius) / 2 );
}

.fc-qa__image[hidden] {
	display: none;
}

.fc-qa__summary {
	min-width: 0;
}

.fc-qa .fc-qa__title {
	margin: 0 0 6px;
	color: var(--fc-qa-text);
	font-size: 1.125em;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.fc-qa .fc-qa__price {
	color: var(--fc-qa-text);
	font-size: 1em;
}

.fc-qa .fc-qa__price del {
	color: var(--fc-qa-muted);
}

.fc-qa .fc-qa__price ins {
	text-decoration: none;
	font-weight: 600;
}

.fc-qa__group {
	margin: 0 0 16px;
}

.fc-qa .fc-qa__label {
	margin: 0 0 8px;
	color: var(--fc-qa-text);
	font-size: .9375em;
}

.fc-qa__label-name {
	font-weight: 600;
}

.fc-qa__label-name::after {
	content: ":";
}

.fc-qa__label-value {
	color: var(--fc-qa-muted);
}

.fc-qa__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.fc-qa .fc-qa__chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 8px 14px;
	color: var(--fc-qa-text);
	background-color: var(--fc-qa-surface);
	border: 1px solid var(--fc-qa-border);
	border-radius: calc( var(--fc-qa-radius) / 2 );
	box-shadow: none;
	font: inherit;
	font-size: .9375em;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}

.fc-qa .fc-qa__chip:hover:not( :disabled ) {
	border-color: var(--fc-qa-text);
}

.fc-qa .fc-qa__chip[aria-pressed="true"] {
	color: var(--fc-qa-accent-text);
	background-color: var(--fc-qa-accent);
	border-color: var(--fc-qa-accent);
}

.fc-qa .fc-qa__chip.is-unavailable {
	color: var(--fc-qa-muted);
	background-color: var(--fc-qa-surface-alt);
	border-color: var(--fc-qa-border-light);
	border-style: dashed;
	text-decoration: line-through;
	/* A diagonal line across the chip, so a single letter also reads as crossed out */
	background-image: linear-gradient( to top right, transparent calc( 50% - 1px ), var(--fc-qa-border) calc( 50% - 1px ), var(--fc-qa-border) calc( 50% + 1px ), transparent calc( 50% + 1px ) );
}

.fc-qa .fc-qa__chip:disabled {
	cursor: not-allowed;
	opacity: 1;
}

.fc-qa .fc-qa__chip:focus-visible,
.fc-qa .fc-qa__close:focus-visible,
.fc-qa .fc-qa__add:focus-visible,
.fc-qa .fc-qa__details:focus-visible {
	outline: 2px solid var(--fc-qa-focus);
	outline-offset: 2px;
}

.fc-qa .fc-qa__status {
	min-height: 1.4em;
	margin: 0 0 12px;
	color: var(--fc-qa-success);
	font-size: .9375em;
}

.fc-qa .fc-qa__status:empty {
	margin: 0;
	min-height: 0;
}

.fc-qa .fc-qa__status.is-error {
	color: var(--fc-qa-error);
}

.fc-qa__actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: stretch;
}

.fc-qa .fc-qa__add {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 12px 20px;
	color: var(--fc-qa-accent-text);
	background-color: var(--fc-qa-accent);
	border: 1px solid var(--fc-qa-accent);
	border-radius: var(--fluidcheckout--button--border-radius, calc( var(--fc-qa-radius) / 2 ));
	font: inherit;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
}

.fc-qa .fc-qa__add:disabled {
	cursor: not-allowed;
	opacity: .45;
}

.fc-qa.is-busy .fc-qa__add {
	cursor: progress;
}

.fc-qa .fc-qa__details {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	color: var(--fc-qa-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Phones: bottom sheet */
@media ( max-width: 600px ) {
	.fc-qa {
		width: 100%;
		max-width: 100%;
		max-height: 90vh;
		max-height: 90dvh;
		margin: auto 0 0;
		border-radius: var(--fc-qa-radius) var(--fc-qa-radius) 0 0;
	}

	.fc-qa[open] {
		animation: fc-qa-sheet .2s ease-out;
	}

	.fc-qa__inner {
		padding: 16px 16px calc( 16px + env( safe-area-inset-bottom, 0px ) );
	}

	.fc-qa__image {
		width: 72px;
		height: 72px;
	}
}

@keyframes fc-qa-sheet {
	from {
		transform: translateY( 100% );
	}
	to {
		transform: translateY( 0 );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.fc-qa[open] {
		animation: none;
	}
}

/* Live region outside the dialog, and screen reader texts of WooCommerce's price HTML */
.fc-qa .screen-reader-text,
.fc-qa-live.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}
