/**
 * WooCommerce Product Configurator — shared styles for popup + inline.
 *
 * The configurator UI is built into a neutral `.wpc-config` root, so the same
 * image pane, sidebar, option selectors, price/stock and add-to-cart styles are
 * shared between the fullscreen overlay (popup) and the inline (full-page) mount.
 * Host-specific layout lives under `.wpc-overlay .wpc-config` / `.wpc-inline .wpc-config`.
 *
 * All selectors are namespaced under `.wpc-` to avoid collisions with the theme
 * or Elementor.
 */

/* ------------------------------------------------------------------ *
 * Scroll lock (added to <html> and <body> while the overlay is open).
 * ------------------------------------------------------------------ */
.wpc-locked {
	overflow: hidden !important;
}

/* ------------------------------------------------------------------ *
 * Overlay mount point.
 * ------------------------------------------------------------------ */
#wpc-root[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Overlay + backdrop. Sits above Elementor sticky headers.
 * ------------------------------------------------------------------ */
.wpc-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	font-family: inherit;
	box-sizing: border-box;
}

.wpc-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.wpc-overlay *,
.wpc-overlay *::before,
.wpc-overlay *::after {
	box-sizing: border-box;
}

.wpc-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 17, 17, 0.72);
	cursor: pointer;
}

/* Dialog: a positioned, fixed-size frame the `.wpc-config` grid fills. */
.wpc-overlay__dialog {
	position: relative;
	margin: auto;
	width: 100%;
	height: 100%;
	max-width: 1600px;
	max-height: 100vh;
	background: #ffffff;
	overflow: hidden;
	transform: translateY(12px);
	transition: transform 0.2s ease;
}

.wpc-overlay.is-open .wpc-overlay__dialog {
	transform: translateY(0);
}

/* Close button. */
.wpc-overlay__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	line-height: 1;
	color: #222;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.15s ease;
}

.wpc-overlay__close:hover {
	background: #f0f0f0;
}

/* ------------------------------------------------------------------ *
 * Inline host wrapper (full-page configurator placed in the page flow).
 * ------------------------------------------------------------------ */
.wpc-inline {
	font-family: inherit;
	box-sizing: border-box;
}

.wpc-inline *,
.wpc-inline *::before,
.wpc-inline *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ *
 * Shared configurator root + per-host grid layout.
 * ------------------------------------------------------------------ */
.wpc-config {
	--wpc-sidebar-w: 380px; /* shared by the grid track and the info slidebar width */
	/* Horizontal sidebar padding. Shared with the tab bar, which cancels it with a
	 * negative margin to span the sidebar edge to edge — keeping both on one variable
	 * means the breakout can't drift out of sync with the padding it undoes. */
	--wpc-sidebar-pad-x: 32px;
	/* Tab bar look. Overridable from the Elementor inline widget (Style → Tabs). */
	--wpc-tab-bg: transparent;
	--wpc-tab-color: #888;
	--wpc-tab-color-active: #111;
	/* Breathing room between the active tab's underline and the bar's bottom edge; it is
	 * the bar's bottom padding, so the two lines never touch. */
	--wpc-tab-underline-gap: 6px;

	/* Accent: one colour for every "this is the chosen / hovered thing" cue — the active
	 * tab's underline, an option's border (hover and selected, colour swatches included), an
	 * accessory row that is in the cart, and the ⓘ hover. Elementor: Style → Accent. */
	--wpc-accent: #222;

	/* ⓘ triggers (Style → Info icons). Their hover colour is --wpc-accent. */
	--wpc-info-color: #888;

	/* Sidebar header (Style → Header): the product title and the price under it. The price
	 * is deliberately smaller than the title — see .wpc-title / .wpc-price below. */
	--wpc-title-color: #222;
	--wpc-price-color: #111;

	/* Attribute labels above an option row (Style → Labels), and the chosen term shown on
	 * the same line, right of the label. */
	--wpc-label-color: #555;
	--wpc-value-color: #222;

	/* Separators (Style → Separators): the hairlines between the sidebar's blocks, plus the
	 * tab bar's bottom edge and the action footer's top edge. Thickness 0 removes them all.
	 * The inset is measured from the sidebar edge: 0 = edge to edge, --wpc-sidebar-pad-x
	 * lines the rule up with the content. */
	--wpc-sep-color: #ececec;
	--wpc-sep-thickness: 1px;
	--wpc-sep-inset: 0px;

	/* Option buttons (Style → Options). The "-active" pair is the selected state; the
	 * radius is shared with the personalization input that sits under an option row, and
	 * the border width with that input and the colour swatches. */
	--wpc-option-bg: #fff;
	--wpc-option-border: #cfcfcf;
	--wpc-option-color: #222;
	--wpc-option-bg-active: #fff;
	--wpc-option-color-active: #222;
	--wpc-option-radius: 6px;
	--wpc-option-border-w: 1px;

	/* Colour swatches (Style → Options → Colour swatches). A swatch is an option button with
	 * a coloured disc on it: the disc's diameter plus the padding around it is the button, so
	 * the defaults land on the 44px height of a text option. */
	--wpc-swatch-size: 32px;
	--wpc-swatch-pad: 6px;

	/* Footer summary (Style → Total & delivery). The delivery text keeps the amber tone it
	 * had as a boxed notice, now as plain text next to the amount. */
	--wpc-total-color: #111;
	--wpc-delivery-color: #8a5a00;

	/* Action buttons (Style → Action buttons): primary = Continue / Checkout, secondary =
	 * Continue shopping. Disabled states are painted explicitly instead of dimmed with
	 * opacity, so a configured colour is never washed out by a layer on top of it. */
	--wpc-add-bg: #222;
	--wpc-add-color: #fff;
	--wpc-add-border: transparent;
	--wpc-add-bg-disabled: #9c9c9c; /* ≈ #222 at 45% over white, i.e. the old opacity look */
	--wpc-add-color-disabled: #fff;
	--wpc-add-border-disabled: transparent;
	--wpc-add-radius: 8px; /* shared by both action buttons */
	--wpc-add-border-w: 1px; /* the primary border is transparent until a colour is set */
	--wpc-btn2-bg: #fff;
	--wpc-btn2-color: #222;
	--wpc-btn2-border: #cfcfcf;
	--wpc-btn2-bg-disabled: #fff;
	--wpc-btn2-color-disabled: #9c9c9c;
	--wpc-btn2-border-disabled: #e7e7e7;
	--wpc-btn2-border-w: 1px;

	/* Accessory rows (Style → Accessories). Borderless: the separator lines and the white
	 * space carry the structure, and "in cart" reads from the tint plus the filled check. */
	--wpc-acc-bg: #fff;
	--wpc-acc-bg-selected: #fafafa;
	--wpc-acc-radius: 8px;
	--wpc-acc-img-size: 64px;
	--wpc-acc-label-color: #888; /* the group title above a set of rows */
	--wpc-acc-name-color: #222;
	--wpc-acc-price-color: #111;
	display: grid;
	min-width: 0;
	position: relative; /* anchor the absolutely-positioned info slidebar */
}

.wpc-overlay .wpc-config {
	width: 100%;
	height: 100%;
	grid-template-columns: 1fr var(--wpc-sidebar-w);
	grid-template-areas: "image sidebar";
}

.wpc-inline .wpc-config {
	grid-template-columns: 1fr var(--wpc-sidebar-w);
	grid-template-areas: "image sidebar";
	gap: 2rem;
	align-items: start;
}

.wpc-inline--image-right .wpc-config {
	grid-template-columns: var(--wpc-sidebar-w) 1fr;
	grid-template-areas: "sidebar image";
}

/* Inline full-screen modifier: break out of a boxed Elementor parent to fill the
 * viewport. Inline-only — never applied to .wpc-overlay. */
.wpc-inline--fullscreen {
	width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	/* Fit below whatever sits above the configurator (site header, admin bar, etc.).
	 * --wpc-header-h is measured + set in JS (syncViewportOffset); 0px before it runs. */
	min-height: calc( 100vh - var( --wpc-header-h, 0px ) );
}

.wpc-inline--fullscreen .wpc-config {
	min-height: calc( 100vh - var( --wpc-header-h, 0px ) );
	align-items: stretch; /* override the inline `align-items: start` so panes fill height */
	gap: 0;
}

/* The image scales to its (now full-height) pane instead of the 72vh cap below. */
.wpc-inline--fullscreen .wpc-image {
	max-height: 100%;
}

/* A tall sidebar is bounded to the viewport; the scroll lives in the panel body
 * (below) so the tabs and the action footer stay pinned. */
.wpc-inline--fullscreen .wpc-config__sidebar {
	max-height: calc( 100vh - var( --wpc-header-h, 0px ) );
	overflow: hidden;
}

/* ------------------------------------------------------------------ *
 * Image pane.
 * ------------------------------------------------------------------ */
.wpc-config__image {
	grid-area: image;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	background: #f7f7f7;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

/* Inline mode shows the page background through the image pane (the popup keeps its
 * grey studio backdrop, which sits inside a white dialog). */
.wpc-inline .wpc-config__image {
	background: transparent;
}

.wpc-image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

/* In the page flow the pane has no fixed height, so cap the image to the viewport. */
.wpc-inline .wpc-image {
	max-height: 72vh;
}

/* ------------------------------------------------------------------ *
 * Sidebar.
 * ------------------------------------------------------------------ */
/* Vertical padding only: the horizontal inset lives on the children (tab bar, panel body,
 * action footer). That is what lets a separator inside the scrolling body bleed out to the
 * sidebar edge — a negative margin reaching into the body's *own* padding stays inside its
 * padding box, while escaping a padding set here would push scrollable overflow sideways and
 * hand the body a horizontal scrollbar (overflow-y: auto makes overflow-x: auto too). */
.wpc-config__sidebar {
	grid-area: sidebar;
	position: relative;
	z-index: 3; /* on top of the info slidebar (z 2) + image scrim (z 1) */
	display: flex;
	flex-direction: column;
	min-height: 0; /* allow the panel body to shrink and own the scroll */
	padding: 32px 0;
	background: #fff; /* opaque so it occludes the slidebar tucked behind it */
	color: #222;
}

/* Overlay sidebar is bounded by the fixed dialog and clears the close button;
 * its scroll lives in the panel body so the tabs + action footer stay pinned. */
.wpc-overlay .wpc-config__sidebar {
	padding-top: 64px;
	overflow: hidden;
	border-left: 1px solid #ececec;
}

/* Hairlines between the sidebar's blocks (Style → Separators), drawn on the block that
 * starts below each one. As pseudo-elements they disappear together with a hidden block,
 * which real <hr> siblings would not.
 *
 * Full-bleed by default: the negative margin reaches into the panel's own horizontal padding
 * (see .wpc-tabpanel__body) and --wpc-sep-inset pulls the rule back in from both sidebar
 * edges. No rule above .wpc-price — the title and its price read as one header block, so the
 * first line is the one that splits that header off from the attribute list. `:not(:empty)`
 * on .wpc-stock matters: that block keeps its height when it has no message, so without the
 * guard it would show a line permanently. */
.wpc-tabpanel__body > .wpc-selectors::before,
.wpc-tabpanel__body > .wpc-stock:not(:empty)::before,
.wpc-tabpanel__body > .wpc-accessory-group + .wpc-accessory-group::before,
.wpc-selectors > .wpc-attr + .wpc-attr::before {
	content: '';
	display: block;
	flex: 0 0 auto; /* two of these parents are flex columns — never stretch or shrink it */
	height: var( --wpc-sep-thickness );
	margin-right: calc( var( --wpc-sep-inset ) - var( --wpc-sidebar-pad-x ) );
	margin-left: calc( var( --wpc-sep-inset ) - var( --wpc-sidebar-pad-x ) );
	background: var( --wpc-sep-color );
}

/* Where the parent is a plain block the line needs its own space below it; inside the flex
 * columns (.wpc-selectors, .wpc-attr) their `gap` already provides it. */
.wpc-tabpanel__body > .wpc-stock:not(:empty)::before,
.wpc-tabpanel__body > .wpc-accessory-group + .wpc-accessory-group::before {
	margin-bottom: 16px;
}

/* Title + price are one header block (Style → Header): no separator runs between them, and
 * the price is a step down from the title so it reads as the title's subline. */
.wpc-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 8px;
	font-size: 1.5rem;
	line-height: 1.25;
	font-weight: 600;
	color: var( --wpc-title-color );
}

.wpc-price {
	margin: 0 0 24px;
	font-size: 1.25rem;
	color: var( --wpc-price-color );
}

.wpc-price del {
	opacity: 0.5;
	font-weight: 400;
	margin-right: 6px;
}

.wpc-price ins {
	text-decoration: none;
	font-weight: 600;
}

/* A matched variation's price arrives wrapped in `<span class="price">` (WooCommerce builds
 * it that way in WC_Product_Variable::get_available_variations()), and WooCommerce's own
 * stylesheet paints `div.product span.price` olive at 1.25em — specificity (0,3,2), which
 * outranks the colour set on .wpc-price above. Since a default variation matches on load, that
 * rule would win from the first paint and the configured colour would never show. Hence the
 * doubled class: (0,4,0) beats it without reaching for !important. `font: inherit` clears the
 * 1.25em from that same rule and still carries the del/ins weights above, because those sit on
 * the ancestor these nodes inherit from. */
.wpc-config .wpc-price .price.price,
.wpc-config .wpc-price .amount,
.wpc-config .wpc-price bdi {
	font: inherit;
	color: inherit;
}

/* ------------------------------------------------------------------ *
 * Attribute selectors.
 * ------------------------------------------------------------------ */
.wpc-selectors {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0 0 24px;
}

.wpc-attr {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Label row: the property name left, the chosen term right, sharing one baseline. It wraps
   rather than overflowing when a long value meets a narrow sidebar, and the value's auto
   margin keeps it right-aligned on the second line too. */
.wpc-attr__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 12px;
}

.wpc-attr__label {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --wpc-label-color );
}

/* The chosen term's name (Style → Labels → Chosen value). It sits beside the label instead
   of inside it: nested, it would inherit the label's uppercasing, letter-spacing and colour
   and could no longer be styled on its own. */
.wpc-attr__value {
	margin-left: auto;
	min-width: 0;
	font-size: 0.8125rem;
	color: var( --wpc-value-color );
	text-align: right;
}

.wpc-attr__options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Text options share the row width: `flex: 1 1 auto` lets each button size to its own
   label and then grow to absorb the leftover space, so a row always reaches both sidebar
   gutters. With `1 1 0` every option would instead get an equal share and eight of them
   would shrink to unreadable slivers. A row that overflows wraps, and each wrapped row
   fills the width in turn.

   The `.wpc-config` prefix (0,2,0) is what clears Elementor's kit button chrome
   (`.elementor-kit-N button`, 0,1,1) — see the tab bar below for the same problem. */
.wpc-config .wpc-option {
	flex: 1 1 auto;
	min-height: 44px;
	padding: 8px 16px;
	font-size: 0.9375rem;
	color: var( --wpc-option-color );
	background: var( --wpc-option-bg );
	border: var( --wpc-option-border-w ) solid var( --wpc-option-border );
	border-radius: var( --wpc-option-radius );
	box-shadow: none;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

/* Restate the configured fill for the hover and focus states. Themes routinely repaint
   every <button> on those states from a type-level selector, and focus sticks after a
   click, so a button would stay repainted until you clicked elsewhere. Declared before
   the selected rule below so a selected option keeps its own fill while hovered. */
.wpc-config .wpc-option:hover,
.wpc-config .wpc-option:focus {
	color: var( --wpc-option-color );
	background: var( --wpc-option-bg );
}

/* Hover borrows the selected state's border but leaves the fill alone: if hover also
   swapped the background, a distinctly-coloured "selected" fill would flash under the
   cursor and you could no longer tell what is actually chosen. */
.wpc-config .wpc-option:hover:not(.is-disabled):not(:disabled) {
	border-color: var( --wpc-accent );
}

.wpc-config .wpc-option.is-selected {
	color: var( --wpc-option-color-active );
	background: var( --wpc-option-bg-active );
	border-color: var( --wpc-accent );
}

.wpc-option.is-disabled,
.wpc-option:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	text-decoration: line-through;
}

/* Color swatches: an ordinary option button — same fill, border, radius, hover and selected
   states as a text option — carrying the term's colour as a disc instead of a label. Putting
   that colour on a pseudo-element is what makes it ordinary: a theme's `button:hover` can
   repaint the button, but it never reaches the disc, so the swatch needs none of the
   state-by-state background overrides the old flat circle did.

   `flex: 0 0 auto` keeps the row left-aligned instead of stretching each button, and
   `min-height: 0` clears the 44px floor above so the two variables fully size the button:
   disc + padding on both sides (32 + 2×6 = the 44px of a text option). */
.wpc-config .wpc-option.wpc-option--swatch {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: var( --wpc-swatch-pad );
}

.wpc-config .wpc-option.wpc-option--swatch::before {
	content: '';
	display: block;
	width: var( --wpc-swatch-size );
	height: var( --wpc-swatch-size );
	border-radius: 50%;
	background: var( --wpc-swatch, #fff );
	/* Keeps a pale disc (white, cream) legible against a pale button. */
	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.12 );
}

.wpc-config .wpc-option.wpc-option--swatch:focus-visible {
	outline: 2px solid var( --wpc-accent );
	outline-offset: 2px;
}

/* The personalization field sits directly beneath an option row and already matches the
   buttons in height and padding — so it follows their corner radius and border width too. */
.wpc-personalization__input {
	width: 100%;
	min-height: 44px;
	padding: 8px 16px;
	font-size: 0.9375rem;
	color: var( --wpc-option-color );
	background: var( --wpc-option-bg );
	border: var( --wpc-option-border-w ) solid var( --wpc-option-border );
	border-radius: var( --wpc-option-radius );
	box-sizing: border-box;
	transition: border-color 0.15s ease;
}

.wpc-personalization__input:focus {
	outline: none;
	border-color: var( --wpc-accent );
}

.wpc-personalization__input[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Stock message + add to cart.
 * ------------------------------------------------------------------ */
.wpc-stock {
	min-height: 1.25rem;
	margin: 0 0 16px;
	font-size: 0.9375rem;
	color: #b3261e;
}

/* Primary action (Continue → step 2, and Checkout). The border is transparent by default
   so the button looks exactly as it did, but it exists — a configured border colour has
   something to paint, and the box never changes size when one is set (both hosts put
   `box-sizing: border-box` on every descendant). */
.wpc-config .wpc-add {
	min-height: 52px;
	padding: 14px 24px;
	font-size: 1rem;
	font-weight: 600;
	color: var( --wpc-add-color );
	background: var( --wpc-add-bg );
	border: var( --wpc-add-border-w ) solid var( --wpc-add-border );
	border-radius: var( --wpc-add-radius );
	box-shadow: none;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

/* Darken relative to whatever colour is configured, rather than hard-coding a hover
   colour that would ignore the setting. The fill and text colour are restated for both
   states so a theme's `button:hover` / `button:focus` rule cannot repaint the button. */
.wpc-config .wpc-add:hover:not(:disabled),
.wpc-config .wpc-add:focus:not(:disabled) {
	color: var( --wpc-add-color );
	background: var( --wpc-add-bg );
}

.wpc-config .wpc-add:hover:not(:disabled) {
	filter: brightness( 0.88 );
}

/* Disabled is painted, not dimmed: layering `opacity` over a configured "inactive"
   colour would wash that colour out and make the setting look broken. The defaults
   above reproduce the old 45%-opacity look. */
.wpc-config .wpc-add:disabled {
	color: var( --wpc-add-color-disabled );
	background: var( --wpc-add-bg-disabled );
	border-color: var( --wpc-add-border-disabled );
	cursor: not-allowed;
}

/* ------------------------------------------------------------------ *
 * Two-step sidebar: tabs + panels + secondary button.
 * ------------------------------------------------------------------ */
/* The tab bar is one background rectangle spanning the sidebar edge to edge: the sidebar
 * holds no horizontal padding, so the bar reaches both edges on its own and carries the
 * inset as its own padding to keep the labels aligned with the content below. Both tabs
 * share this one background — neither is tinted separately. */
.wpc-tabs {
	display: flex;
	flex: 0 0 auto; /* tabs never shrink — they stay pinned at the top */
	gap: 24px;
	margin: 0 0 20px;
	padding: 0 var( --wpc-sidebar-pad-x ) var( --wpc-tab-underline-gap );
	background: var( --wpc-tab-bg );
	border-bottom: var( --wpc-sep-thickness ) solid var( --wpc-sep-color );
}

/* The tabs read as plain text headings, not as controls: all button chrome is stripped
 * and they size to their label so the active underline hugs the text instead of half the
 * sidebar. They stay <button role="tab"> for keyboard and screen-reader support.
 *
 * The `.wpc-config` prefix (0,2,0) is required to clear Elementor's kit button rules
 * (`.elementor-kit-N button`, 0,1,1) — and the transparent bottom border has to live in
 * this same rule, or the `border: 0` reset here would win over it. */
.wpc-config .wpc-tab {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 auto;
	min-height: 0;
	padding: 14px 0; /* keeps a ~44px tap target without drawing a button box */
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
	color: var( --wpc-tab-color );
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

/* Tabs are text headings, never a filled control, so the transparent background is
 * restated for every state. Without this the theme's <button> reset repaints them on
 * hover and — because the focus sticks after a click — keeps them painted afterwards
 * (hello-elementor: `button:hover, button:focus { background-color: #c36 }`). */
.wpc-config .wpc-tab:hover,
.wpc-config .wpc-tab:focus,
.wpc-config .wpc-tab:active {
	color: var( --wpc-tab-color );
	background: none;
}

.wpc-config .wpc-tab.is-active,
.wpc-config .wpc-tab.is-active:hover,
.wpc-config .wpc-tab.is-active:focus {
	color: var( --wpc-tab-color-active );
	background: none;
	border-bottom-color: var( --wpc-accent );
}

.wpc-tabpanel {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0; /* let the body scroll instead of overflowing the sidebar */
}

.wpc-tabpanel.is-hidden {
	display: none;
}

/* Scrollable region of a panel: grows to fill, scrolls when content is tall. It owns the
 * sidebar's horizontal inset (see .wpc-config__sidebar) so the separators between its blocks
 * can bleed out to the sidebar edge without adding scrollable overflow. */
.wpc-tabpanel__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 0 var( --wpc-sidebar-pad-x );
	overflow-y: auto;
}

/* Non-scrolling action footer: stays visible at the bottom of the panel. */
.wpc-tabpanel__actions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px var( --wpc-sidebar-pad-x ) 0;
	border-top: var( --wpc-sep-thickness ) solid var( --wpc-sep-color );
	background: inherit;
}

.wpc-accessories__empty {
	margin: 0 0 24px;
	color: #555;
}

/* ------------------------------------------------------------------ *
 * Cumulative total + accessories list + delivery notice.
 * ------------------------------------------------------------------ */
/* Footer summary: the amount left, the delivery notice right, on one baseline. It wraps to
 * two lines in a narrow sidebar; the notice's auto margin keeps it right-aligned when it
 * does. Sits at the top of the action footer, so it is the last thing read before the
 * buttons. */
.wpc-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 12px;
}

.wpc-total {
	margin: 0; /* the action footer supplies the spacing with its own gap */
	font-size: 1.125rem;
	font-weight: 700;
	color: var( --wpc-total-color );
}

/* Never empty now that the amount runs from the product's base price, but kept as a guard
 * against a stray blank row if a price ever fails to resolve. */
.wpc-total:empty {
	display: none;
}

.wpc-accessory-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0 0 24px;
}

/* Category groups in the Accessories tab. */
.wpc-accessory-group {
	margin: 0 0 24px;
}

.wpc-accessory-group__title {
	margin: 0 0 10px;
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --wpc-acc-label-color );
}

/* Inside a group, the group owns the bottom spacing. */
.wpc-accessory-group .wpc-accessory-list {
	margin: 0;
}

.wpc-accessory {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

/* No border: with the separator lines between groups, a frame around every row made the tab
 * read as a pile of cards. The radius stays — it shapes the in-cart tint and rounds the
 * flush-left thumbnail. */
.wpc-accessory__toggle {
	overflow: hidden; /* clip the flush image's left corners to the button radius */
	border-radius: var( --wpc-acc-radius );
	cursor: pointer;
	transition: background 0.15s ease;
}

.wpc-accessory__toggle.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* `.elementor-kit-N button:hover` (0,2,1) repaints any single-class button, which is what made
 * the row flash a different background under the cursor. Restating the background at (0,3,0) —
 * the same trick `.wpc-config .wpc-option:hover` uses — pins the row to its own colour. */
.wpc-config .wpc-accessory__toggle,
.wpc-config .wpc-accessory__toggle:hover,
.wpc-config .wpc-accessory__toggle:focus {
	background: var( --wpc-acc-bg );
}

/* In cart: a faint tint, restated a step higher so hovering an added row keeps it. The filled
 * check disc (below) confirms it; together they are the whole "added" cue now. */
.wpc-config .wpc-accessory__toggle.is-selected,
.wpc-config .wpc-accessory__toggle.is-selected:hover,
.wpc-config .wpc-accessory__toggle.is-selected:focus {
	background: var( --wpc-acc-bg-selected );
}

/* The Elementor kit rule `.elementor-kit-N button` (0,1,1) and the theme's plain
 * `button` reset (0,0,1) both beat a single-class selector, so everything this
 * chromeless row needs must be declared here on the `.wpc-config`-prefixed rule
 * (0,2,0). Anything we leave out, the theme fills in: no `border` means its pink
 * 1px shows up, and no `white-space` means its `nowrap` keeps a long accessory
 * name from wrapping — which `overflow: hidden` then clips. */
.wpc-config .wpc-accessory__toggle {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	flex: 1 1 auto; /* fill the row beside the ⓘ so the name has space to grow into */
	align-items: center;
	justify-content: flex-start;
	gap: 12px; /* the little space between the image and the name */
	min-width: 0;
	padding: 0 12px 0 0; /* thumbnail flush left/top/bottom; right inset keeps the ✓ off the edge */
	border: 0;
	box-shadow: none;
	text-align: left;
	white-space: normal; /* let the name wrap onto a second line instead of being clipped */
}

.wpc-accessory__img {
	flex: none;
	width: var( --wpc-acc-img-size );
	height: var( --wpc-acc-img-size );
	object-fit: contain;
	border-radius: 0; /* the button's overflow:hidden rounds the outer corners */
	background: #f7f7f7;
}

/* Name over price instead of side by side: a long accessory name no longer squeezes against
 * the amount, and the row grows tall enough to carry a bigger thumbnail. */
.wpc-accessory__text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wpc-accessory__name {
	min-width: 0; /* let long names wrap instead of stretching the row */
	font-weight: 600;
	color: var( --wpc-acc-name-color );
}

.wpc-accessory__price {
	white-space: nowrap;
	color: var( --wpc-acc-price-color );
}

/* Filled from acc.price_html, so WooCommerce's own price markup lands here; without this the
 * theme's `.amount` / `span.price` rules outrank the colour and size set just above — the same
 * guard the product price needs. */
.wpc-config .wpc-accessory__price .price.price,
.wpc-config .wpc-accessory__price .amount,
.wpc-config .wpc-accessory__price bdi {
	font: inherit;
	color: inherit;
}

/* Trailing on/off indicator: a hollow circle at rest, a filled ✓ disc when in cart. Drawn as
 * a pseudo-element (no markup) and prefixed with `.wpc-config` to clear Elementor's kit button
 * rules, matching the layout rule above. Sits as the last flex child, right of the text; its
 * accent ring on hover is the row's only hover cue now that the border is gone. */
.wpc-config .wpc-accessory__toggle::after {
	content: '\2713'; /* ✓ */
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	margin-left: 4px;
	border-radius: 50%;
	/* Its own resting ring: a standalone dot, unrelated to any row border. */
	border: 1.5px solid #cfcfcf;
	background: #fff;
	color: transparent; /* hide the ✓ until selected */
	font-size: 13px;
	line-height: 1;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wpc-accessory__toggle:hover:not(.is-disabled)::after {
	border-color: var( --wpc-accent );
}

.wpc-accessory__toggle.is-selected::after {
	border-color: var( --wpc-accent );
	background: var( --wpc-accent );
	color: #fff;
}

/* Delivery notice, sharing the summary row with the amount. Plain text rather than the boxed
   notice it used to be: a filled block beside the total would outweigh the amount it stands
   next to. It keeps the amber tone that box carried. `margin-left: auto` pins it right, also
   when the row wraps and it lands on its own line. */
.wpc-delivery {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 0 auto;
	font-size: 0.9375rem;
	color: var( --wpc-delivery-color );
	text-align: right;
}

/* `0 1 auto`, not `1 1 auto`: in the summary row a growing text would claim the whole line
   and push the amount off it. */
.wpc-delivery__text {
	flex: 0 1 auto;
}

/* The "more info" trigger beside the notice. It carries `.wpc-info` too, so it takes the
   configured icon colour like every other ⓘ — this rule only stops it from stretching in
   the notice's flex row. */
.wpc-delivery__info {
	flex: none;
}

.wpc-commit-error {
	margin: 0 0 16px;
	padding: 10px 12px;
	font-size: 0.9375rem;
	color: #b3261e;
	background: #fdecea;
	border: 1px solid #f5c2c0;
	border-radius: 6px;
}

/* Secondary commit button (Continue shopping). Shares the primary button's corner
   radius — they sit stacked in the same footer, so a mismatch would be obvious. */
.wpc-config .wpc-btn--secondary {
	min-height: 52px;
	padding: 14px 24px;
	font-size: 1rem;
	font-weight: 600;
	color: var( --wpc-btn2-color );
	background: var( --wpc-btn2-bg );
	border: var( --wpc-btn2-border-w ) solid var( --wpc-btn2-border );
	border-radius: var( --wpc-add-radius );
	box-shadow: none;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wpc-config .wpc-btn--secondary:hover:not(:disabled),
.wpc-config .wpc-btn--secondary:focus:not(:disabled) {
	color: var( --wpc-btn2-color );
	background: var( --wpc-btn2-bg );
}

.wpc-config .wpc-btn--secondary:hover:not(:disabled) {
	border-color: var( --wpc-accent );
}

/* Painted rather than dimmed, for the same reason as the primary button above. */
.wpc-config .wpc-btn--secondary:disabled {
	color: var( --wpc-btn2-color-disabled );
	background: var( --wpc-btn2-bg-disabled );
	border-color: var( --wpc-btn2-border-disabled );
	cursor: not-allowed;
}

/* ------------------------------------------------------------------ *
 * Loading + friendly messages (errors, non-variable products).
 * ------------------------------------------------------------------ */
.wpc-loading,
.wpc-message {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: 48px;
	margin: auto;
	font-size: 1.0625rem;
	color: #444;
	text-align: center;
}

.wpc-loading::after {
	content: "";
	width: 22px;
	height: 22px;
	margin-left: 12px;
	border: 2px solid #ccc;
	border-top-color: #222;
	border-radius: 50%;
	animation: wpc-spin 0.7s linear infinite;
}

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

/* ------------------------------------------------------------------ *
 * Focus rings (both hosts).
 * ------------------------------------------------------------------ */
.wpc-config :focus-visible {
	outline: 2px solid #1a73e8;
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * "More info" trigger (⋮) + slidebar.
 * ------------------------------------------------------------------ */
.wpc-config .wpc-info {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	min-height: 32px;
	padding: 0 4px;
	font-size: 1.125rem;
	line-height: 1;
	color: var( --wpc-info-color );
	background: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.wpc-config .wpc-info:hover,
.wpc-config .wpc-info:focus {
	color: var( --wpc-accent );
	background: #f0f0f0;
}

/* The info icon is an inline SVG using currentColor; size it consistently. */
.wpc-info svg {
	display: block;
	width: 18px;
	height: 18px;
}

/* Neutralize the theme / Elementor default <button> chrome (notably a border) on the
 * configurator's icon controls. The `.wpc-config` prefix raises specificity above
 * Elementor's kit button rules (e.g. `.elementor-kit-N button`). */
.wpc-config .wpc-info,
.wpc-config .wpc-slidebar__prev,
.wpc-config .wpc-slidebar__next,
.wpc-config .wpc-slidebar__close,
.wpc-config .wpc-slidebar__dot {
	-webkit-appearance: none;
	appearance: none;
	border: 0;
	box-shadow: none;
}

/* In an accessory row the trigger is wider for the tap target but borderless,
 * matching the title/attribute triggers. */
.wpc-accessory .wpc-info {
	min-width: 40px;
}

/* Attribute info: a definition list of value -> term description. */
.wpc-info-list {
	margin: 0;
}

.wpc-info-list dt {
	margin-top: 14px;
	font-weight: 600;
	color: #222;
}

.wpc-info-list dt:first-child {
	margin-top: 0;
}

.wpc-info-list dd {
	margin: 4px 0 0;
}

/* Dim scrim over the product image, behind the slidebar, for separation/focus.
 * Fades in with the slidebar; clicking it closes the slidebar. */
.wpc-slidebar-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: rgba( 0, 0, 0, 0.45 );
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.wpc-slidebar-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* Slidebar: docks against the sidebar's left edge and slides out (right→left) from
 * behind the sidebar over the image. Never wider than the sidebar. A subtly different
 * background distinguishes it from the (white) sidebar; no shadow. */
.wpc-slidebar {
	position: absolute;
	top: 0;
	bottom: 0;
	right: var(--wpc-sidebar-w);
	width: var(--wpc-sidebar-w);
	z-index: 2;
	display: flex;
	flex-direction: column;
	padding: 0; /* image is full-bleed; the text content is padded individually below */
	background: #f7f7f7;
	transform: translateX( 100% ); /* tucked behind the sidebar when closed */
	transition: transform 0.25s ease;
}

.wpc-slidebar.is-open {
	transform: translateX( 0 );
}

/* Sidebar-on-the-left layout: dock on the sidebar's right edge; tuck behind to the left. */
.wpc-inline--image-right .wpc-slidebar {
	right: auto;
	left: var(--wpc-sidebar-w);
	transform: translateX( -100% );
}

.wpc-inline--image-right .wpc-slidebar.is-open {
	transform: translateX( 0 );
}

/* Header wraps the image so the gallery pager can overlay its bottom edge. */
.wpc-slidebar__header {
	flex: none;
	position: relative;
}

.wpc-slidebar__image {
	width: 100%;
	/* vh (not %) so the cap survives inside the auto-height header wrapper; the panel ≈ the
	 * viewport in the overlay/fullscreen/mobile hosts, so 40vh ≈ the previous 40%. */
	max-height: 40vh;
	object-fit: contain;
	margin: 0; /* full-bleed: flush to the top and side edges of the panel */
}

.wpc-slidebar__image[hidden] {
	display: none;
}

/* Per-screen image pager (personalization header gallery): a dot row floating over the bottom
 * of the image on a translucent pill. Hidden when a screen has 0–1 images. */
.wpc-slidebar__gallery-dots {
	position: absolute;
	left: 50%;
	bottom: 10px;
	transform: translateX( -50% );
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 10px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.4 );
}

.wpc-slidebar__gallery-dots[hidden] {
	display: none;
}

/* Light dots for contrast over the image; the descendant selector (0,3,0 / 0,4,0) outranks
 * the dark pager-dot fill and Elementor's button rule. */
.wpc-config .wpc-slidebar__gallery-dots .wpc-slidebar__dot {
	background: rgba( 255, 255, 255, 0.55 );
	opacity: 1;
}

.wpc-config .wpc-slidebar__gallery-dots .wpc-slidebar__dot.is-active {
	background: #fff;
}

.wpc-slidebar__nav {
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px; /* nav sits below the text, at the bottom of the panel */
	padding: 0 24px 24px; /* inset the controls (panel padding removed for the full-bleed image) */
}

/* Standalone (e.g. stock-message) panel: slidebar look, but no pager navigation. */
.wpc-slidebar--plain .wpc-slidebar__nav {
	display: none;
}

.wpc-slidebar__close {
	position: absolute; /* float over the full-bleed image, top-right */
	top: 8px;
	right: 8px;
	z-index: 1;
}

.wpc-slidebar__prev,
.wpc-slidebar__next,
.wpc-slidebar__close {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	min-height: 36px;
	font-size: 1.25rem;
	line-height: 1;
	color: #555;
	background: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

/* The `.wpc-config` prefix is what makes these win: on the bare class (0,1,0) a theme's
 * `button:hover` (0,1,1) outranks them and repaints the button. Focus is included because
 * it sticks after a click. */
.wpc-config .wpc-slidebar__close:hover,
.wpc-config .wpc-slidebar__close:focus,
.wpc-config .wpc-slidebar__prev:hover:not(:disabled),
.wpc-config .wpc-slidebar__prev:focus:not(:disabled),
.wpc-config .wpc-slidebar__next:hover:not(:disabled),
.wpc-config .wpc-slidebar__next:focus:not(:disabled) {
	color: #111;
	background: #f0f0f0;
}

.wpc-slidebar__prev:disabled,
.wpc-slidebar__next:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* Translucent pill so the overlaid close button stays legible over any image.
 * Declared after the shared `background: none` rule above so it wins for the
 * base state; the :hover rule (higher specificity) still darkens on hover. */
.wpc-slidebar__close {
	background: rgba( 255, 255, 255, 0.85 );
}

.wpc-slidebar__dots {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.wpc-slidebar__dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}

/* The dot fill needs the `.wpc-config` prefix (0,2,0) to clear Elementor's kit button rule
 * (`.elementor-kit-N button`, 0,1,1); on the bare class it would lose. The active rule
 * (0,3,0) then beats this one — no !important needed. */
.wpc-config .wpc-slidebar__dot {
	background: #444; /* inactive dot fill */
	opacity: 0.5;
}

.wpc-config .wpc-slidebar__dot.is-active {
	background: #222;
	opacity: 1;
}

.wpc-slidebar__title {
	flex: none;
	margin: 16px 0 8px; /* top gap below the now-flush image */
	padding: 0 24px;
	font-size: 1.25rem;
	font-weight: 600;
	color: #111;
}

.wpc-slidebar__text {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 0 24px;
	color: #555;
	line-height: 1.6;
}

/* ------------------------------------------------------------------ *
 * Responsive: stack image over sidebar on small screens.
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
	/* Tighter sidebar gutters on small screens. The tab bar's breakout follows
	 * automatically because it is expressed in the same variable. */
	.wpc-config {
		--wpc-sidebar-pad-x: 20px;
	}

	.wpc-overlay .wpc-config {
		grid-template-columns: 1fr;
		grid-template-rows: 55vh auto;
		grid-template-areas:
			"image"
			"sidebar";
	}

	.wpc-inline .wpc-config,
	.wpc-inline--image-right .wpc-config {
		grid-template-columns: 1fr;
		grid-template-areas:
			"image"
			"sidebar";
	}

	.wpc-config__image {
		padding: 16px;
	}

	.wpc-inline .wpc-image {
		max-height: 60vh;
	}

	/* Vertical only — the horizontal inset stays on the panels, which now carry the smaller
	 * --wpc-sidebar-pad-x set above. */
	.wpc-overlay .wpc-config__sidebar {
		padding: 24px 0;
		border-left: none;
		border-top: 1px solid #ececec;
	}

	.wpc-inline .wpc-config__sidebar {
		padding: 24px 0 0;
	}

	/* Keep the full-width breakout on mobile, but relax the 100vh height so the
	 * stacked image + sidebar flow naturally and the commit buttons stay reachable. */
	.wpc-inline--fullscreen,
	.wpc-inline--fullscreen .wpc-config {
		min-height: auto;
	}

	.wpc-inline--fullscreen .wpc-config__sidebar {
		max-height: none;
		overflow-y: visible;
	}

	/* No bounded height on mobile → the page scrolls; the panel body must not trap
	 * the scroll, and the action footer just flows after the content. */
	.wpc-tabpanel__body {
		overflow: visible;
	}

	.wpc-inline--fullscreen .wpc-image {
		max-height: 60vh;
	}

	.wpc-title {
		font-size: 1.25rem;
	}

	/* Full-screen takeover: leave the (tall, stacked) .wpc-config box and pin to the viewport
	 * so the flex column bounds the scroll — image + nav stay put, only the text scrolls. In
	 * the overlay host the transformed dialog (.wpc-overlay__dialog) is the containing block,
	 * which already fills the viewport on mobile, so the result is identical there. */
	.wpc-slidebar,
	.wpc-inline--image-right .wpc-slidebar {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		width: auto;
		height: 100vh;
		height: 100dvh; /* exclude mobile browser chrome so the pinned nav stays visible */
		z-index: 999999; /* above the sidebar (z:3) and any sticky site header */
		transform: translateX( -100% );
	}

	.wpc-slidebar.is-open,
	.wpc-inline--image-right .wpc-slidebar.is-open {
		transform: translateX( 0 );
	}

	/* Cap the fixed image so the title + scrollable text + pinned nav always fit one screen. */
	.wpc-slidebar__image {
		max-height: 30vh;
	}

	/* The text is the only scroll region; stop its overscroll chaining to the page behind. */
	.wpc-slidebar__text {
		overscroll-behavior: contain;
	}

	/* Keep the pinned nav clear of the iOS home indicator. */
	.wpc-slidebar__nav {
		padding-bottom: max( 24px, env( safe-area-inset-bottom ) );
	}

	/* Clear, finger-sized close control for the takeover. */
	.wpc-slidebar__close {
		min-width: 44px;
		min-height: 44px;
		font-size: 1.5rem;
		background: rgba( 255, 255, 255, 0.95 );
	}
}

/* ------------------------------------------------------------------ *
 * Reduced motion.
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	/* The inner controls are matched through `.wpc-config` so this stays at or above the
	 * specificity of the rules that set their transitions — several of those carry the
	 * same prefix to clear Elementor's kit button chrome, and a bare class here would
	 * silently lose to them. The two overlay elements are ancestors of `.wpc-config`,
	 * so they keep their plain selectors. */
	.wpc-overlay,
	.wpc-overlay__dialog,
	.wpc-overlay__close,
	.wpc-config .wpc-option,
	.wpc-config .wpc-add,
	.wpc-config .wpc-tab,
	.wpc-config .wpc-btn--secondary,
	.wpc-config .wpc-accessory__toggle,
	.wpc-config .wpc-slidebar,
	.wpc-config .wpc-personalization__input,
	.wpc-config .wpc-info {
		transition: none;
	}

	.wpc-loading::after {
		animation: none;
	}
}
