/**
 * Neximan Furniture Builder - front-end styles.
 */

.neximan-builder {
	--nx-accent: #10b981;
	--nx-accent-dark: #0e9f74;
	--nx-dark: #2c3e50;
	--nx-text: #4a5568;
	--nx-light: #e8eeee;
	--nx-secondary: #c0ccd1;
	--nx-white: #ffffff;
	--nx-preview-1: #e8eeee;
	--nx-preview-2: #d3eae7;

	background: var(--nx-white);
	padding: 60px 2rem;
	font-family: inherit;
	position: relative;
	direction: rtl;
	box-sizing: border-box;
}

.neximan-builder *,
.neximan-builder *::before,
.neximan-builder *::after {
	box-sizing: border-box;
}

.neximan-builder-inner {
	max-width: 1400px;
	margin: 0 auto;
}

/* Series & model tabs */
.neximan-series-tabs,
.neximan-model-tabs {
	display: flex;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.neximan-series-tabs:empty,
.neximan-model-tabs:empty {
	display: none;
}

.neximan-series-tabs {
	margin-bottom: 2rem;
}

.neximan-model-tabs {
	justify-content: flex-start;
	gap: 0.5rem;
}

.neximan-series-tab,
.neximan-model-tab {
	padding: 10px 25px;
	background: transparent;
	border: 2px solid var(--nx-secondary);
	border-radius: 50px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--nx-text);
	cursor: pointer;
	transition: all 0.2s ease;
}

.neximan-model-tab {
	padding: 8px 18px;
	font-size: 0.9rem;
}

.neximan-series-tab.is-active,
.neximan-model-tab.is-active {
	background: var(--nx-dark);
	color: var(--nx-white);
	border-color: var(--nx-dark);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.neximan-series-tab:hover:not(.is-active),
.neximan-model-tab:hover:not(.is-active) {
	background: var(--nx-light);
}

.neximan-model-tabs-wrap:has(.neximan-model-tabs:empty) {
	display: none;
}

/* Header */
.neximan-builder-header {
	text-align: center;
	margin-bottom: 3rem;
}

.neximan-builder-header h2 {
	font-size: clamp(2rem, 5vw, 4rem);
	font-weight: 900;
	color: var(--nx-dark);
	margin: 0 0 0.5rem;
}

.neximan-builder-header p {
	color: var(--nx-text);
	margin: 0;
}

/* Grid */
.neximan-builder-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 3rem;
	align-items: start;
}

/* Preview */
.neximan-preview-area {
	background: linear-gradient(135deg, var(--nx-preview-1), var(--nx-preview-2));
	border-radius: 30px;
	padding: 2rem;
	min-height: 360px;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.neximan-stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.neximan-sofa-display {
	position: relative;
	width: 100%;
	max-width: 800px;
	aspect-ratio: 16 / 9;
	background-color: var(--nx-sofa-color, transparent);
	-webkit-mask-image: var(--nx-bg-image);
	mask-image: var(--nx-bg-image);
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	transition: background-color 0.3s ease;
}

.neximan-sofa-display img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
	display: block;
}

/* Fallback when CSS masks are unsupported */
@supports not ((-webkit-mask-image: url("")) or (mask-image: url(""))) {
	.neximan-sofa-display {
		background-color: transparent !important;
	}
	.neximan-sofa-display img {
		mix-blend-mode: normal !important;
	}
}

/* Modular assembly: module pieces placed side by side */
.neximan-assembly {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	flex-wrap: nowrap;
	width: 100%;
	height: 100%;
	gap: 0;
}

.neximan-piece {
	position: relative;
	display: inline-block;
	height: clamp(130px, 28vw, 240px);
	flex: 0 0 auto;
}

.neximan-piece img {
	height: 100%;
	width: auto;
	display: block;
	object-fit: contain;
}

.neximan-piece.is-tinted {
	background-color: var(--nx-sofa-color, transparent);
	-webkit-mask: var(--nx-bg-image) center / contain no-repeat;
	mask: var(--nx-bg-image) center / contain no-repeat;
}

.neximan-piece.is-tinted img {
	mix-blend-mode: multiply;
}

@supports not ((-webkit-mask-image: url("")) or (mask-image: url(""))) {
	.neximan-piece.is-tinted {
		background-color: transparent !important;
	}
	.neximan-piece.is-tinted img {
		mix-blend-mode: normal !important;
	}
}

.neximan-config-info {
	position: absolute;
	bottom: 1.5rem;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(10px);
	padding: 0.8rem 1.5rem;
	border-radius: 50px;
	display: flex;
	gap: 0.5rem;
	align-items: center;
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
	white-space: nowrap;
}

.neximan-config-info .neximan-info-layout {
	color: var(--nx-dark);
}

.neximan-config-info .neximan-info-module {
	color: var(--nx-text);
}

/* Control panel */
.neximan-control-panel {
	background: var(--nx-white);
	border-radius: 25px;
	padding: 2rem;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
	text-align: right;
}

.neximan-control-section {
	margin-bottom: 2rem;
}

.neximan-control-label {
	font-size: 1rem;
	font-weight: 700;
	color: var(--nx-dark);
	margin-bottom: 0.8rem;
	display: block;
}

/* Layout buttons */
.neximan-layout-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
	gap: 0.5rem;
}

.neximan-layout-btn {
	padding: 0.8rem 0.5rem;
	background: var(--nx-light);
	border: 2px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	text-align: center;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--nx-text);
	min-height: 50px;
	transition: all 0.2s ease;
}

.neximan-layout-btn:hover {
	background: var(--nx-secondary);
}

.neximan-layout-btn.is-active {
	background: var(--nx-accent);
	color: #fff;
}

.neximan-layout-btn.is-hidden {
	display: none;
}

/* Option buttons (size, etc.) */
.neximan-option-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.neximan-option-btn {
	padding: 0.7rem 1.2rem;
	background: var(--nx-light);
	border: 2px solid transparent;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--nx-text);
	transition: all 0.2s ease;
}

.neximan-option-btn:hover {
	background: var(--nx-secondary);
}

.neximan-option-btn.is-active {
	background: var(--nx-accent);
	color: #fff;
}

/* Add-on rows with quantity stepper */
.neximan-addon-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6rem 0;
}

.neximan-addon-name {
	font-weight: 600;
	color: var(--nx-dark);
}

.neximan-stepper {
	display: inline-flex;
	align-items: center;
	border: 2px solid var(--nx-light);
	border-radius: 8px;
	overflow: hidden;
}

.neximan-step {
	width: 36px;
	height: 36px;
	background: var(--nx-light);
	border: none;
	cursor: pointer;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--nx-dark);
	line-height: 1;
}

.neximan-step:hover {
	background: var(--nx-secondary);
}

.neximan-step-qty {
	min-width: 40px;
	text-align: center;
	font-weight: 700;
	color: var(--nx-dark);
}

/* Color swatches */
.neximan-color-options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
	gap: 0.8rem;
}

.neximan-color-swatch {
	width: 100%;
	aspect-ratio: 1;
	border-radius: 10px;
	cursor: pointer;
	border: 2px solid #e2e8f0;
	min-height: 40px;
	padding: 0;
	transition: transform 0.2s ease, border-color 0.2s ease;
}

.neximan-color-swatch.is-active {
	border-color: var(--nx-dark);
	transform: scale(1.1);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Price box */
.neximan-price-box {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 1rem 1.25rem;
	margin-bottom: 1rem;
	background: var(--nx-light);
	border-radius: 12px;
}

.neximan-price-label {
	font-weight: 700;
	color: var(--nx-dark);
}

.neximan-price-value {
	font-size: 1.35rem;
	font-weight: 900;
	color: var(--nx-accent);
}

/* CTA */
.neximan-cta {
	width: 100%;
	padding: 15px;
	background: linear-gradient(135deg, var(--nx-accent), var(--nx-accent-dark));
	color: #fff;
	border: none;
	border-radius: 12px;
	font-size: 1.1rem;
	font-weight: 700;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.neximan-cta:hover {
	opacity: 0.92;
}

.neximan-cta.is-loading {
	opacity: 0.6;
	cursor: progress;
}

.neximan-feedback {
	margin-top: 0.75rem;
	font-size: 0.9rem;
	min-height: 1.2em;
	text-align: center;
}

.neximan-feedback.is-success {
	color: var(--nx-accent-dark);
}

.neximan-feedback.is-error {
	color: #e53e3e;
}

.neximan-feedback a {
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
}

@media (max-width: 900px) {
	.neximan-builder-grid {
		grid-template-columns: 1fr;
	}
}
