/* Sheet Sync Tables — floor map. Override the --sstm-* properties to theme. */
.sstm {
	--sstm-h: 560px;
	--sstm-accent: #3b1f8f;
	--sstm-empty: #e4e4e7;
	--sstm-taken: #ffffff;
	--sstm-hover: #efeaff;
	--sstm-active: #d8ccff;
	--sstm-label: #1d2327;
	--sstm-code: #6b6b76;
	--sstm-border: rgba(127, 127, 127, 0.28);
	/* Controls (search, section buttons, results, zoom). The dark preset below swaps them; inline settings win. */
	--sstm-ui-text-d: inherit;
	--sstm-ui-bg-d: transparent;
	--sstm-ui-border-d: rgba(127, 127, 127, 0.35);
	--sstm-btn-bg-d: #ffffff;
	--sstm-btn-text-d: #1d2327;
	--sstm-drop-bg: #ffffff;
	--sstm-drop-text: #1d2327;
	--sstm-drop-hover: var(--sstm-hover);
	--sstm-placeholder: currentColor;
	position: relative;
	margin: 1.5em 0;
}

/* ---------- Search ---------- */
.sstm-toolbar { position: relative; max-width: 380px; margin-bottom: 0.75em; z-index: 6; }
.sstm .sstm-search {
	box-sizing: border-box;
	width: 100%;
	padding: 0.6em 0.85em;
	border: 1px solid var(--sstm-ui-border, var(--sstm-ui-border-d));
	border-radius: 8px;
	font: inherit;
	background: var(--sstm-ui-bg, var(--sstm-ui-bg-d));
	color: var(--sstm-ui-text, var(--sstm-ui-text-d));
}
.sstm .sstm-search::placeholder { color: var(--sstm-ui-text, var(--sstm-placeholder)); opacity: 0.6; }
.sstm-results {
	position: absolute;
	left: 0; right: 0; top: 100%;
	margin: 4px 0 0;
	padding: 4px;
	list-style: none;
	background: var(--sstm-drop-bg);
	color: var(--sstm-drop-text);
	border: 1px solid rgba(127, 127, 127, 0.25);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	max-height: 320px;
	overflow: auto;
}
.sstm-results[hidden] { display: none; }
.sstm-result {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	margin: 0;
	padding: 0.5em 0.65em;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.95em;
}
.sstm-result:hover, .sstm-result.is-cursor { background: var(--sstm-drop-hover); }
.sstm-result-code { color: inherit; opacity: 0.65; font-size: 0.85em; white-space: nowrap; }
.sstm-noresult { padding: 0.5em 0.65em; color: var(--sstm-code); font-size: 0.9em; }

/* ---------- Stage ---------- */
.sstm-stage {
	position: relative;
	height: min(var(--sstm-h), 75vh);
	min-height: 280px;
	border: 1px solid var(--sstm-border);
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
	cursor: grab;
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}
.sstm-stage.is-dragging { cursor: grabbing; }
.sstm-canvas, .sstm-svg { display: block; width: 100%; height: 100%; }
.sstm-error { padding: 2em; text-align: center; color: #646970; }

/* Booths */
.sstm .is-empty path, .sstm .is-empty rect, .sstm path.is-empty, .sstm rect.is-empty { fill: var(--sstm-empty); }
.sstm .is-taken { cursor: pointer; }
.sstm .is-taken path, .sstm .is-taken rect, .sstm path.is-taken, .sstm rect.is-taken { fill: var(--sstm-taken); transition: fill 0.15s; }
.sstm .is-taken:hover path, .sstm .is-taken:hover rect, .sstm path.is-taken:hover, .sstm rect.is-taken:hover { fill: var(--sstm-hover); }
.sstm .is-active path, .sstm .is-active rect, .sstm path.is-active, .sstm rect.is-active { fill: var(--sstm-active); }
.sstm .is-hilite path, .sstm .is-hilite rect, .sstm path.is-hilite, .sstm rect.is-hilite { fill: var(--sstm-active); stroke: var(--sstm-accent); stroke-width: 6px; }
.sstm .sstm-hit.is-hilite { fill: var(--sstm-active); fill-opacity: 0.6; }

.sstm-labels { pointer-events: none; }
.sstm-label-name { font-family: inherit; font-weight: 700; fill: var(--sstm-label, #1d2327); }
.sstm-label-code { font-family: inherit; fill: var(--sstm-code); }
.sstm .sstm-hit { pointer-events: all; fill: transparent; cursor: pointer; }
.sstm .sstm-hit:hover { fill: var(--sstm-hover); fill-opacity: 0.6; }
.sstm .sstm-hit.is-active { fill: var(--sstm-active); fill-opacity: 0.6; }

/* ---------- Controls (reset theme/page-builder button styles) ---------- */
.sstm-controls { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.sstm .sstm-controls .sstm-btn,
.sstm .sstm-controls .sstm-btn:hover,
.sstm .sstm-controls .sstm-btn:focus {
	all: unset;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--sstm-btn-bg, var(--sstm-btn-bg-d));
	color: var(--sstm-btn-text, var(--sstm-btn-text-d));
	border: 1px solid rgba(127, 127, 127, 0.3);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	font: 600 18px/1 system-ui, sans-serif;
	cursor: pointer;
}
.sstm .sstm-controls .sstm-btn:hover { filter: brightness(0.95); }
.sstm.sstm-ui-dark .sstm-controls .sstm-btn:hover { filter: brightness(1.25); }
.sstm .sstm-controls .sstm-btn:focus-visible { outline: 2px solid var(--sstm-accent); outline-offset: 2px; }

/* ---------- Card ---------- */
.sstm-card {
	position: absolute;
	z-index: 4;
	top: 10px;
	left: 10px;
	box-sizing: border-box;
	width: min(var(--sstm-card-w, 320px), calc(100% - 72px));
	max-height: calc(100% - 20px);
	overflow: auto;
	padding: 14px 16px 16px;
	background: var(--sstm-card-bg, #fff);
	color: var(--sstm-card-text, #1d2327);
	border-radius: var(--sstm-card-radius, 12px);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	cursor: auto;
	user-select: text;
	text-align: left;
}
.sstm-card[hidden] { display: none; }
.sstm-pos-top-right .sstm-card { left: auto; right: 56px; }
.sstm-pos-bottom-left .sstm-card { top: auto; bottom: 10px; }
.sstm-pos-bottom-right .sstm-card { top: auto; bottom: 10px; left: auto; right: 56px; }
.sstm-no-shadow .sstm-card { box-shadow: none; border: 1px solid rgba(127, 127, 127, 0.3); }

.sstm .sstm-card .sstm-close,
.sstm .sstm-card .sstm-close:hover,
.sstm .sstm-card .sstm-close:focus {
	all: unset;
	position: absolute;
	top: 8px;
	right: 10px;
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	font: 22px/1 system-ui, sans-serif;
	color: inherit;
	opacity: 0.6;
	cursor: pointer;
}
.sstm .sstm-card .sstm-close:hover { opacity: 1; background: rgba(127, 127, 127, 0.15); }
.sstm .sstm-card .sstm-close:focus-visible { outline: 2px solid currentColor; }

.sstm-card-booth { margin: 0 32px 0.6em 0; font-size: 0.8em; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.65; }
.sstm-hide-code .sstm-card-booth { display: none; }
.sstm-ex + .sstm-ex { margin-top: 0.9em; padding-top: 0.9em; border-top: 1px solid rgba(127, 127, 127, 0.2); }
.sstm-hide-code .sstm-ex:first-of-type { margin-right: 30px; }

.sstm-logo-wrap { display: block; margin: 0 0 0.7em; line-height: 0; border-radius: 8px; }
.sstm-logo-wrap.has-chip { padding: 10px 14px; }
.sstm .sstm-card .sstm-logo {
	/* Fill the card's width; height capped by the "Max logo height" setting; never cropped or stretched. */
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	max-height: var(--sstm-logo-h, 56px);
	margin: 0;
	object-fit: contain;
	object-position: left center;
}
.sstm-hide-code .sstm-card .sstm-ex:first-of-type .sstm-logo-wrap { margin-right: 30px; }
.sstm .sstm-card .sstm-name { margin: 0; font-size: 1.1em; line-height: 1.25; color: inherit; }
.sstm-also { margin: 0.3em 0 0; font-size: 0.85em; opacity: 0.7; }

.sstm .sstm-card .sstm-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin-top: 0.7em;
	padding: 0.45em 0.95em;
	border-radius: 999px;
	background: var(--sstm-accent, #3b1f8f);
	color: var(--sstm-accent-text, #fff);
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}
.sstm .sstm-card .sstm-link::after {
	content: "";
	width: 0.75em;
	height: 0.75em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3h8v8M13 3 3 13' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3h8v8M13 3 3 13' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sstm .sstm-card .sstm-link:hover { filter: brightness(1.15); }
.sstm.sstm-link-text .sstm-card .sstm-link {
	padding: 0;
	border-radius: 0;
	background: none;
	color: var(--sstm-accent, #3b1f8f);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Phones: card becomes a bottom sheet regardless of position setting. */
@media (max-width: 600px) {
	.sstm .sstm-card { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 55%; }
}

/* ---------- Zoom hint ---------- */
.sstm-hint {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
}
.sstm-hint.is-on { opacity: 1; }

/* ---------- Fullscreen ---------- */
.sstm.is-fs {
	position: fixed;
	inset: 0;
	z-index: 999999;
	margin: 0;
	padding: 12px;
	background: #fff;
	display: flex;
	flex-direction: column;
}
.sstm.is-fs .sstm-stage { flex: 1; height: auto; touch-action: none; }
html.sstm-noscroll { overflow: hidden; }

/* ---------- Shared helpers ---------- */
.sstm .sst-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.sst-notice { padding: 0.75em 1em; border-left: 4px solid #dba617; background: #fcf9e8; color: #1d2327; font-size: 0.9em; }

/* ---------- Section buttons (shared look: map + table) ---------- */
.sst-sections { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 0.75em; }
.sst-sections .sst-sec,
.sst-sections .sst-sec:hover,
.sst-sections .sst-sec:focus {
	all: unset;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0.35em 0.8em;
	border: 1px solid rgba(127, 127, 127, 0.35);
	border-radius: 999px;
	font: inherit;
	font-size: 0.88em;
	line-height: 1.3;
	color: inherit;
	background: transparent;
	cursor: pointer;
}
.sst-sections .sst-sec:hover { background: rgba(127, 127, 127, 0.1); }
.sst-sections .sst-sec[aria-pressed="true"] { background: var(--sst-sec-on, #1d2327); border-color: var(--sst-sec-on, #1d2327); color: var(--sst-sec-on-text, #fff); }
.sst-sections .sst-sec:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.sst-swatch { display: inline-block; flex: none; width: 0.8em; height: 0.8em; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.25); vertical-align: -0.05em; }
.sstm .sst-sections { --sst-sec-on: var(--sstm-ui-active, var(--sstm-accent)); --sst-sec-on-text: var(--sstm-ui-active-text, var(--sstm-accent-text, #fff)); }
.sstm .sst-sections .sst-sec,
.sstm .sst-sections .sst-sec:hover,
.sstm .sst-sections .sst-sec:focus {
	color: var(--sstm-ui-text, var(--sstm-ui-text-d));
	background: var(--sstm-ui-bg, var(--sstm-ui-bg-d));
	border-color: var(--sstm-ui-border, var(--sstm-ui-border-d));
}
.sstm .sst-sections .sst-sec:hover { filter: brightness(1.1); }
.sstm .sst-sections .sst-sec[aria-pressed="true"] { background: var(--sst-sec-on); border-color: var(--sst-sec-on); color: var(--sst-sec-on-text); }

/* Dark page background preset. */
.sstm.sstm-ui-dark {
	--sstm-ui-text-d: #ffffff;
	--sstm-ui-bg-d: rgba(255, 255, 255, 0.06);
	--sstm-ui-border-d: rgba(255, 255, 255, 0.38);
	--sstm-btn-bg-d: #1f2233;
	--sstm-btn-text-d: #ffffff;
	--sstm-drop-bg: #1f2233;
	--sstm-drop-text: #ffffff;
	--sstm-drop-hover: rgba(255, 255, 255, 0.1);
	--sstm-placeholder: #ffffff;
}
.sstm.sstm-ui-dark .sstm-stage { border-color: rgba(255, 255, 255, 0.2); }
.sstm.sstm-ui-dark .sstm-noresult { color: rgba(255, 255, 255, 0.7); }

/* Section filter: other booths fade back (by colour, not transparency, so nothing under them shows through). */
.sstm .is-dim path, .sstm .is-dim rect, .sstm path.is-dim, .sstm rect.is-dim { fill: var(--sstm-dim, #f4f4f6) !important; stroke-opacity: 0.35; }
.sstm .sstm-hit.is-dim { fill: transparent !important; }
.sstm .sstm-label.is-dim { opacity: 0.2; }
.sstm-ex-section { display: flex; align-items: center; gap: 6px; margin: 0 0 0.25em; font-size: 0.78em; letter-spacing: 0.03em; text-transform: uppercase; opacity: 0.75; }

/* Admin previews sit on a white screen: show the dark preset on a dark backdrop. */
.wp-admin .sstm.sstm-ui-dark { padding: 14px; border-radius: 10px; background: #14152b; }
