/**
 * WooCommerce Elementor Product Configurator - front-end styles.
 * Namespaced under .wepc-configurator to avoid clashing with theme/WooCommerce CSS.
 */

.wepc-configurator {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	align-items: flex-start;
	max-width: 100%;
	box-sizing: border-box;
}

.wepc-configurator * {
	box-sizing: border-box;
}

.wepc-image-wrap {
	flex: 1 1 380px;
	min-width: 240px;
}

.wepc-image-wrap img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
	object-fit: cover;
	background: #f5f5f5;
	transition: opacity 0.15s ease;
}

.wepc-details {
	flex: 1 1 320px;
	min-width: 240px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wepc-title {
	margin: 0;
	font-size: 1.5em;
	line-height: 1.25;
}

.wepc-description {
	color: #555;
	font-size: 0.95em;
	line-height: 1.5;
}

.wepc-description p:last-child {
	margin-bottom: 0;
}

.wepc-attr-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wepc-attr-label {
	font-weight: 600;
	font-size: 0.9em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #222;
}

.wepc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.wepc-swatch {
	position: relative;
	cursor: pointer;
	border: 2px solid #ddd;
	background: #fff;
	border-radius: 6px;
	padding: 0;
	transition: border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
	outline-offset: 2px;
}

.wepc-swatch:hover:not(.wepc-swatch--disabled) {
	transform: translateY(-1px);
}

.wepc-swatch--text {
	padding: 8px 16px;
	font-size: 0.9em;
	color: #222;
	min-width: 44px;
}

.wepc-swatch--color {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	padding: 0;
}

.wepc-swatch--selected {
	border-color: #1e1e1e;
	box-shadow: 0 0 0 1px #1e1e1e;
}

.wepc-swatch--disabled {
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
}

.wepc-swatch--disabled.wepc-swatch--color::after {
	content: '';
	position: absolute;
	top: 50%;
	left: -10%;
	width: 120%;
	height: 2px;
	background: currentColor;
	transform: rotate(45deg);
}

.wepc-availability {
	font-size: 0.9em;
	font-weight: 600;
	color: #2a7d2e;
}

.wepc-availability--out {
	color: #c0392b;
}

.wepc-price {
	font-size: 1.3em;
	font-weight: 700;
}

.wepc-price ins {
	text-decoration: none;
}

.wepc-quantity {
	display: inline-flex;
	align-items: center;
	gap: 0;
	width: fit-content;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
}

.wepc-qty-btn {
	background: #f5f5f5;
	border: none;
	width: 36px;
	height: 36px;
	font-size: 1.1em;
	cursor: pointer;
	line-height: 1;
}

.wepc-qty-btn:hover {
	background: #e9e9e9;
}

.wepc-qty-input {
	width: 52px;
	height: 36px;
	border: none;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
	text-align: center;
	font-size: 1em;
	-moz-appearance: textfield;
}

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

.wepc-order-btn {
	display: inline-block;
	width: fit-content;
	padding: 14px 32px;
	background: #1e1e1e;
	color: #fff;
	text-decoration: none;
	text-align: center;
	font-weight: 700;
	letter-spacing: 0.03em;
	border-radius: 6px;
	border: none;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.wepc-order-btn:hover {
	opacity: 0.9;
	color: #fff;
}

.wepc-order-btn--disabled,
.wepc-order-btn[aria-disabled='true'] {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

.wepc-notice {
	padding: 14px 18px;
	background: #fff3f3;
	border: 1px solid #f3c5c5;
	color: #a33;
	border-radius: 6px;
	font-size: 0.9em;
}

.wepc-debug {
	margin-top: 10px;
	padding: 10px;
	background: #111;
	color: #9fef9f;
	font-size: 12px;
	border-radius: 6px;
	overflow: auto;
	max-height: 220px;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* -------------------------------------------------------------------- */
/* Responsive                                                            */
/* -------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.wepc-image-wrap,
	.wepc-details {
		flex: 1 1 100%;
	}
}

@media (max-width: 767px) {
	.wepc-configurator {
		gap: 16px;
	}

	.wepc-title {
		font-size: 1.25em;
	}

	.wepc-order-btn {
		width: 100%;
		text-align: center;
	}
}

@media (max-width: 480px) {
	.wepc-swatch--text {
		padding: 6px 12px;
		font-size: 0.85em;
	}

	.wepc-swatch--color {
		width: 32px;
		height: 32px;
	}
}
