/**
 * Master Tickets — check-in kiosk styles.
 *
 * The kiosk is the plugin's signature surface: a dark, distraction-free terminal
 * whose entire status panel changes colour on every scan so the outcome reads
 * from across a room. Status colours are semantic (green = valid, amber = used,
 * red = invalid) and fixed; --mt-primary tints only the idle/checking states.
 * Per the brief there are no status animations.
 */

.mt-kiosk-body {
	margin: 0;
	background: #0b0f14;
}

.mt-kiosk {
	--k-canvas: #0b0f14;
	--k-panel: #131a22;
	--k-line: #232c37;
	--k-text: #e6edf3;
	--k-dim: #8b98a8;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 20px;
	gap: 20px;
	background: var(--k-canvas);
	color: var(--k-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.mt-kiosk *,
.mt-kiosk *::before,
.mt-kiosk *::after {
	box-sizing: border-box;
}

/* Header ------------------------------------------------------------ */

.mt-kiosk-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.mt-kiosk-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.mt-kiosk-logo {
	height: 32px;
	width: auto;
	display: block;
}

.mt-kiosk-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--k-dim);
}

.mt-kiosk-meta {
	display: flex;
	align-items: center;
	gap: 16px;
}

.mt-kiosk-user {
	font-size: 14px;
	color: var(--k-dim);
}

.mt-kiosk-logout {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
	color: var(--k-text);
	text-decoration: none;
	padding: 8px 16px;
	border: 1px solid var(--k-line);
	border-radius: 999px;
}

.mt-kiosk-logout:hover,
.mt-kiosk-logout:focus {
	background: var(--k-panel);
	color: #ffffff;
}

/* Status panel (the hero) ------------------------------------------ */

.mt-kiosk-main {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.mt-status {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 18px;
	padding: clamp(24px, 5vw, 64px);
	border-radius: 24px;
	border: 1px solid var(--k-line);
	background: var(--k-panel);
	transition: none;
}

.mt-status-word {
	margin: 0;
	font-size: clamp(2.75rem, 11vw, 9rem);
	font-weight: 800;
	line-height: 0.95;
	letter-spacing: -0.02em;
	text-transform: uppercase;
}

.mt-status-name {
	margin: 0;
	font-size: clamp(1.25rem, 3.5vw, 2.5rem);
	font-weight: 600;
	line-height: 1.15;
}

.mt-status-product {
	margin: 0;
	font-size: clamp(1rem, 2.2vw, 1.5rem);
	font-weight: 500;
	opacity: 0.85;
}

.mt-status-code {
	margin: 4px 0 0;
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: clamp(1.1rem, 2.6vw, 1.9rem);
	font-weight: 600;
	letter-spacing: 0.24em;
	opacity: 0.9;
}

.mt-status-time {
	margin: 0;
	font-size: clamp(0.95rem, 1.8vw, 1.15rem);
	opacity: 0.75;
}

.mt-status-name:empty,
.mt-status-product:empty,
.mt-status-code:empty,
.mt-status-time:empty {
	display: none;
}

/* Status states ---------------------------------------------------- */

.mt-status.is-ready {
	background: var(--k-panel);
	border-color: var(--k-line);
}

.mt-status.is-ready .mt-status-word {
	color: var(--mt-primary, #4f46e5);
}

.mt-status.is-scanning {
	background: #0f1620;
	border-color: #2b3644;
}

.mt-status.is-scanning .mt-status-word {
	color: var(--k-dim);
}

.mt-status.is-valid {
	background: #12692f;
	border-color: #1a8a3f;
	color: #f0fff5;
}

.mt-status.is-valid .mt-status-word {
	color: #ffffff;
}

.mt-status.is-used {
	background: #9a5a09;
	border-color: #c1740f;
	color: #fff8ec;
}

.mt-status.is-used .mt-status-word {
	color: #ffffff;
}

.mt-status.is-invalid,
.mt-status.is-error {
	background: #9b1c1c;
	border-color: #c62828;
	color: #fff1f1;
}

.mt-status.is-invalid .mt-status-word,
.mt-status.is-error .mt-status-word {
	color: #ffffff;
}

.mt-status.is-limited {
	background: #78500a;
	border-color: #9a6a10;
	color: #fff8ec;
}

.mt-status.is-limited .mt-status-word {
	color: #ffffff;
}

/* Footer ------------------------------------------------------------ */

.mt-kiosk-footer {
	text-align: center;
}

.mt-kiosk-hint {
	margin: 0;
	font-size: 13px;
	letter-spacing: 0.04em;
	color: var(--k-dim);
}

/* Hidden scanner capture field ------------------------------------- */

.mt-scan-label {
	position: fixed;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.mt-scan-input {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	opacity: 0;
	background: transparent;
	color: transparent;
	caret-color: transparent;
	pointer-events: none;
}

/* Inline (embedded) permission notice ------------------------------ */

.mt-checkin-denied {
	padding: 24px;
	text-align: center;
	color: #6b7280;
}

.mt-checkin-denied a {
	color: inherit;
	font-weight: 600;
}

/* Responsive ------------------------------------------------------- */

@media screen and (max-width: 600px) {
	.mt-kiosk {
		padding: 12px;
		gap: 12px;
	}

	.mt-kiosk-title {
		display: none;
	}

	.mt-status {
		border-radius: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mt-kiosk-logout {
		transition: none;
	}
}

/* Check-in method controls (scanner / manual) ---------------------- */

.mt-checkin-controls {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.mt-mode-toggle {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	justify-content: center;
	padding: 6px;
	background: var(--k-panel);
	border: 1px solid var(--k-line);
	border-radius: 16px;
}

.mt-mode-btn {
	flex: 1 1 0;
	min-width: 0;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	appearance: none;
	border: 1px solid transparent;
	cursor: pointer;
	min-height: 66px;
	padding: 10px 8px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--k-dim);
	background: transparent;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.mt-mode-btn__icon {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
}

.mt-mode-btn__label {
	font-size: 13px;
	line-height: 1.15;
	text-align: center;
}

.mt-mode-btn:hover {
	color: var(--k-text);
	background: rgba( 255, 255, 255, 0.05 );
}

.mt-mode-btn.is-active {
	color: #ffffff;
	background: var(--mt-primary, #4f46e5);
}

.mt-mode-btn.is-active:hover {
	background: var(--mt-primary, #4f46e5);
}

.mt-mode-btn:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.mt-mode-btn {
		transition: none;
	}
}

@media screen and (max-width: 400px) {
	.mt-mode-toggle {
		gap: 6px;
		padding: 5px;
	}

	.mt-mode-btn {
		padding: 8px 4px;
		min-height: 62px;
	}

	.mt-mode-btn__label {
		font-size: 12px;
	}
}

/* Method panels — only the active method is shown ------------------ */
.mt-panels {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	min-width: 0;
}

.mt-panel {
	width: 100%;
	max-width: 520px;
}

.mt-panel-scanner {
	display: none;
}

.mt-mode-scanner .mt-panel-scanner {
	display: block;
}

.mt-panel-note {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 16px 18px;
	text-align: center;
	color: var(--k-dim);
	background: var(--k-panel);
	border: 1px solid var(--k-line);
	border-radius: 14px;
}

.mt-panel-note__icon {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	color: var(--mt-primary, #4f46e5);
}

.mt-panel-note > span {
	white-space: nowrap;
	font-size: clamp( 10px, 3.3vw, 14.5px );
	line-height: 1.3;
}

@media screen and (max-width: 400px) {
	.mt-panel-note {
		padding: 14px 10px;
	}
}

/* Manual entry is hidden until the operator selects the Manual method. */
.mt-manual {
	display: none;
	width: 100%;
	max-width: 520px;
}

.mt-mode-manual .mt-manual {
	display: block;
}

.mt-manual-label {
	display: block;
	margin: 0 0 8px;
	text-align: center;
	font-size: 13px;
	letter-spacing: 0.04em;
	color: var(--k-dim);
}

.mt-manual-row {
	display: flex;
	gap: 10px;
}

.mt-manual-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 14px 16px;
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-align: center;
	text-transform: uppercase;
	color: var(--k-text);
	background: #0f1620;
	border: 1px solid var(--k-line);
	border-radius: 12px;
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.mt-manual-input:focus {
	outline: none;
	border-color: var(--mt-primary, #4f46e5);
}

.mt-manual-input::placeholder {
	color: #4a5666;
	letter-spacing: 0.06em;
}

.mt-manual-submit {
	flex: 0 0 auto;
	appearance: none;
	border: 0;
	cursor: pointer;
	padding: 0 24px;
	border-radius: 12px;
	font-size: 16px;
	font-weight: 700;
	color: #ffffff;
	background: var(--mt-primary, #4f46e5);
}

.mt-manual-submit:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

@media screen and (max-width: 600px) {
	.mt-manual-row {
		flex-direction: column;
	}

	.mt-manual-submit {
		padding: 14px 24px;
	}
}

/* Camera QR scanner --------------------------------------------------- */

/* Hidden until the operator selects the Camera QR Scanner method. */
.mt-camera {
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 520px;
	padding-bottom: max(0px, env(safe-area-inset-bottom));
}

.mt-mode-camera .mt-camera {
	display: flex;
}

/* Live preview stage with a 1:1 scanning area. */
.mt-camera-stage {
	position: relative;
	width: min(74vw, 320px);
	max-width: 100%;
	aspect-ratio: 1 / 1;
	max-height: min(46vh, 320px);
	border-radius: 18px;
	overflow: hidden;
	background: #000;
	border: 1px solid var(--k-line);
}

.mt-camera-stage.is-hidden {
	display: none;
}

.mt-camera-view {
	position: absolute;
	inset: 0;
}

.mt-camera-view video {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	display: block;
}

/* Hide the library's own shaded region; we draw our own frame. */
.mt-camera-view img,
.mt-camera-view [id^="qr-shaded-region"] {
	display: none !important;
}

/* Scanning frame overlay. */
.mt-camera-frame {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.mt-camera-corner {
	position: absolute;
	width: 28px;
	height: 28px;
	border: 3px solid var(--mt-primary, #4f46e5);
}

.mt-camera-corner--tl {
	top: 10%;
	left: 10%;
	border-right: 0;
	border-bottom: 0;
	border-top-left-radius: 8px;
}

.mt-camera-corner--tr {
	top: 10%;
	right: 10%;
	border-left: 0;
	border-bottom: 0;
	border-top-right-radius: 8px;
}

.mt-camera-corner--bl {
	bottom: 10%;
	left: 10%;
	border-right: 0;
	border-top: 0;
	border-bottom-left-radius: 8px;
}

.mt-camera-corner--br {
	bottom: 10%;
	right: 10%;
	border-left: 0;
	border-top: 0;
	border-bottom-right-radius: 8px;
}

.mt-camera-scanline {
	position: absolute;
	left: 12%;
	right: 12%;
	top: 12%;
	height: 2px;
	background: linear-gradient( 90deg, transparent, var(--mt-primary, #4f46e5), transparent );
	box-shadow: 0 0 10px var(--mt-primary, #4f46e5);
	animation: mt-camera-scan 2.4s ease-in-out infinite;
}

@keyframes mt-camera-scan {
	0% { top: 12%; }
	50% { top: 86%; }
	100% { top: 12%; }
}

.mt-camera-hint {
	margin: 0;
	text-align: center;
	font-size: 14px;
	letter-spacing: 0.02em;
	color: var(--k-dim);
}

.mt-camera-hint.is-hidden {
	display: none;
}

.mt-camera-actions {
	display: flex;
	justify-content: center;
	gap: 10px;
}

.mt-camera-btn {
	appearance: none;
	cursor: pointer;
	min-height: 44px;
	padding: 10px 20px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--k-text);
	background: var(--k-panel);
	border: 1px solid var(--k-line);
}

.mt-camera-btn--retry {
	color: #ffffff;
	background: var(--mt-primary, #4f46e5);
	border-color: transparent;
}

.mt-camera-btn:focus-visible {
	outline: 2px solid var(--mt-primary, #4f46e5);
	outline-offset: 2px;
}

.mt-camera-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	width: min(80vw, 360px);
	max-width: 100%;
	padding: 22px 18px;
	text-align: center;
	border-radius: 16px;
	background: var(--k-panel);
	border: 1px solid var(--k-line);
}

.mt-camera-error-msg {
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
	color: var(--k-text);
}

@media (prefers-reduced-motion: reduce) {
	.mt-camera-scanline {
		animation: none;
		top: 50%;
	}
}

@media screen and (max-width: 600px) {
	.mt-camera-stage {
		width: min(86vw, 320px);
	}
}

/* ============================================================
   v1.7.4 — camera overlay controls + compact camera-mode result
   ============================================================ */

/* Icon controls in a centred toolbar at the bottom of the preview. */
.mt-camera-toolbar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	z-index: 3;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	pointer-events: none;
}

.mt-camera-tool {
	pointer-events: auto;
	width: 46px;
	height: 46px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border-radius: 999px;
	border: 1px solid rgba( 255, 255, 255, 0.28 );
	background: rgba( 0, 0, 0, 0.5 );
	color: #ffffff;
	cursor: pointer;
	-webkit-backdrop-filter: blur( 6px );
	backdrop-filter: blur( 6px );
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.35 );
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.mt-camera-tool[hidden] { display: none; }
.mt-camera-tool svg { width: 20px; height: 20px; }
.mt-camera-tool:hover { background: rgba( 0, 0, 0, 0.66 ); }
.mt-camera-tool:active { transform: scale( 0.94 ); }
.mt-camera-tool:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* Flash active state. */
.mt-camera-tool--flash.is-on {
	background: var(--mt-primary, #4f46e5);
	border-color: transparent;
	color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
	.mt-camera-tool { transition: none; }
}

/* Roomy, coloured result card in camera mode. Background/border come from the
   status state classes (.is-valid / .is-used / .is-invalid / .is-ready), so the
   colour changes automatically with the scan result — just larger and compact
   enough to sit with the preview. */
.mt-mode-camera .mt-status {
	flex: 0 0 auto;
	align-self: center;
	gap: 10px;
	width: 100%;
	max-width: 560px;
	/* Fit the tallest result (VALID = word + 4 fields) so the "Ready to scan"
	   state is the same height; content stays vertically centred. */
	min-height: clamp( 200px, 48vw, 285px );
	padding: clamp( 20px, 4vw, 32px );
	border-radius: 20px;
}

.mt-mode-camera .mt-status-word { font-size: clamp( 2rem, 8vw, 3.25rem ); }
.mt-mode-camera .mt-status-name { font-size: clamp( 1.15rem, 4vw, 1.6rem ); }
.mt-mode-camera .mt-status-product { font-size: clamp( 0.95rem, 3vw, 1.2rem ); }
.mt-mode-camera .mt-status-code { font-size: clamp( 1rem, 3.2vw, 1.35rem ); letter-spacing: 0.16em; }
.mt-mode-camera .mt-status-time { font-size: clamp( 0.9rem, 2.4vw, 1.05rem ); }

/* Keep the camera-mode column top-aligned and tidy. */
.mt-mode-camera .mt-kiosk-main { justify-content: flex-start; }

/* ============================================================
   v1.8.0 — manual live-search results
   ============================================================ */
.mt-manual-results {
	margin-top: 8px;
	max-height: 320px;
	overflow-y: auto;
	border: 1px solid var(--k-line);
	border-radius: 12px;
	background: var(--k-panel);
	text-align: left;
	-webkit-overflow-scrolling: touch;
}

.mt-manual-result {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	padding: 12px 14px;
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--k-line);
	color: var(--k-text);
	text-align: left;
	cursor: pointer;
	appearance: none;
}

.mt-manual-result:last-child { border-bottom: 0; }
.mt-manual-result:hover,
.mt-manual-result:focus-visible {
	background: rgba( 255, 255, 255, 0.05 );
	outline: none;
}
.mt-manual-result.is-used { opacity: 0.6; }

.mt-manual-result__name { font-size: 15px; font-weight: 600; }
.mt-manual-result__meta { font-size: 12.5px; color: var(--k-dim); }

.mt-manual-empty {
	padding: 14px;
	text-align: center;
	font-size: 14px;
	color: var(--k-dim);
}
