/* Flatsome Variation Swatches
   All visual values are CSS variables set from the Customizer (see #fsw-vars in <head>). */

:root {
	--fsw-size: 44px;
	--fsw-archive-size: 22px;
	--fsw-border: #ccc;
	--fsw-active: #0d1257;
	--fsw-bw: 2px;
	--fsw-radius: 50%;
	--fsw-pill-radius: 999px;
	--fsw-tip-bg: #222;
	--fsw-tile-cols: 3;
	--fsw-tile-h: 56px;
	--fsw-tile-radius: 10px;
	--fsw-angle: 135deg;
	--fsw-div: 0px;
}
body.fsw-split-diagonal   { --fsw-angle: 135deg; }
body.fsw-split-vertical   { --fsw-angle: 90deg; }
body.fsw-split-horizontal { --fsw-angle: 180deg; }
body.fsw-divider          { --fsw-div: 1px; }

/* ---------- Native select stays in the DOM, visually hidden ---------- */
.fsw-wrap { position: relative; }
.fsw-wrap > select {
	position: absolute !important; left: 0; top: 0;
	width: 1px !important; height: 1px !important; min-height: 0 !important;
	margin: 0 !important; padding: 0 !important; border: 0 !important;
	opacity: 0 !important; pointer-events: none !important;
	overflow: hidden !important; clip: rect(0 0 0 0);
}

/* ---------- Group ---------- */
.fsw-swatches {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: 12px; margin: 0 0 .25em; padding: 0; list-style: none;
}

/* ---------- Base swatch ---------- */
.fsw-swatch {
	position: relative; box-sizing: border-box;
	display: inline-flex; align-items: center; justify-content: center;
	width: var(--fsw-size); height: var(--fsw-size); margin: 0; padding: 0;
	border: var(--fsw-bw) solid var(--fsw-border); border-radius: var(--fsw-radius);
	background: #fff; color: #222; line-height: 1.2; text-transform: none; letter-spacing: 0;
	cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; outline: 0;
	transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.fsw-swatch:hover { border-color: #999; }
.fsw-swatch:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--fsw-active); }
.fsw-swatch.is-selected {
	border-color: var(--fsw-active);
	border-width: max(3px, calc(var(--fsw-bw) + 1px));
}
.fsw-swatch__inner {
	position: relative; display: block; width: 100%; height: 100%;
	border-radius: inherit; overflow: hidden;
	background-position: center; background-size: cover; background-repeat: no-repeat;
}

/* ---------- Color: solid & split / dual ---------- */
.fsw-swatch--color .fsw-swatch__inner { background-color: var(--c1); }
.fsw-swatch--color.fsw-split .fsw-swatch__inner {
	background-image: linear-gradient(var(--fsw-angle),
		var(--c1) calc(50% - var(--fsw-div)),
		#fff calc(50% - var(--fsw-div)) calc(50% + var(--fsw-div)),
		var(--c2) calc(50% + var(--fsw-div)));
}

/* ---------- Embroidery thread ---------- */
.fsw-swatch--stitch .fsw-swatch__inner {
	background-color: var(--c1);
	background-image:
		repeating-linear-gradient(60deg,
			rgba(255,255,255,.28) 0 1px, rgba(255,255,255,0) 1px 2.5px,
			rgba(0,0,0,.20) 2.5px 3.5px, rgba(0,0,0,0) 3.5px 5px),
		linear-gradient(var(--fsw-angle), var(--c1) 50%, var(--c2) 50%);
	box-shadow: inset 0 2px 2px rgba(255,255,255,.35), inset 0 -3px 4px rgba(0,0,0,.28);
}
.fsw-swatch--stitch .fsw-swatch__inner::after { /* running stitch around the edge */
	content: ""; position: absolute; inset: 3px;
	border: 1.5px dashed rgba(255,255,255,.8); border-radius: inherit; pointer-events: none;
}
.fsw-swatch--stitch.fsw-light .fsw-swatch__inner::after { border-color: rgba(0,0,0,.35); }

/* ---------- Image ---------- */
.fsw-swatch--image .fsw-swatch__inner { background-image: var(--img); background-color: #f4f4f4; }

/* ---------- Tiles (large boxes, Zazzle-style) ---------- */
.fsw-layout-tile {
	display: grid; gap: 12px;
	grid-template-columns: repeat(var(--fsw-tile-cols), minmax(0, 1fr));
}
.fsw-swatch--tile {
	width: auto; height: auto; min-height: var(--fsw-tile-h);
	padding: 8px 10px; border-radius: var(--fsw-tile-radius);
	font-size: 1.05em; font-weight: 600; text-align: center; white-space: normal;
}
.fsw-swatch--tile.is-selected { background: #fff; color: #111; }

/* ---------- Compact buttons ---------- */
.fsw-swatch--button {
	width: auto; height: auto; min-width: var(--fsw-size); min-height: calc(var(--fsw-size) * .8);
	padding: .45em .95em; border-radius: var(--fsw-pill-radius);
	font-size: .9em; font-weight: 500; white-space: nowrap;
}
.fsw-swatch--button.is-selected { background: var(--fsw-active); border-color: var(--fsw-active); color: #fff; }

/* ---------- Unavailable ---------- */
.fsw-swatch.is-disabled { cursor: not-allowed; }
.fsw-unavail-blur .fsw-swatch.is-disabled { opacity: .3; }
.fsw-unavail-cross .fsw-swatch.is-disabled { opacity: .55; }
.fsw-unavail-cross .fsw-swatch.is-disabled::before {
	content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
	background: linear-gradient(to top right, transparent calc(50% - 1px), #777 calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
.fsw-unavail-hide .fsw-single .fsw-swatch.is-disabled { display: none; }

/* ---------- Tooltips (CSS only, no JS) ---------- */
.fsw-tooltips .fsw-swatch[data-tooltip]:not(.fsw-swatch--tile):not(.fsw-swatch--button):hover::after,
.fsw-tooltips .fsw-swatch[data-tooltip]:not(.fsw-swatch--tile):not(.fsw-swatch--button):focus-visible::after {
	content: attr(data-tooltip);
	position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
	z-index: 99; pointer-events: none;
	padding: 5px 9px; border-radius: 4px;
	background: var(--fsw-tip-bg); color: #fff;
	font-size: 12px; font-weight: 500; line-height: 1.3; white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* ---------- Stacked labels on the product page ---------- */
.fsw-stacked table.variations,
.fsw-stacked table.variations tbody,
.fsw-stacked table.variations tr,
.fsw-stacked table.variations th,
.fsw-stacked table.variations td {
	display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left;
}
.fsw-stacked table.variations tr { margin-bottom: 1.4em; }
.fsw-stacked table.variations .label { margin-bottom: .6em; }
.fsw-stacked table.variations .label label {
	font-size: 1.15em; font-weight: 700; text-transform: none; letter-spacing: 0; color: inherit;
}
.fsw-selected-label { font-weight: 400; opacity: .75; }
body:not(.fsw-show-selected) .fsw-selected-label { display: none; }
.variations .reset_variations { display: inline-block; margin-top: .5em; }

/* ---------- Archive / category cards ---------- */
.fsw-archive {
	--fsw-size: var(--fsw-archive-size);
	gap: 6px; margin: .35em 0 .5em;
	justify-content: var(--fsw-archive-align, flex-start);
}
.text-center .fsw-archive { justify-content: var(--fsw-archive-align, center); }
.text-right .fsw-archive  { justify-content: var(--fsw-archive-align, flex-end); }
.fsw-archive .fsw-swatch.is-selected { border-width: 2px; }
.fsw-archive .fsw-swatch--tile,
.fsw-archive .fsw-swatch--button {
	width: auto; height: auto; min-height: var(--fsw-size); min-width: 0;
	padding: 2px 7px; font-size: 11px; font-weight: 500; border-radius: var(--fsw-pill-radius);
}
.fsw-archive .fsw-swatch--stitch .fsw-swatch__inner::after { inset: 2px; border-width: 1px; }
.fsw-more { font-size: 12px; line-height: 1; color: var(--fsw-more-color, #2f7de1); font-weight: 600; text-decoration: none; margin-left: 2px; }
.fsw-more:hover { opacity: .75; }
.fsw-more--dots { display: inline-flex; align-items: center; gap: 3px; padding: 4px 2px; }
.fsw-more--dots span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Swatches placed on the image */
.box-image .fsw-archive,
.woocommerce-LoopProduct-link .fsw-archive.fsw-on-image {
	position: absolute; left: 0; right: 0; bottom: 8px; z-index: 5; margin: 0; justify-content: center;
}

/* While previewing a variation on a card, hide Flatsome's hover "back" image */
.fsw-previewing .back-image,
.fsw-previewing .show-on-hover.back-image { opacity: 0 !important; }

/* Hide duplicate archive swatches from other plugins when this plugin takes over */
.fsw-takeover .products .wvs-archive-variations-wrapper,
.fsw-takeover .products .cfvsw-shop-container,
.fsw-takeover .products .tawcvs-swatches { display: none !important; }
