/**
 * Ramstudion Frame Builder - Frontend CSS
 *
 * All selectors are scoped under .rsfb-configurator so no styles
 * leak into the surrounding theme.
 *
 * @package RamstudionFrameBuilder
 */

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

/* =========================================================================
   Single-product two-column layout (controls left, preview right)
   ========================================================================= */
.rsfb-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 1.75rem;
	align-items: start;
}

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

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

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

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

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

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

.rsfb-step-note {
	margin: 0 0 0.9rem;
	font-size: 0.9rem;
	color: #4a4a4a;
}

.rsfb-is-hidden {
	display: none;
}

.rsfb-choice-group {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.9rem;
	align-items: stretch;
}

.rsfb-choice-group--compact {
	margin-bottom: 1rem;
}

.rsfb-choice-card {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 1.05rem 1.1rem;
	border: 1px solid #d8d1c7;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	min-height: 140px;
	height: 100%;
	justify-content: flex-start;
}

.rsfb-choice-icon {
	display: inline-flex;
	width: 38px;
	height: 38px;
	color: #b08554;
	margin-bottom: 0.2rem;
}

.rsfb-choice-icon svg {
	width: 100%;
	height: 100%;
}

.rsfb-choice-card input {
	align-self: flex-start;
	margin: 0 0 0.3rem;
	accent-color: #7a5c3a;
}

.rsfb-choice-title {
	font-size: 0.98rem;
	font-weight: 600;
	color: #1a1a1a;
}

.rsfb-choice-text {
	font-size: 0.86rem;
	line-height: 1.4;
	color: #666;
}

.rsfb-choice-card--compact {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	column-gap: 0.6rem;
	padding: 0.8rem 0.95rem;
	min-height: 68px;
}

.rsfb-choice-card--compact input {
	margin: 0;
}

.rsfb-choice-card--compact .rsfb-choice-title {
	margin: 0;
}

/* Dölj native-radioknappen – markering visas via kortets tillstånd */
.rsfb-choice-card input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.rsfb-choice-card {
	position: relative;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.rsfb-choice-card:hover {
	border-color: #c9a84c;
}

.rsfb-choice-card:has(input:checked) {
	border-color: #7a5c3a;
	background: #fdfaf4;
	box-shadow: 0 0 0 2px rgba(122, 92, 58, 0.22);
}

.rsfb-choice-card:has(input:focus-visible) {
	outline: 2px solid #c9a84c;
	outline-offset: 2px;
}

/* Markeringsindikator (bock) uppe till höger */
.rsfb-choice-card::after {
	content: "";
	position: absolute;
	top: 0.7rem;
	right: 0.7rem;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #cfc6b6;
	background: #fff;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.rsfb-choice-card:has(input:checked)::after {
	border-color: #7a5c3a;
	background: #7a5c3a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

/* Plats för bocken i de kompakta korten (glas) */
.rsfb-choice-card--compact {
	padding-right: 2.4rem;
}

.rsfb-current-moulding {
	padding: 0.9rem 1rem;
	margin-bottom: 1rem;
	border: 1px solid #d9d3c8;
	border-radius: 6px;
	background: #fff;
}

.rsfb-current-moulding__label {
	display: block;
	font-size: 0.85rem;
	color: #777;
	margin-bottom: 0.25rem;
}

.rsfb-current-moulding__name {
	font-size: 1rem;
	color: #1a1a1a;
}

.rsfb-current-moulding--hero {
	background: linear-gradient(180deg, #fffdf8 0%, #f8f3ea 100%);
}

.rsfb-current-moulding__single {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin-top: 0.35rem;
}

/* Screen-reader-only helper (keeps the native <select> for a11y/fallback). */
.rsfb-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* =========================================================================
   Ramlist-väljare – samma custom-dropdown på desktop och mobil.
   Byggs av JS från det dolda <select>-elementet; visar miniatyrbild,
   namn och färgprick per rad.
   ========================================================================= */
.rsfb-mp {
	position: relative;
	width: 100%;
	margin-top: 0.35rem;
}

.rsfb-mp__trigger,
.rsfb-mp__option {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) 22px;
	align-items: center;
	gap: 0.9rem;
	width: 100%;
	text-align: left;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
}

/* The theme applies a dark button skin (and its own width/box-sizing rules)
   to all <button> elements with high specificity; force the picker trigger
   to always span the full width of its container regardless of that. */
.rsfb-configurator .rsfb-mp__trigger {
	display: grid !important;
	grid-template-columns: 44px minmax(0, 1fr) 22px !important;
	gap: 0.9rem !important;
	width: 100% !important;
	max-width: none !important;
	min-width: 100% !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	padding: 0.6rem 0.85rem;
	min-height: 56px;
	background-color: #fff !important;
	color: #1f1f1f !important;
	border: 1px solid #d8d1c7 !important;
	border-radius: 10px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	text-transform: none !important;
	font-weight: 400 !important;
}

.rsfb-configurator .rsfb-mp__trigger .rsfb-mp__name {
	color: #1f1f1f !important;
}

.rsfb-configurator .rsfb-mp__trigger:hover {
	border-color: #c4b9aa !important;
}

.rsfb-configurator .rsfb-mp__trigger:focus-visible {
	outline: none;
	border-color: #c9a84c !important;
	box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2) !important;
}

.rsfb-configurator .rsfb-mp__trigger[aria-expanded="true"] {
	border-color: #7a5c3a !important;
}

.rsfb-mp__option {
	background: #fff;
	color: #1f1f1f;
}

.rsfb-mp__thumb {
	width: 44px;
	height: 44px;
	border-radius: 8px;
	border: 1px solid #e2dbd0;
	object-fit: cover;
	background: linear-gradient(180deg, #fff 0%, #f3f3f3 100%);
}

.rsfb-mp__thumb--empty {
	background: var(--rsfb-swatch-color, #2b2b2b);
}

.rsfb-mp__name {
	min-width: 0;
	font-size: 0.95rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rsfb-mp__swatch {
	width: 14px;
	height: 14px;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	background: var(--rsfb-swatch-color, #2b2b2b);
}

/* Clear dropdown affordance: a visible chevron circle, same idiom as the
   native select's arrow so the control is unmistakably a dropdown. */
.rsfb-mp__chevron {
	position: relative;
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	border-radius: 999px;
	background: #f3efe6;
	transition: background 0.15s ease;
}

.rsfb-mp__chevron::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid #6f6457;
	border-bottom: 2px solid #6f6457;
	transform: translate(-50%, -65%) rotate(45deg);
	transition: transform 0.15s ease;
}

.rsfb-configurator .rsfb-mp__trigger[aria-expanded="true"] .rsfb-mp__chevron {
	background: #ece2cd;
}

.rsfb-configurator .rsfb-mp__trigger[aria-expanded="true"] .rsfb-mp__chevron::before {
	transform: translate(-50%, -35%) rotate(-135deg);
}

.rsfb-mp__panel {
	position: absolute;
	z-index: 40;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 0.35rem;
	list-style: none;
	max-height: 340px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #d8d1c7;
	border-radius: 12px;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
	display: none;
}

.rsfb-mp.is-open .rsfb-mp__panel {
	display: block;
}

.rsfb-mp__option {
	padding: 0.5rem 0.6rem;
	border-radius: 8px;
	min-height: 56px;
}

.rsfb-mp__option:hover,
.rsfb-mp__option.is-active {
	background: #f6f1e8;
}

.rsfb-mp__option[aria-selected="true"] {
	background: #fdfaf4;
	box-shadow: inset 0 0 0 2px rgba(122, 92, 58, 0.35);
}

/* Valfria filterchips (Ramfamilj / Färg) ovanför ramlistväljaren – byggs av
   JS enbart när mer än ett unikt värde faktiskt förekommer bland de aktuella
   ramlistalternativen, så de aldrig visas i onödan. */
.rsfb-mp__filters {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-bottom: 0.5rem;
}

.rsfb-mp__filter-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
}

.rsfb-mp__filter-label {
	font-size: 0.78rem;
	font-weight: 600;
	color: #8a7f74;
	margin-right: 0.15rem;
}

.rsfb-mp__filter-chip {
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	padding: 0.3rem 0.75rem;
	font-size: 0.8rem;
	line-height: 1.2;
	border-radius: 999px;
	border: 1px solid #d8d1c7;
	background: #fff;
	color: #5c5c5c;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.rsfb-mp__filter-chip:hover {
	border-color: #c4b9aa;
}

.rsfb-mp__filter-chip.is-active {
	border-color: #7a5c3a;
	background: #7a5c3a;
	color: #fff;
}

/* Temans knapp-stilar (Hello Elementor m.fl.) har hög specificitet och kan
   annars måla om chipsen med tema-färger (t.ex. rosa/svart) – tvinga vår
   egen palett explicit under .rsfb-configurator. */
.rsfb-configurator .rsfb-mp__filter-chip,
.rsfb-configurator button.rsfb-mp__filter-chip {
	background: #fff !important;
	color: #5c5c5c !important;
	border-color: #d8d1c7 !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

.rsfb-configurator .rsfb-mp__filter-chip:hover,
.rsfb-configurator button.rsfb-mp__filter-chip:hover {
	background: #fff !important;
	border-color: #c4b9aa !important;
	color: #5c5c5c !important;
}

.rsfb-configurator .rsfb-mp__filter-chip.is-active,
.rsfb-configurator button.rsfb-mp__filter-chip.is-active {
	background: #7a5c3a !important;
	border-color: #7a5c3a !important;
	color: #fff !important;
}

.rsfb-cart-slot {
	display: flex;
	align-items: stretch;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

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

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

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

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

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

.rsfb-field-row--double-pp {
	align-items: center;
}

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

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

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

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

/* =========================================================================
   Inputs & selects
   ========================================================================= */
.rsfb-input,
.rsfb-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;
}

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

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

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

/* Numeriska måttfält rymmer aldrig mer än ~3 siffror – anpassa bredden efter
   innehållet i stället för att sträcka över hela raden. */
.rsfb-input.rsfb-dim-input {
	flex: 0 0 auto;
	width: 6rem;
	max-width: 6rem;
	text-align: center;
}

/* =========================================================================
   Motivmått – bredd och höjd sida vid sida ("Bredd (cm) × Höjd (cm)"),
   samma rad på både desktop och mobil eftersom fälten aldrig rymmer mer än
   ett par siffror.
   ========================================================================= */
.rsfb-dims-row {
	align-items: flex-start;
	gap: 0.75rem;
}

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

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

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

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

/* Passepartout-dropdowns visar rena tal (1–15) – enheten "cm" anges bara en
   gång, i fältets etikett (.rsfb-label__unit), inte i varje <option>. I det
   4-kolumniga rutnätet får varje fält plats med sin egen smala kolumn, så
   selecten får fylla hela kolumnbredden i stället för en fast bredd. */
.rsfb-pp-grid .rsfb-select.rsfb-pp-input {
	width: 100%;
	max-width: none;
	text-align: center;
	text-align-last: center;
}

.rsfb-label__unit {
	font-weight: 400;
	color: #8a857a;
}

/* =========================================================================
   Passe-partout grid
   ========================================================================= */
.rsfb-pp-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.75rem 1rem;
}

.rsfb-pp-grid .rsfb-field-row {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.35rem;
	margin-bottom: 0;
}

.rsfb-pp-grid .rsfb-label {
	display: block;
	flex: none;
	width: auto;
	margin-bottom: 0;
	text-align: center;
}

.rsfb-pp-grid .rsfb-select {
	width: 100%;
	max-width: none;
}

.rsfb-subheading--with-info {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	position: relative;
}

.rsfb-pp-measure-box {
	margin-top: 1rem;
	padding: 1rem 1rem 1.1rem;
	border: 1px solid #e3ddd2;
	border-radius: 10px;
	background: #fffdf9;
}

.rsfb-pp-measure-box .rsfb-subheading {
	margin-bottom: 0.75rem;
}

.rsfb-pp-measure-box .rsfb-field-row {
	margin-bottom: 0.8rem;
}

.rsfb-pp-measure-box .rsfb-pp-grid {
	margin-top: 0.2rem;
}

.rsfb-info-tooltip {
	position: relative;
	display: inline-flex;
	align-items: center;
}


.rsfb-configurator button.rsfb-info-icon {
	width: 22px;
	height: 22px;
	border: 0 !important;
	border-radius: 999px;
	background: #c9a84c !important;
	color: #fff !important;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	padding: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	appearance: none !important;
	-webkit-appearance: none !important;
	box-shadow: none !important;
	text-transform: none !important;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.rsfb-configurator button.rsfb-info-icon:hover,
.rsfb-configurator button.rsfb-info-icon:focus-visible {
	background: #b8942f !important;
	color: #fff !important;
	outline: none;
}

.rsfb-info-tooltip__content {
	position: absolute;
	top: calc( 100% + 8px );
	left: 50%;
	transform: translateX( -50% );
	width: min( 420px, 84vw );
	padding: 0.7rem 0.8rem;
	border: 1px solid #d8c9a6;
	border-radius: 8px;
	background: #fffdf8;
	color: #2d2d2d;
	font-size: 0.82rem;
	line-height: 1.45;
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.12 );
	z-index: 30;
	text-transform: none;
	letter-spacing: normal;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.rsfb-info-tooltip:hover .rsfb-info-tooltip__content,
.rsfb-info-tooltip:focus-within .rsfb-info-tooltip__content {
	opacity: 1;
	visibility: visible;
}

/* =========================================================================
   Preview
   ========================================================================= */
.rsfb-preview-wrap {
	margin-top: 2rem;
	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;
}

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

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

/* Compact product thumbnails with hover zoom. */
.rsfb-thumbs {
	display: flex;
	align-items: center;
	gap: 10px;
}

.rsfb-thumb {
	position: relative;
	width: 56px;
	height: 56px;
	cursor: zoom-in;
}

.rsfb-thumb__img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid #e6e0d8;
	display: block;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rsfb-thumb:hover .rsfb-thumb__img {
	border-color: #c4b9aa;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.rsfb-thumb__zoom {
	position: absolute;
	left: 50%;
	top: calc(100% + 10px);
	transform: translateX(-50%) scale(0.85);
	transform-origin: center top;
	width: 480px;
	height: 480px;
	max-width: 70vw;
	background-color: #fff;
	background-size: cover;
	background-position: center;
	border-radius: 12px;
	border: 1px solid #e6e0d8;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 30;
}

.rsfb-thumb:hover .rsfb-thumb__zoom {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) scale(1);
}

.rsfb-3d-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 15px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #5a5149;
	background: #ffffff;
	border: 1px solid #ddd5cb;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
	transition: all 0.18s ease;
}

.rsfb-3d-toggle:hover {
	border-color: #c4b9aa;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.rsfb-3d-toggle[aria-pressed="true"] {
	color: #fff;
	background: #6f6457;
	border-color: #6f6457;
}

.rsfb-preview-label {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	color: #6f695d;
	margin-bottom: 0.75rem;
}

.rsfb-preview-stage {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 440px;
	padding: 1.5rem;
	border-radius: 16px;
	background: radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 50%), #ffffff;
	perspective: 1600px;
	/* Safety net: the frame's pixel size is computed by JS from the stage's
	   measured width, but that measurement can be briefly stale during page
	   load (webfonts, Elementor/WooCommerce reflows). box-sizing/max-width
	   here (combined with max-width on .rsfb-preview__frame itself) stop an
	   oversized frame from ever bleeding past the stage on mobile. Overflow
	   is left visible so the 3D-tilt drop shadow on .rsfb-preview__frame
	   isn't clipped. */
	box-sizing: border-box;
	max-width: 100%;
}

.rsfb-preview-stage--3d .rsfb-preview__frame {
	transform: rotateX(7deg) rotateY(-17deg);
	transform-style: preserve-3d;
	box-shadow: 34px 40px 60px rgba(30, 24, 16, 0.32), 0 2px 4px rgba(0, 0, 0, 0.25) !important;
}

.rsfb-preview__frame {
	position: relative;
	border-radius: 0;
	overflow: hidden;
	background: #fdfdfd;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform 0.4s ease, box-shadow 0.3s ease;
	/* Hard cap so the JS-computed inline width/height can never exceed the
	   stage, even if the size was calculated from a stale measurement. */
	max-width: 100%;
	max-height: 100%;
	box-sizing: border-box;
}

.rsfb-preview__frame::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	box-shadow: inset 0 0 0 1px rgba(34, 24, 12, 0.18);
	z-index: 5;
}

.rsfb-preview__frame::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, 0.08) 100%);
	z-index: 5;
}

.rsfb-preview__frame-side {
	position: absolute;
	transition: all 0.25s ease;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.1)), #b4996f;
	background-repeat: no-repeat;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
	border-radius: 0;
	z-index: 2;
}

.rsfb-preview__corner {
	position: absolute;
	z-index: 4;
	background-repeat: no-repeat;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Subtle diagonal seam to mimic 45-degree miter cuts. */
.rsfb-preview__corner::after {
	content: "";
	position: absolute;
	left: -20%;
	top: 50%;
	width: 140%;
	height: 1px;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0.12;
	transform-origin: center center;
}

.rsfb-preview__corner--tl {
	clip-path: polygon(0 0, 100% 0, 0 100%);
}

.rsfb-preview__corner--tl::after {
	transform: rotate(45deg);
}

.rsfb-preview__corner--tr {
	clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.rsfb-preview__corner--tr::after {
	transform: rotate(-45deg);
}

.rsfb-preview__corner--br {
	clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.rsfb-preview__corner--br::after {
	transform: rotate(45deg);
}

.rsfb-preview__corner--bl {
	clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.rsfb-preview__corner--bl::after {
	transform: rotate(-45deg);
}

.rsfb-preview__opening {
	position: absolute;
	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);
	overflow: hidden;
	z-index: 1;
}

.rsfb-preview__pp {
	position: relative;
	background: #f7f4ee;
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
	transition: all 0.25s ease;
}

.rsfb-preview__pp--plain {
	background: #e4ded4;
	padding: 0 !important;
}

.rsfb-preview__motif {
	position: relative;
	z-index: 1;
	background: #cbc8c2;
	min-width: 4px;
	min-height: 4px;
	    box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.14);
	transition: all 0.25s ease;
}

.rsfb-preview__bevel {
	position: absolute;
	pointer-events: none;
	background: transparent;
	/* Crisp white bevel cut (Nordenica-style inset outline). Light comes from
	   the top-left, so the recess casts a stronger shadow on the top + left
	   edges (positive inset offset) and stays light at bottom-right. */
	box-shadow:
		inset 0 0 0 2px #ffffff,
		inset 0 0 0 2px rgba(0, 0, 0, 0.04),
		inset 3px 3px 4px -2px rgba(0, 0, 0, 0.34),
		inset -1px -1px 2px -1px rgba(255, 255, 255, 0.55);
	z-index: 2;
}

/* Double mat: a second identical passepartout whose opening sits ~10 mm
   outside the top-mat opening. Inspired by Nordenica: the bevel cut is a crisp
   white inset outline (not a blurred glow); depth comes from a short recess
   shadow and a faint outer separation line marking the second mat step. */
.rsfb-preview__bevel--double::before {
	content: "";
	position: absolute;
	inset: calc( -1 * var(--rsfb-double-reveal-px, 7px) );
	pointer-events: none;
	background: transparent;
	box-shadow:
		inset 0 0 0 2px #ffffff,
		inset 0 0 0 2px rgba(0, 0, 0, 0.04),
		inset 3px 3px 4px -2px rgba(0, 0, 0, 0.34),
		inset -1px -1px 2px -1px rgba(255, 255, 255, 0.55);
	z-index: 2;
}

.rsfb-preview__bevel--double::after {
	content: "";
	position: absolute;
	inset: calc( -1 * var(--rsfb-double-reveal-px, 7px) );
	pointer-events: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
	z-index: 3;
}

.rsfb-preview__motif--placeholder {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='500' viewBox='0 0 340 500'%3E%3Cdefs%3E%3ClinearGradient id='sky' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23eef6fa'/%3E%3Cstop offset='1' stop-color='%23f8f3ea'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='340' height='500' fill='url(%23sky)'/%3E%3Ccircle cx='252' cy='118' r='46' fill='%23fdf4d2' opacity='0.9'/%3E%3Cpath d='M0 360 L90 300 L150 345 L220 285 L300 335 L340 312 L340 500 L0 500 Z' fill='%23dce9cf' opacity='0.85'/%3E%3Cpath d='M0 408 L80 362 L160 402 L240 352 L340 396 L340 500 L0 500 Z' fill='%23c7dbb6' opacity='0.9'/%3E%3C/svg%3E");
	background-color: #eef6fa;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.rsfb-preview__glass {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(122deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.08) 24%, rgba(255, 255, 255, 0.18) 38%, rgba(255, 255, 255, 0.06) 48%, rgba(255, 255, 255, 0) 62%);
	opacity: 0.4;
	mix-blend-mode: screen;
	z-index: 3;
}

.rsfb-preview-meta {
	display: flex;
	justify-content: center;
	gap: 14px;
	margin-top: 1.35rem;
}

/* Compact single-line measurement pill. */
.rsfb-preview-meta--slim {
	align-items: center;
	gap: 8px;
	margin-top: 0.85rem;
	padding: 6px 14px;
	width: fit-content;
	margin-left: auto;
	margin-right: auto;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.rsfb-preview-meta--slim .rsfb-preview-meta__label {
	display: inline;
	margin: 0;
	font-size: 0.8rem;
	color: #8a7f74;
}

.rsfb-preview-meta--slim .rsfb-preview-meta__value {
	display: inline;
	font-size: 0.92rem;
}

.rsfb-preview-meta__item {
	padding: 14px 16px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.65);
	border: 1px solid rgba(0, 0, 0, 0.05);
	text-align: center;
}

.rsfb-preview-meta__label {
	display: block;
	font-size: 0.85rem;
	color: #8a7f74;
	margin-bottom: 5px;
}

.rsfb-preview-meta__value {
	display: block;
	font-size: 1.05rem;
	font-weight: 600;
	color: #4c443d;
}

/* Hide the theme's default product gallery on frame-builder product pages
   (the configurator shows its own compact thumbnail strip instead). The
   body class is added by JS only when the configurator is present, so other
   products are unaffected. */
.rsfb-has-configurator .woocommerce-product-gallery,
.rsfb-has-configurator .woocommerce-product-gallery--columns-4 {
	display: none !important;
}

/* With the theme gallery hidden, let the product summary span the full row
   and center it instead of staying floated to the right. */
.rsfb-has-configurator div.product .summary,
.rsfb-has-configurator div.product .entry-summary {
	float: none !important;
	clear: both !important;
	width: 100% !important;
	max-width: 100% !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

.rsfb-preview-dims {
	text-align: center;
	font-size: 0.72rem;
	color: #7a7468;
	margin-top: 0.65rem;
}

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

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

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

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

.rsfb-breakdown {
	margin-top: 0.5rem;
	font-size: 0.67rem;
	line-height: 1.35;
	color: #8a857a;
}

.rsfb-breakdown__line {
	margin: 0;
}

/* =========================================================================
   Validation errors
   ========================================================================= */
.rsfb-errors {
	display: none;
	background: #fdf0f0;
	border: 1px solid #e74c3c;
	border-radius: 6px;
	padding: 0.875rem 1.25rem;
	margin-bottom: 1rem;
}

.rsfb-errors--visible {
	display: block;
}

.rsfb-errors p {
	margin: 0.2rem 0;
	font-size: 0.9rem;
	color: #c0392b;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1024px) {
	.rsfb-layout {
		grid-template-columns: 1fr;
	}

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

	body.single-product.rsfb-has-configurator div.product .woocommerce-product-gallery,
	body.single-product.rsfb-has-configurator div.product .summary.entry-summary,
	body.single-product div.product:has(.summary.entry-summary .rsfb-configurator) .woocommerce-product-gallery,
	body.single-product div.product .summary.entry-summary:has(.rsfb-configurator) {
		width: 100% !important;
		max-width: 100% !important;
	}
}

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

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

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

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

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

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

	/* Behåll de smala måttfälten även på mobil. */
	.rsfb-input.rsfb-dim-input {
		width: 6rem;
		max-width: 6rem;
	}

	/* Motivmått: behåll bredd/höjd sida vid sida även på mobil – fälten är
	   korta och vinner på att stå kvar på samma rad i stället för att
	   staplas som övriga fältrader gör. */
	.rsfb-dims-row {
		flex-direction: row;
		align-items: flex-start;
		gap: 0.5rem;
	}

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

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

	.rsfb-info-tooltip__content {
		left: 0;
		transform: none;
		width: min( 420px, calc( 100vw - 2.5rem ) );
	}

	.rsfb-choice-group {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rsfb-choice-card {
		min-height: 124px;
		padding: 0.95rem 1rem;
	}

	.rsfb-choice-title {
		font-size: 0.95rem;
	}

	.rsfb-choice-text,
	.rsfb-price-note,
	.rsfb-preview-dims,
	.rsfb-preview-subtitle {
		font-size: 0.8rem;
	}

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

	.rsfb-preview-stage {
		min-height: 380px;
		padding: 1.1rem;
	}

	.rsfb-preview-meta {
		grid-template-columns: 1fr;
	}

	.rsfb-preview-title {
		font-size: 1.2rem;
	}
}


@media (max-width: 640px) {
	.rsfb-choice-group {
		grid-template-columns: 1fr;
	}

	.rsfb-pp-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* =========================================================================
   Full-width product area on Frame Builder pages (Hello theme / WooCommerce
   default single-product template).

   When the Elementor single-product template is disabled for Frame Builder
   products, the page falls back to the theme's default WooCommerce layout.
   The generic `.summary.entry-summary { width: 76% }` rule above then wins on
   specificity and WooCommerce floats the summary, cramping the configurator.
   These selectors add the `.rsfb-has-configurator` class to raise specificity
   above that rule and let the configurator use the full available width.
   ========================================================================= */
body.single-product.rsfb-has-configurator div.product {
	max-width: 1600px;
	margin: 0 auto;
	float: none;
	display: block;
}

body.single-product.rsfb-has-configurator div.product .summary.entry-summary {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

/* Hello theme wraps content in .site-main / .page-content – ensure full width. */
.rsfb-has-configurator .site-main,
.rsfb-has-configurator .page-content {
	max-width: 100%;
	width: 100%;
}

/* Fallback for editor/preview contexts where body class can be missing.
   Apply full-width Woo layout only when the product page actually contains
   the Frame Builder configurator. */
body.single-product div.product:has(.summary.entry-summary .rsfb-configurator) {
	max-width: 1600px;
	margin: 0 auto;
	float: none;
	display: block;
}

body.single-product div.product:has(.summary.entry-summary .rsfb-configurator) .woocommerce-product-gallery {
	display: none !important;
	width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

body.single-product div.product .summary.entry-summary:has(.rsfb-configurator) {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

/* =========================================================================
   Produktinformation-panel (beskrivning i configuratorn)
   ========================================================================= */
.rsfb-current-moulding__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.25rem;
}

.rsfb-current-moulding__head .rsfb-current-moulding__label {
	margin-bottom: 0;
}

.rsfb-current-moulding__head .rsfb-info-icon {
	cursor: pointer;
	flex: 0 0 auto;
}

.rsfb-info-tooltip--desc {
	flex: 0 0 auto;
}

.rsfb-info-tooltip__content--desc {
	left: auto;
	right: 0;
	transform: none;
	width: min( 520px, 88vw );
	padding: 0.95rem 1rem;
	font-size: 0.9rem;
	line-height: 1.55;
}

.rsfb-info-tooltip__content--desc > *:first-child { margin-top: 0; }
.rsfb-info-tooltip__content--desc > *:last-child { margin-bottom: 0; }

/* =========================================================================
   Dölj överflödiga tema/WooCommerce-element ENBART på Frame Builder-produkter.
   Body-klassen rsfb-has-configurator sätts server-side endast på produkter
   med Frame Builder aktiverat (_rsfb_enabled), så inga andra produkter berörs.
   Produkttitel, breadcrumbs, kategorier, beskrivningsflik och relaterade
   produkter göms; beskrivningen visas i stället i "Produktinformation"-panelen.
   ========================================================================= */
.rsfb-has-configurator .woocommerce-breadcrumb,
.rsfb-has-configurator nav.woocommerce-breadcrumb,
.rsfb-has-configurator .product_title,
.rsfb-has-configurator .entry-summary > .entry-title,
.rsfb-has-configurator .elementor-widget-woocommerce-product-title,
.rsfb-has-configurator .woocommerce-tabs,
.rsfb-has-configurator .wc-tabs-wrapper,
.rsfb-has-configurator .woocommerce-product-details__short-description,
.rsfb-has-configurator .product_meta,
.rsfb-has-configurator .related.products,
.rsfb-has-configurator .elementor-widget-woocommerce-breadcrumb,
.rsfb-has-configurator .elementor-widget-wc-tabs,
.rsfb-has-configurator .elementor-widget-woocommerce-product-content,
.rsfb-has-configurator .elementor-widget-woocommerce-product-related {
	display: none !important;
}

/* Elementor can render a separate product-price widget outside the standard
   WooCommerce hook stack. Hide it on Frame Builder products to avoid duplicate
   pricing above the configurator. */
.rsfb-has-configurator .elementor-widget-woocommerce-product-price,
.rsfb-has-configurator .elementor-widget[data-widget_type^="woocommerce-product-price"],
.rsfb-has-configurator .elementor-widget-woocommerce-product-price .price,
.rsfb-has-configurator .elementor-widget-woocommerce-product-price p.price,
.rsfb-has-configurator .entry-summary > p.price {
	display: none !important;
}

/* Some Elementor single-product templates wrap the summary differently,
   which can cause a narrow column. Force full width where RSFB is present. */
.rsfb-has-configurator .entry-summary:has(.rsfb-configurator),
.rsfb-has-configurator .elementor-widget:has(.rsfb-configurator),
.rsfb-has-configurator .elementor-widget-container:has(.rsfb-configurator) {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	clear: both !important;
}
