/**
 * Ramstudion Passepartout Builder - Frontend CSS
 *
 * Visuellt och responsivt samordnad med ramstudion-frame-builder:s
 * frontend.css (samma färgpalett, samma fieldset/legend-mönster, samma
 * tvåkolumns-layout med sticky förhandsvisning, samma brytpunkter).
 * Alla selektorer är scopade under .rspp-builder så inget läcker ut i temat.
 *
 * @package RamstudionPassepartoutBuilder
 */

/* =========================================================================
   Configurator container
   ========================================================================= */
.rspp-builder {
	max-width: 1600px;
	margin: 2rem auto;
	font-family: inherit;
	color: inherit;
}

.rspp-heading {
	font-size: 1.25rem;
	font-weight: 700;
	margin-bottom: 1.25rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #c9a84c;
	color: #1a1a1a;
}

/* =========================================================================
   Two-column layout (controls left, preview right) – same grid as frame-builder
   ========================================================================= */
.rspp-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 1.75rem;
	align-items: start;
}

.rspp-col-controls,
.rspp-col-preview {
	min-width: 0;
}

.rspp-col-preview {
	position: sticky;
	top: 2rem;
}

/* =========================================================================
   Fieldsets
   ========================================================================= */
.rspp-fieldset {
	border: 1px solid #e0ddd8;
	border-radius: 6px;
	padding: 1.25rem 1.5rem;
	margin-bottom: 1.25rem;
	background: #faf9f7;
}

.rspp-legend {
	font-size: 0.9rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #5c5c5c;
	padding: 0 0.5rem;
}

.rspp-subheading {
	font-size: 0.82rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #666;
	margin: 0 0 0.9rem;
}

.rspp-subheading:not(:first-child) {
	margin-top: 1.1rem;
}

/* =========================================================================
   Field rows
   ========================================================================= */
.rspp-field-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 0.875rem;
}

.rspp-field-row:last-child {
	margin-bottom: 0;
}

.rspp-label {
	flex: 0 0 200px;
	font-size: 0.9rem;
	font-weight: 500;
	color: #333;
}

.rspp-required {
	color: #c0392b;
	margin-left: 2px;
}

.rspp-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	font-size: 0.9rem;
	color: #333;
	cursor: pointer;
}

.rspp-checkbox input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: #7a5c3a;
	margin: 0;
}

/* =========================================================================
   Inputs & selects
   ========================================================================= */
.rspp-input,
.rspp-select {
	flex: 1;
	padding: 0.5rem 0.75rem;
	min-height: 44px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.95rem;
	background: #fff;
	color: #1a1a1a;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	max-width: 240px;
	box-sizing: border-box;
}

.rspp-input:focus,
.rspp-select:focus {
	outline: none;
	border-color: #c9a84c;
	box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.rspp-input[type="number"] {
	appearance: textfield;
	-moz-appearance: textfield;
}

.rspp-input[type="number"]::-webkit-inner-spin-button,
.rspp-input[type="number"]::-webkit-outer-spin-button {
	opacity: 1;
}

/* =========================================================================
   Dimension rows – bredd × höjd sida vid sida, samma rad på både desktop
   och mobil (samma mönster som .rsfb-dims-row i frame-builder).
   ========================================================================= */
.rspp-dims-row {
	align-items: flex-start;
	gap: 0.75rem;
}

.rspp-dims-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1 1 0;
	min-width: 0;
}

.rspp-dims-label {
	display: block;
	font-size: 0.85rem;
	font-weight: 500;
	color: #333;
}

.rspp-input.rspp-dims-input {
	width: 100%;
	max-width: none;
	flex: 1 1 auto;
	text-align: center;
	font-size: 1.1rem;
	font-weight: 600;
}

.rspp-dims-separator {
	flex: 0 0 auto;
	align-self: flex-end;
	margin-bottom: 0.6rem;
	font-size: 1.1rem;
	font-weight: 600;
	color: #8a857a;
}

/* =========================================================================
   Preview
   ========================================================================= */
.rspp-preview-wrap {
	margin-top: 0;
	padding: 1.75rem;
	border: 1px solid #e6e0d8;
	border-radius: 20px;
	background: linear-gradient(180deg, #f8f5f1 0%, #f3efe9 100%);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
	margin-bottom: 1.25rem;
	display: block;
}

.rspp-preview-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 0.85rem;
	min-height: 24px;
}

.rspp-preview-eyebrow {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #8a7f74;
}

.rspp-preview-stage {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 380px;
	padding: 1.5rem;
	border-radius: 16px;
	background: radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 50%), #ffffff;
	box-sizing: border-box;
	max-width: 100%;
}

.rspp-preview-box {
	position: relative;
	width: 100%;
	max-width: 320px;
	aspect-ratio: 3 / 4;
	background: #f7f4ee;
	border: 1px solid #e6e0d8;
	border-radius: 4px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
	margin: 0 auto;
}

.rspp-preview-opening {
	position: absolute;
	top: 20%;
	right: 15%;
	bottom: 20%;
	left: 15%;
	background: #efece6;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07), inset 0 2px 5px rgba(0, 0, 0, 0.06);
	transition: all 0.25s ease;
}

.rspp-preview-labels {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.rspp-preview-labels span {
	position: absolute;
	font-size: 0.75rem;
	color: #6f695d;
	background: rgba(255, 255, 255, 0.85);
	padding: 0.15rem 0.45rem;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.rspp-label-top { top: 6px; left: 50%; transform: translateX(-50%); }
.rspp-label-bottom { bottom: 6px; left: 50%; transform: translateX(-50%); }
.rspp-label-left { left: 6px; top: 50%; transform: translateY(-50%); }
.rspp-label-right { right: 6px; top: 50%; transform: translateY(-50%); }

/* =========================================================================
   Price display
   ========================================================================= */
.rspp-price-wrap {
	background: #fff8ee;
	border: 1px solid #e8d49a;
	border-radius: 6px;
	padding: 1rem 1.5rem;
	margin-bottom: 1.25rem;
}

.rspp-price-label {
	font-size: 0.85rem;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.rspp-price {
	font-size: 2rem;
	font-weight: 700;
	margin: 0 0 0.35rem;
	color: #1a1a1a;
}

.rspp-price-value {
	color: inherit;
}

.rspp-price-note {
	font-size: 0.8rem;
	color: #888;
	margin: 0;
}

/* =========================================================================
   Add-to-cart slot
   ========================================================================= */
.rspp-cart-slot {
	display: flex;
	align-items: stretch;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.rspp-cart-slot .quantity {
	margin: 0;
	flex: 0 0 auto;
}

.rspp-cart-slot .quantity .qty {
	height: 50px;
	min-height: 50px;
	text-align: center;
}

.rspp-cart-slot .single_add_to_cart_button {
	flex: 1 1 auto;
	min-height: 50px;
	font-size: 1.05rem;
	font-weight: 600;
}

/* =========================================================================
   Validation errors
   ========================================================================= */
.rspp-errors {
	font-size: 0.9rem;
	color: #c0392b;
}

.rspp-errors:empty {
	display: none;
}

.rspp-errors:not(:empty) {
	background: #fdf0f0;
	border: 1px solid #e74c3c;
	border-radius: 6px;
	padding: 0.875rem 1.25rem;
	margin-bottom: 1rem;
}

/* =========================================================================
   Responsive – samma brytpunkter och logik som frame-builder
   ========================================================================= */
@media (max-width: 1024px) {
	.rspp-layout {
		grid-template-columns: 1fr;
	}

	.rspp-col-preview {
		position: static;
		order: -1;
		margin-bottom: 1.25rem;
	}
}

@media (max-width: 768px) {
	.rspp-builder {
		max-width: 100%;
		margin: 1rem 0;
	}

	.rspp-heading {
		font-size: 1.1rem;
	}

	.rspp-fieldset,
	.rspp-price-wrap,
	.rspp-preview-wrap {
		padding: 1rem;
	}

	.rspp-field-row {
		flex-direction: column;
		align-items: flex-start;
	}

	.rspp-label {
		flex: none;
		width: 100%;
		font-size: 0.95rem;
	}

	.rspp-input,
	.rspp-select {
		max-width: 100%;
		width: 100%;
	}

	/* Behåll bredd/höjd sida vid sida även på mobil. */
	.rspp-dims-row {
		flex-direction: row;
		align-items: flex-start;
		gap: 0.5rem;
	}

	.rspp-dims-field {
		width: auto;
	}

	.rspp-input.rspp-dims-input {
		width: 100%;
	}

	.rspp-price {
		font-size: 1.7rem;
	}

	.rspp-preview-stage {
		min-height: 320px;
		padding: 1.1rem;
	}
}

@media (max-width: 640px) {
	.rspp-preview-box {
		max-width: 100%;
	}
}
