/*
 * JB Tickets: seat selection. Neutral base styles, the theme restyles them through the custom
 * properties below. Zone color comes in --jb-zone on each seat (SchemeRenderer).
 * The background shema4.svg draws the seats itself (dark squares with white numbers), so
 * free seats are only tinted and the numbers stay readable.
 */

.jb-seat-selection {
	--jb-accent: #bd905b;
	--jb-accent-text: #fff;
	--jb-text: #1f1f1f;
	--jb-muted: #737373;
	--jb-border: #d9d9d9;
	--jb-surface: #fff;
	--jb-held: #8c8c8c;
	--jb-sold: #3a3a3a;
	--jb-focus: #1d5fbf;
	/* Seat squares in the background scheme: legend swatches blend with it to match the map. */
	--jb-seat-bg: #565656;

	color: var(--jb-text);
}

.jb-seat-selection__head {
	margin-bottom: 12px;
}

.jb-seat-selection__title {
	margin: 0 0 4px;
}

.jb-seat-selection__badge {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--jb-accent);
	color: var(--jb-accent-text);
	font-size: 0.6em;
	vertical-align: middle;
}

.jb-seat-selection__meta {
	margin: 0;
	color: var(--jb-muted);
}

.jb-seat-selection__notice {
	margin: 0 0 12px;
	padding: 10px 14px;
	border-left: 4px solid var(--jb-accent);
	background: color-mix(in srgb, var(--jb-accent) 12%, var(--jb-surface));
}

.jb-seat-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

.jb-seat-legend li {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.jb-seat-legend__swatch {
	width: 16px;
	height: 16px;
	border: 1px solid rgba(0, 0, 0, 0.3);
	border-radius: 3px;
	/* Same mix as a free seat on the map: zone color at fill-opacity 0.45 over the seat square. */
	background: color-mix(in srgb, var(--jb-zone, var(--jb-accent)) 45%, var(--jb-seat-bg));
}

.jb-seat-legend__swatch--selected {
	background: color-mix(in srgb, var(--jb-accent) 80%, var(--jb-seat-bg));
	border: 2px solid var(--jb-text);
}

.jb-seat-legend__swatch--held {
	background: var(--jb-held);
}

.jb-seat-legend__swatch--sold {
	background: var(--jb-sold);
}

.jb-seat-selection__body {
	display: grid;
	gap: 20px;
}

@media (min-width: 1025px) {
	.jb-seat-selection__body {
		grid-template-columns: minmax(0, 1fr) 300px;
		align-items: start;
	}

	/* Below the theme's sticky header (the theme sets --jb-sticky-top) and the admin bar (staff). */
	.jb-seat-selection__summary {
		position: sticky;
		top: calc(var(--jb-sticky-top, 20px) + var(--wp-admin--admin-bar--height, 0px));
	}
}

.jb-seat-selection__map {
	min-width: 0;
}

/* Above the scheme, not over it: the background has its own title «Схема зала». */
.jb-seat-selection__zoom {
	display: flex;
	justify-content: flex-end;
	gap: 4px;
	margin-bottom: 6px;
}

.jb-seat-selection .jb-seat-selection__zoom-btn {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--jb-border);
	border-radius: 4px;
	background: var(--jb-surface);
	color: var(--jb-text);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.jb-seat-selection .jb-seat-selection__zoom-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.jb-seat-selection__scheme {
	overflow: auto;
	border: 1px solid var(--jb-border);
	background: var(--jb-surface);
	-webkit-overflow-scrolling: touch;
}

.jb-seat-selection__scheme .jb-hall-scheme {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
	touch-action: manipulation;
}

/* Phones: seats would be ~9px wide at full width, too small to tap. Scroll instead. */
@media (max-width: 767px) {
	.jb-seat-selection__scheme .jb-hall-scheme {
		min-width: 760px;
	}
}

.jb-hall-scheme image {
	pointer-events: none;
}

.jb-hall-scheme .jb-seat {
	fill: var(--jb-zone, var(--jb-accent));
	fill-opacity: 0.45;
	stroke: transparent;
	stroke-width: 2;
	outline: none;
}

.jb-hall-scheme .jb-seat--free,
.jb-hall-scheme .jb-seat--mine {
	cursor: pointer;
}

.jb-hall-scheme .jb-seat--free:hover {
	fill-opacity: 0.75;
	stroke: var(--jb-text);
}

.jb-hall-scheme .jb-seat.is-selected,
.jb-hall-scheme .jb-seat--mine.is-selected {
	fill: var(--jb-accent);
	fill-opacity: 0.8;
	stroke: var(--jb-text);
	stroke-width: 3;
}

.jb-hall-scheme .jb-seat--mine:not(.is-selected) {
	fill: var(--jb-accent);
	fill-opacity: 0.35;
	stroke: var(--jb-accent);
	stroke-dasharray: 4 3;
}

.jb-hall-scheme .jb-seat--held {
	fill: var(--jb-held);
	fill-opacity: 0.85;
}

.jb-hall-scheme .jb-seat--sold {
	fill: var(--jb-sold);
	fill-opacity: 0.9;
}

.jb-hall-scheme .jb-seat--off {
	fill: var(--jb-surface);
	fill-opacity: 0.7;
}

.jb-hall-scheme .jb-seat:focus-visible {
	stroke: var(--jb-focus);
	stroke-width: 4;
}

.jb-seat-selection__summary {
	padding: 16px;
	border: 1px solid var(--jb-border);
	background: var(--jb-surface);
}

.jb-seat-selection__summary-title {
	margin: 0 0 10px;
	font-size: 1.1em;
}

.jb-seat-selection__hold {
	margin: 0 0 12px;
	padding: 10px;
	background: color-mix(in srgb, var(--jb-accent) 12%, var(--jb-surface));
}

.jb-seat-selection__hold p {
	margin: 0 0 8px;
}

.jb-seat-selection__timer {
	font-variant-numeric: tabular-nums;
}

.jb-seat-selection .jb-seat-selection__checkout {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 4px;
	background: var(--jb-accent);
	color: var(--jb-accent-text);
	text-decoration: none;
}

.jb-seat-selection__empty {
	margin: 0 0 10px;
	color: var(--jb-muted);
}

.jb-seat-selection__list {
	margin: 0 0 10px;
	padding: 0;
	list-style: none;
}

.jb-seat-selection__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 0;
	border-bottom: 1px solid var(--jb-border);
}

.jb-seat-selection .jb-seat-selection__remove,
.jb-seat-selection .jb-seat-selection__release {
	padding: 2px 8px;
	border: 1px solid var(--jb-border);
	border-radius: 4px;
	background: transparent;
	color: var(--jb-text);
	cursor: pointer;
}

.jb-seat-selection__total {
	margin: 0 0 12px;
	font-size: 1.1em;
}

.jb-seat-selection .jb-seat-selection__submit {
	width: 100%;
	padding: 12px 16px;
	border: 0;
	border-radius: 4px;
	background: var(--jb-accent);
	color: var(--jb-accent-text);
	font-size: 1em;
	cursor: pointer;
}

.jb-seat-selection .jb-seat-selection__submit:disabled {
	opacity: 0.5;
	cursor: default;
}

.jb-seat-selection.is-busy .jb-seat-selection__scheme {
	opacity: 0.7;
}

.jb-seat-selection button:focus-visible {
	outline: 2px solid var(--jb-focus);
	outline-offset: 2px;
}
