/**
 * **********************************************************************
 * QR Pass Scanner — Teaching + Start Learning
 *
 * Button styling and camera-scan modal for js/qr-scan.js.
 *
 * @version  1.1.0
 * @updated  2026-08-31
 * **********************************************************************
 */

/* =============================================================================
   1. Hero button — top-right of the page hero
   ============================================================================= */

.tc-hero,
.sl-hero {
	position: relative;
}

.tc-scan-btn {
	position: absolute;
	top: var(--mah-space-5);
	right: var(--mah-space-5);
	display: inline-flex;
	align-items: center;
	gap: var(--mah-space-2);
	background: rgba(255, 255, 255, .12);
	color: var(--mah-white);
	border: 1px solid rgba(255, 255, 255, .5);
	border-radius: var(--mah-radius-pill);
	padding: var(--mah-space-2) var(--mah-space-4);
	font-size: var(--mah-font-sm2);
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, transform .15s ease;
	z-index: 2;
}

.tc-scan-btn:hover,
.tc-scan-btn:focus-visible {
	background: rgba(255, 255, 255, .22);
}

.tc-scan-btn:focus-visible {
	outline: 2px solid var(--mah-white);
	outline-offset: 2px;
}

.tc-scan-btn__icon {
	font-size: var(--mah-font-base);
}

@media (max-width: 640px) {
	.tc-scan-btn {
		top: var(--mah-space-3);
		right: var(--mah-space-3);
		padding: var(--mah-space-1) var(--mah-space-3);
		font-size: var(--mah-font-xs);
	}
}

/* =============================================================================
   2. Modal shell — matches the FAQ modal's visual language
   ============================================================================= */

#mah-qrscan-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	z-index: 9001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--mah-space-4);
}

#mah-qrscan-overlay[hidden] { display: none; }

#mah-qrscan-modal {
	background: var(--mah-white);
	border-radius: var(--mah-radius-md);
	width: min(480px, 100%);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 6px 32px rgba(0, 0, 0, .3);
	overflow: hidden;
}

#mah-qrscan-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--mah-space-4) var(--mah-space-5);
	background: var(--mah-header-bg);
	color: var(--mah-white);
	flex-shrink: 0;
}

#mah-qrscan-header h2 {
	margin: 0;
	font-size: var(--mah-font-md2);
	color: var(--mah-white);
}

#mah-qrscan-close {
	background: none;
	border: none;
	color: var(--mah-white);
	font-size: var(--mah-font-3xl);
	line-height: 1;
	cursor: pointer;
	padding: 0 var(--mah-space-1);
	opacity: .85;
}

#mah-qrscan-close:hover,
#mah-qrscan-close:focus {
	opacity: 1;
}

/* =============================================================================
   3. Body — camera viewport, status, manual fallback
   ============================================================================= */

#mah-qrscan-body {
	padding: var(--mah-space-5);
	overflow-y: auto;
}

#mah-qrscan-video-wrap {
	width: 100%;
	aspect-ratio: 1;
	background: var(--mah-black);
	border-radius: var(--mah-radius-md);
	overflow: hidden;
}

#mah-qrscan-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#mah-qrscan-status {
	margin: var(--mah-space-4) 0;
	text-align: center;
	color: var(--mah-grey-500);
	font-size: var(--mah-font-sm2);
}

#mah-qrscan-manual {
	border-top: 1px solid var(--mah-grey-200);
	padding-top: var(--mah-space-4);
}

#mah-qrscan-manual label {
	display: block;
	font-size: var(--mah-font-sm);
	color: var(--mah-grey-600);
	margin-bottom: var(--mah-space-2);
}

#mah-qrscan-manual-row {
	display: flex;
	gap: var(--mah-space-2);
}

#mah-qrscan-manual-input {
	flex: 1;
	min-width: 0;
	padding: var(--mah-space-2) var(--mah-space-3);
	border: 1px solid var(--mah-grey-300);
	border-radius: var(--mah-radius-sm);
	font-size: var(--mah-font-sm2);
}

#mah-qrscan-manual-go {
	background: var(--mah-green);
	color: var(--mah-white);
	border: none;
	border-radius: var(--mah-radius-sm);
	padding: var(--mah-space-2) var(--mah-space-4);
	font-weight: 600;
	cursor: pointer;
}

#mah-qrscan-manual-go:hover,
#mah-qrscan-manual-go:focus-visible {
	background: var(--mah-green-mid);
}
