/**
 * Woo CoverCraft customizer styles.
 *
 * Scoped under .wcc-customizer and driven by its own custom properties, so a
 * theme can restyle the designer by overriding the variables instead of
 * fighting specificity.
 */

/* .wcc-thankyou-page (the inline-checkout "thank you" step) shares these
 * tokens and the reset below, but is deliberately never picked up by the
 * bootstrap's `.wcc-customizer` query — it has none of the interactive
 * designer's markup, so the Customizer constructor would fail against it. */
.wcc-customizer,
.wcc-thankyou-page {
	--wcc-border: #e5e3f5;
	--wcc-muted: #6b6b83;
	--wcc-text: #17172b;
	--wcc-accent: #5b4fe8;
	--wcc-accent-hover: #4a3fd4;
	--wcc-accent-soft: #f0eefd;
	--wcc-accent-soft-text: #473ccb;
	--wcc-surface: #ffffff;
	--wcc-surface-alt: #f8f8fc;
	--wcc-radius-lg: 18px;
	--wcc-radius: 12px;
	--wcc-radius-sm: 9px;
	--wcc-shadow: 0 1px 2px rgba( 40, 34, 110, 0.05 ), 0 10px 28px rgba( 40, 34, 110, 0.07 );
	--wcc-error: #c22a3e;
	--wcc-success: #1b9c5a;

	box-sizing: border-box;
	max-width: 100%;
	margin: 0 0 2em;
	color: var( --wcc-text );
}

.wcc-customizer *,
.wcc-customizer *::before,
.wcc-customizer *::after,
.wcc-thankyou-page *,
.wcc-thankyou-page *::before,
.wcc-thankyou-page *::after {
	box-sizing: inherit;
}

/* An element's own `display: flex/block/...` rule otherwise wins over the
 * browser's [hidden] default (same specificity, but author beats
 * user-agent), so toggling the `hidden` property from JS would silently
 * fail to hide it. */
.wcc-customizer [hidden],
.wcc-thankyou-page [hidden] {
	display: none !important;
}

.wcc-customizer__head {
	margin: 0 0 1.75em;
}

.wcc-customizer__title {
	margin: 0 0 0.3em;
	font-size: 1.75em;
	font-weight: 700;
	line-height: 1.25;
}

.wcc-customizer__subtitle {
	margin: 0;
	color: var( --wcc-muted );
	font-size: 1em;
}

.wcc-customizer__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
}

/* Grid items default to min-width: auto, which floors their width at the
 * widest un-shrinkable content below (e.g. a nowrap filename) and forces
 * the whole grid to overflow instead of wrapping/truncating. */
.wcc-controls,
.wcc-preview {
	min-width: 0;
}

@media ( min-width: 782px ) {
	.wcc-customizer__grid {
		/* --wcc-controls-ratio only ever gets read inside this desktop
		 * media query, so a widget (e.g. Elementor) can safely set it
		 * "responsively" without it leaking into the mobile single-column
		 * layout below. */
		grid-template-columns: var( --wcc-controls-ratio, 2.4fr ) 1fr;
		align-items: start;
	}
}

/* No live-preview column: the controls take the full width. */
.wcc-customizer__grid--no-preview {
	grid-template-columns: 1fr;
}

/* Controls --------------------------------------------------------------- */

.wcc-field {
	margin-bottom: 22px;
}

.wcc-label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
	font-weight: 600;
	font-size: 0.98em;
}

.wcc-step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	background: var( --wcc-accent );
	color: #fff;
	border-radius: 50%;
	font-size: 12px;
	font-weight: 700;
	flex: 0 0 auto;
}

.wcc-field__hint {
	margin: -2px 0 12px;
	color: var( --wcc-muted );
	font-size: 0.88em;
}

.wcc-select-wrap {
	position: relative;
}

.wcc-select,
.wcc-input {
	width: 100%;
	max-width: 100%;
	padding: 12px 14px;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius-sm );
	font-size: 1em;
	line-height: 1.4;
	color: var( --wcc-text );
}

.wcc-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-left: 40px !important;
	padding-right: 38px;
}

.wcc-select::-ms-expand {
	display: none;
}

.wcc-select:focus,
.wcc-input:focus {
	border-color: var( --wcc-accent );
	outline: 2px solid var( --wcc-accent );
	outline-offset: 1px;
}

.wcc-select:disabled {
	background: var( --wcc-surface-alt );
	color: var( --wcc-muted );
	cursor: not-allowed;
}

.wcc-select-icon {
	position: absolute;
	top: 50%;
	left: 12px;
	transform: translateY( -50% );
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	color: var( --wcc-accent );
	pointer-events: none;
}

.wcc-select-icon svg {
	width: 20px;
	height: 20px;
}

.wcc-select-icon__img {
	width: 22px;
	height: 22px;
	border-radius: 5px;
	object-fit: contain;
}

.wcc-select-chevron {
	position: absolute;
	top: 50%;
	right: 14px;
	transform: translateY( -50% );
	display: flex;
	color: var( --wcc-muted );
	pointer-events: none;
}

.wcc-select-chevron svg {
	width: 16px;
	height: 16px;
	transition: transform 0.15s ease;
}

.wcc-combobox {
	position: relative;
}

.wcc-combobox.is-open .wcc-select-chevron svg {
	transform: rotate( 180deg );
}

.wcc-combobox__list {
	position: absolute;
	z-index: 20;
	top: calc( 100% + 6px );
	left: 0;
	right: 0;
	max-height: 240px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius );
	box-shadow: var( --wcc-shadow );
}

.wcc-combobox__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: var( --wcc-radius-sm );
	font-size: 0.94em;
	cursor: pointer;
}

.wcc-combobox__item img {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	border-radius: 4px;
	object-fit: contain;
}

.wcc-combobox__item.is-active,
.wcc-combobox__item:hover {
	background: var( --wcc-accent-soft );
}

.wcc-combobox__item--custom {
	color: var( --wcc-accent );
	font-weight: 600;
}

.wcc-combobox__empty {
	padding: 9px 10px;
	color: var( --wcc-muted );
	font-size: 0.9em;
}

.wcc-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* File rows ---------------------------------------------------------------- */

.wcc-file-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 14px;
}

.wcc-file-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius );
}

.wcc-file-row__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: 0 0 auto;
	background: var( --wcc-accent-soft );
	color: var( --wcc-accent );
	border-radius: var( --wcc-radius-sm );
}

.wcc-file-row__icon svg {
	width: 20px;
	height: 20px;
}

.wcc-file-row__info {
	flex: 1 1 auto;
	min-width: 0;
}

.wcc-file-row__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
}

.wcc-file-row__label {
	white-space: nowrap;
	font-weight: 600;
	font-size: 0.95em;
}

.wcc-file-row__action {
	padding: 0;
	background: none;
	border: 0;
	color: var( --wcc-accent );
	font-size: 0.88em;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}

.wcc-file-row__action:hover,
.wcc-file-row__action:focus-visible {
	color: var( --wcc-accent-hover );
	text-decoration: underline;
}

.wcc-file-row__name {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var( --wcc-muted );
	font-size: 0.86em;
}

.wcc-file-row__status {
	display: flex;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	color: var( --wcc-success );
}

.wcc-file-row__delete {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	padding: 0 !important;
	background: var( --wcc-surface-alt );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius-sm );
	color: var( --wcc-error );
	cursor: pointer;
}

.wcc-file-row__delete svg {
	width: 20px;
	height: 20px;
}

.wcc-file-row__delete:hover,
.wcc-file-row__delete:focus-visible {
	background: var( --wcc-error );
	color: #fff;
	border-color: var( --wcc-error );
}

.wcc-file-row:focus-within {
	border-color: var( --wcc-accent );
	outline: 2px solid var( --wcc-accent );
	outline-offset: 1px;
}

/* Info banner -------------------------------------------------------------- */

.wcc-info-banner {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	background: var( --wcc-accent-soft );
	border-radius: var( --wcc-radius );
	color: var( --wcc-accent-soft-text );
}

.wcc-info-banner__icon {
	flex: 0 0 auto;
	margin-top: 1px;
}

.wcc-info-banner__icon svg {
	display: block;
	width: 18px;
	height: 18px;
}

.wcc-info-banner p {
	margin: 0;
	font-size: 0.88em;
	line-height: 1.5;
}

.wcc-link {
	padding: 0;
	background: none;
	border: 0;
	color: var( --wcc-accent );
	font-size: 0.9em;
	text-decoration: underline;
	cursor: pointer;
}

/* Preview ---------------------------------------------------------------- */

.wcc-preview {
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius-lg );
	box-shadow: var( --wcc-shadow );
	padding: 20px;
}

.wcc-preview__head {
	margin: 0 0 16px;
}

.wcc-preview__title {
	margin: 0 0 4px;
	font-size: 1.15em;
	font-weight: 700;
}

.wcc-preview__subtitle {
	margin: 0;
	color: var( --wcc-muted );
	font-size: 0.9em;
	line-height: 1.5;
}

.wcc-preview__subtitle strong {
	color: var( --wcc-accent );
	font-weight: 700;
}

.wcc-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
	padding: 16px;
	background: var( --wcc-surface-alt );
	border-radius: var( --wcc-radius );
}

.wcc-stage__canvas {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 20px;
	touch-action: none;
	cursor: grab;
}

.wcc-stage__canvas.is-dragging {
	cursor: grabbing;
}

.wcc-stage__canvas.is-static {
	cursor: default;
}

.wcc-stage__placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-width: 240px;
	margin: 0 auto;
	text-align: center;
	color: var( --wcc-muted );
}

.wcc-stage__placeholder-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	flex: 0 0 auto;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: 50%;
	color: var( --wcc-accent );
}

.wcc-stage__placeholder-icon svg {
	width: 28px;
	height: 28px;
}

.wcc-stage__placeholder p {
	margin: 0;
	font-size: 0.95em;
	line-height: 1.5;
}

.wcc-drag-hint {
	margin: 10px 0 0;
	text-align: center;
	color: var( --wcc-muted );
	font-size: 0.85em;
}

/* Messages --------------------------------------------------------------- */

.wcc-message {
	margin: 16px 0 0;
	padding: 12px 14px;
	border-radius: var( --wcc-radius );
	font-size: 0.92em;
}

.wcc-message--error {
	background: #fdedef;
	border: 1px solid #f3c7ce;
	color: var( --wcc-error );
}

.wcc-message--success {
	background: #e9f8f0;
	border: 1px solid #c3ecd8;
	color: var( --wcc-success );
}

.wcc-notice {
	padding: 14px 16px;
	background: var( --wcc-surface-alt );
	border: 1px solid var( --wcc-border );
	border-radius: 10px;
	color: var( --wcc-muted );
}

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

.wcc-summary {
	display: flex;
	flex-wrap: wrap;
	margin-top: 24px;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius-lg );
	box-shadow: var( --wcc-shadow );
	/* Clips the confirm button's square corners to the card's rounded ones. */
	overflow: hidden;
}

.wcc-summary__selection {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1 1 260px;
	min-width: 0;
	padding: 18px 22px;
}

.wcc-summary__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	width: 48px;
	height: 48px;
	flex: 0 0 auto;
	background: var( --wcc-accent-soft );
	color: var( --wcc-accent );
	border-radius: var( --wcc-radius-sm );
}

.wcc-summary__thumb svg {
	width: 24px;
	height: 24px;
}

.wcc-summary__thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcc-summary__selection-text {
	min-width: 0;
}

.wcc-summary__heading {
	margin: 0 0 2px;
	font-weight: 700;
	font-size: 0.95em;
}

.wcc-summary__breadcrumb {
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var( --wcc-muted );
	font-size: 0.88em;
}

.wcc-summary__price {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	padding: 18px 32px;
	border-left: 1px solid var( --wcc-border );
	text-align: center;
}

.wcc-price {
	margin: 0;
	font-size: 1.4em;
	font-weight: 700;
	color: var( --wcc-accent );
}

.wcc-confirm {
	flex: 0 0 auto;
	align-self: stretch;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 54px;
	padding: 12px 32px;
	background: linear-gradient( 135deg, var( --wcc-confirm-start, var( --wcc-accent ) ), var( --wcc-confirm-end, var( --wcc-accent-hover ) ) ) !important;
	border: 0;
	border-radius: 0;
	color: var( --wcc-confirm-text, #fff ) !important;
	font-size: 1.15em;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.wcc-confirm:hover,
.wcc-confirm:focus-visible {
	filter: brightness( var( --wcc-confirm-hover-brightness, 1.08 ) );
}

.wcc-confirm__icon {
	width: 24px;
	height: 24px;
	flex: 0 0 auto;
}

.wcc-confirm[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.wcc-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wcc-spin 0.7s linear infinite;
}

@keyframes wcc-spin {
	to {
		transform: rotate( 360deg );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wcc-spinner {
		animation: none;
	}
}

@media ( max-width: 781px ) {
	.wcc-summary {
		flex-direction: column;
	}

	/* flex-basis is a main-axis size, so the 260px basis meant as a width
	 * on desktop would otherwise become a height once the axis flips. */
	.wcc-summary__selection {
		flex-basis: auto;
	}

	.wcc-summary__price {
		align-items: flex-start;
		text-align: left;
		border-left: 0;
		border-top: 1px solid var( --wcc-border );
	}

	.wcc-confirm {
		padding: 16px 22px;
	}
}

/* Inline checkout & thank you ---------------------------------------------
 * WooCommerce's own checkout/order-received markup is deliberately left
 * unstyled here beyond spacing — it already carries the theme's normal
 * checkout look, which is the point of reusing it wholesale. */

.wcc-checkout-inline {
	margin-top: 32px;
	padding-top: 32px;
	border-top: 1px solid var( --wcc-border );
}

.wcc-thankyou-page {
	max-width: 900px;
	margin: 0 auto 2em;
	padding: 28px;
	background: var( --wcc-surface );
	border: 1px solid var( --wcc-border );
	border-radius: var( --wcc-radius-lg );
	box-shadow: var( --wcc-shadow );
}

.wcc-thankyou-page .wcc-customizer__head {
	margin-bottom: 1.5em;
}

/* Cart ------------------------------------------------------------------- */

.wcc-fixed-qty {
	display: inline-block;
	min-width: 2em;
	text-align: center;
}
