/*
 * Seat maps (includes/seats.php tt_seat_map_html()). The map sits on its own light panel, so it
 * reads the same on the light admin screens and inside the dark register. Each state differs by
 * shape or pattern as well as colour: open (white, round corners), held (striped, dashed edge),
 * taken (dark, square, struck through), house seat (dotted edge, cream), wheelchair space (a
 * circle), companion seat (a thick top edge), picked (green, thick outline).
 */

.tt-seatmap {
	--tt-seat: 1.9rem;
	--tt-seat-ink: #1a1a1a;
	--tt-seat-line: #4a4a4a;
	--tt-seat-focus: #1d4ed8;
	max-width: 100%;
	margin: 0 0 1rem;
	padding: 1rem;
	color: var(--tt-seat-ink);
	background: #fafafa;
	border: 1px solid #c9c9c9;
	border-radius: 6px;
	font: 400 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.tt-seatmap .tt-sr,
.tt-seatmap__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.tt-seatmap__front {
	margin: 0 auto 1rem;
	padding: 0.25rem;
	max-width: min(100%, calc(var(--tt-seat-cols, 10) * var(--tt-seat) + 2rem));
	box-sizing: border-box;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #fff;
	background: #3b3b3b;
	border-radius: 0 0 40% 40% / 0 0 100% 100%;
}

/* The rows scroll sideways inside their own box on a narrow screen; the screen bar above, the
   status and the key below stay where they are. */
.tt-seatmap__scroll {
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	padding: 4px 2px 6px;
}

/* Wider than its box (seats.js frame()): a line under the screen bar, a fade and an arrow on each
   side with seats out of sight. The left arrow starts after the row letters, which stay in view. */
.tt-seatmap__frame {
	position: relative;
}

.tt-seatmap__hint {
	display: none;
	margin: -0.5rem 0 0.5rem;
	text-align: center;
	font-size: 13px;
	color: #3f3f3f;
}

.tt-seatmap.is-wide .tt-seatmap__hint {
	display: block;
}

.tt-seatmap__more {
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 3;
	display: none;
	align-items: center;
	width: 2.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	font: inherit;
	color: var(--tt-seat-ink);
}

.tt-seatmap__more span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border: 2px solid var(--tt-seat-ink);
	border-radius: 50%;
	background: #fff;
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.tt-seatmap__more--r {
	right: 0;
	justify-content: flex-end;
	background: linear-gradient(to right, rgba(250, 250, 250, 0), #fafafa 70%);
}

.tt-seatmap__more--l {
	left: calc(1.75rem + 0.5rem);
	justify-content: flex-start;
	background: linear-gradient(to left, rgba(250, 250, 250, 0), #fafafa 70%);
}

.tt-seatmap__frame.is-more-r .tt-seatmap__more--r,
.tt-seatmap__frame.is-more-l .tt-seatmap__more--l {
	display: flex;
}

/* A picker: every seat at least 32px across, for a finger. */
.tt-seatmap--pick {
	--tt-seat: 2.125rem;
}

.tt-seatmap__rows {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	width: max-content;
	margin: 0 auto;
}

.tt-seatmap__row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.tt-seatmap__label {
	position: sticky;
	left: 0;
	z-index: 2;
	width: 1.75rem;
	flex: none;
	align-self: stretch; /* As tall as the seats, so none shows above or below it. */
	display: flex;
	align-items: center;
	justify-content: flex-end;
	background: #fafafa;
	box-shadow: -1rem 0 0 #fafafa, 0.375rem 0 0 #fafafa; /* Seats scrolled under the letter stay hidden, both sides of it. */
	text-align: right;
	font-weight: 700;
}

.tt-seatmap__seats {
	display: grid;
	grid-template-columns: repeat(calc(var(--tt-seat-cols, 10) * 2), calc(var(--tt-seat) / 2));
	margin: 0;
	padding: 0;
	list-style: none;
}

.tt-seatmap__seats > li {
	margin: 0;
	padding: 1px;
}

.tt-seat {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: calc(var(--tt-seat) - 2px);
	height: calc(var(--tt-seat) - 2px);
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	color: var(--tt-seat-ink);
	background: #fff;
	border: 2px solid var(--tt-seat-line);
	border-radius: 6px 6px 3px 3px;
	cursor: default;
}

button.tt-seat:disabled {
	opacity: 1;
}

.tt-seat--held {
	background: repeating-linear-gradient(45deg, #fff 0 4px, #cfcfcf 4px 7px);
	border-style: dashed;
}

.tt-seat--sold {
	color: #fff;
	background: #3b3b3b;
	border-color: #3b3b3b;
	border-radius: 2px;
}

.tt-seat--sold::after {
	content: "";
	position: absolute;
	left: 3px;
	right: 3px;
	top: 50%;
	border-top: 2px solid #fff;
	transform: rotate(-45deg);
}

.tt-seat--house {
	background: #f6e7b8;
	border-style: dotted;
	border-width: 3px;
}

.tt-seat--access {
	border-radius: 50%;
	border-width: 3px;
}

.tt-seat--companion {
	border-top-width: 6px;
}

/* Picked: a button (or the key's swatch) with is-picked, or a form's label after its checked box.
   Never the form's li: its checkbox alone says whether it is picked. */
button.tt-seat.is-picked,
span.tt-seat.is-picked,
.tt-seat__box:checked + label {
	color: #fff;
	background: #0b5d3b;
	border-color: #062e1d;
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #062e1d;
}

.tt-seatmap--pick button.tt-seat:not(:disabled) {
	cursor: pointer;
}

.tt-seatmap--pick button.tt-seat:not(:disabled):hover {
	border-color: #000;
}

.tt-seat:focus-visible,
.tt-seat__box:focus-visible + label {
	outline: 3px solid var(--tt-seat-focus);
	outline-offset: 2px;
}

/* A seat in a form: the checkbox is read by screen readers; its label is the seat. */
li.tt-seat {
	padding: 0;
	border: 0;
	background: none;
	width: auto;
	height: auto;
}

/* The box itself stays out of sight (the label is the seat), whatever a theme does to form inputs. */
.tt-seatmap li.tt-seat .tt-seat__box,
.tt-seatmap li.tt-seat .tt-seat__box:disabled {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	-webkit-appearance: none;
	appearance: none;
}

li.tt-seat > label {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: calc(var(--tt-seat) - 2px);
	height: calc(var(--tt-seat) - 2px);
	font-size: 11px;
	font-weight: 700;
	background: #fff;
	border: 2px solid var(--tt-seat-line);
	border-radius: 6px 6px 3px 3px;
	cursor: pointer;
}

li.tt-seat--sold > label { color: #fff; background: #3b3b3b; border-color: #3b3b3b; border-radius: 2px; cursor: not-allowed; }
li.tt-seat--held > label { background: repeating-linear-gradient(45deg, #fff 0 4px, #cfcfcf 4px 7px); border-style: dashed; cursor: not-allowed; }
li.tt-seat--house > label { background: #f6e7b8; border-style: dotted; border-width: 3px; }
li.tt-seat--access > label { border-radius: 50%; border-width: 3px; }
li.tt-seat--companion > label { border-top-width: 6px; }

.tt-seatmap__status {
	min-height: 1.4em;
	margin: 0.75rem 0 0;
	font-weight: 700;
	text-align: center;
}

.tt-seatmap__legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.25rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.tt-seatmap__legend li {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
}

.tt-seatmap__legend .tt-seat {
	width: 1.25rem;
	height: 1.25rem;
}

/* Under a buyer's map: the note about wheelchair spaces, the picker's buttons. */
.tt-seatmap__note {
	margin: 0.75rem 0 0;
	text-align: center;
}

.tt-seatmap .tt-seat__box:disabled + label {
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.tt-seatmap {
		padding: 0.75rem 0.5rem;
	}
	.tt-seatmap__label {
		width: 1.25rem;
	}
	.tt-seatmap__more--l {
		left: calc(1.25rem + 0.5rem);
	}
}

/* The counter: the map fits its column at 1440 (32px seats, a tighter frame); a wider map scrolls. */
.tt-counter__seats .tt-seatmap {
	--tt-seat: 2rem;
	padding: 0.75rem 0.5rem;
}

.tt-counter__seats .tt-seatmap__label {
	width: 1.25rem;
}

.tt-counter__seats .tt-seatmap__more--l {
	left: calc(1.25rem + 0.5rem);
}

/* The editor's lines (Tickets › Seat maps). */
.tt-seatmap-lines input[type="text"],
.tt-seatmap-lines input[type="number"] {
	max-width: 100%;
}
