/**
 * Scanner styles.
 *
 * @package Hummingbirds\KBKTickets
 */

/* Reset and base styles */
* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
}

/* Login Form */
.kbk-scanner-login {
	max-width: 400px;
	margin: 2rem auto;
	padding: 2rem;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kbk-scanner-login-form h2 {
	margin: 0 0 1.5rem;
	padding: 0;
	font-size: 1.5rem;
	text-align: center;
}

.kbk-scanner-error {
	padding: 1rem;
	margin-bottom: 1rem;
	background: #fee;
	border: 1px solid #fcc;
	border-radius: 4px;
	color: #c33;
}

.kbk-scanner-field {
	margin-bottom: 1.5rem;
}

.kbk-scanner-field label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
}

.kbk-scanner-field input[type="password"] {
	width: 100%;
	padding: 0.75rem;
	font-size: 1rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-sizing: border-box;
}

.kbk-scanner-field input[type="password"]:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.kbk-scanner-actions {
	text-align: center;
}

.kbk-scanner-submit {
	padding: 0.75rem 2rem;
	font-size: 1rem;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s;
}

.kbk-scanner-submit:hover {
	background: #005a87;
}

.kbk-scanner-submit:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

/* Scanner Container - Full Viewport Layout */
.kbk-scanner-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	width: 100dvw; /* Dynamic viewport width for mobile */
	height: 100vh;
	height: 100dvh; /* Dynamic viewport height for mobile */
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	background: #000;
	overflow: hidden;
}

/* Scanner Viewfinder - Takes ~65% of viewport */
.kbk-scanner-viewfinder {
	position: relative;
	width: 100%;
	flex: 1 1 auto;
	min-height: 0;
	background: #000;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.kbk-scanner-viewfinder video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.kbk-scanner-loading {
	color: #fff;
	font-size: 1.125rem;
	text-align: center;
	padding: 2rem;
	margin: 0;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
}

/* Start Camera Button */
.kbk-scanner-start-container {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10;
	text-align: center;
}

.kbk-scanner-start-button {
	padding: 1rem 2rem;
	font-size: 1.125rem;
	font-weight: 600;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	min-width: 200px;
}

.kbk-scanner-start-button:hover {
	background: #005a87;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.kbk-scanner-start-button:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.kbk-scanner-start-button:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.5);
}

.kbk-scanner-error-message {
	color: #fff;
	font-size: 1.125rem;
	text-align: center;
	padding: 2rem;
	margin: 0;
	background: rgba(220, 50, 50, 0.9);
	border-radius: 8px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	width: 90%;
	max-width: 500px;
}

/* Torch Button */
.kbk-scanner-torch {
	position: absolute;
	bottom: 1rem;
	right: 1rem;
	width: 50px;
	height: 50px;
	padding: 0;
	font-size: 1.5rem;
	background: rgba(255, 255, 255, 0.9);
	border: 2px solid #333;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	transition: all 0.2s;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.kbk-scanner-torch:hover {
	background: rgba(255, 255, 255, 1);
	transform: scale(1.1);
}

.kbk-scanner-torch:active {
	transform: scale(0.95);
}

.kbk-scanner-torch.active {
	background: #ffc107;
	border-color: #ff9800;
}

.kbk-scanner-torch:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 200, 0, 0.5);
}

/* Scanner Result - Takes ~25% of viewport */
.kbk-scanner-result {
	flex: 0 0 auto;
	min-height: 120px;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	font-size: 1.5rem;
	font-weight: 600;
	overflow: hidden;
	/* Default state - empty/neutral */
	background: #000;
	color: #fff;
	transition: background-color 0.3s ease-out;
}

.kbk-scanner-result:not(.valid):not(.invalid):not(.already-scanned):not(.error) {
	/* Empty state - keep space but show nothing */
	background: #000;
}

.kbk-scanner-result.valid {
	background: #28a745;
	color: #fff;
	animation: slideIn 0.3s ease-out;
}

.kbk-scanner-result.invalid {
	background: #dc3545;
	color: #fff;
	animation: slideIn 0.3s ease-out;
}

.kbk-scanner-result.already-scanned {
	background: #ffc107;
	color: #000;
	animation: slideIn 0.3s ease-out;
}

.kbk-scanner-result.error {
	background: #dc3545;
	color: #fff;
	animation: slideIn 0.3s ease-out;
}

.kbk-scanner-result-icon {
	margin-bottom: 0.75rem;
	line-height: 1;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: normal;
	color: #fff;
}

.kbk-scanner-result-icon .material-icons {
	font-size: 48px;
	line-height: 1;
	width: 48px;
	height: 48px;
}

.kbk-scanner-result-title {
	font-size: 1.5rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
	line-height: 1.2;
}

.kbk-scanner-result-code {
	font-size: 0.875rem;
	font-weight: 400;
	opacity: 0.9;
	margin-top: 0.5rem;
	line-height: 1.4;
}

.kbk-scanner-result-details {
	width: 100%;
	max-width: 600px;
	margin-top: 1rem;
	font-size: 1rem;
	font-weight: 400;
}

.kbk-scanner-result-detail-name {
	text-align: center;
	font-weight: 500;
}

/* Scanner Input - Always visible at bottom */
.kbk-scanner-input-container {
	flex: 0 0 auto;
	min-height: 90px;
	height: 90px;
	max-height: 90px;
	padding: 0.75rem 1rem;
	background: #f5f5f5;
	display: flex !important;
	flex-direction: column;
	justify-content: center;
	flex-shrink: 0;
	flex-grow: 0;
	z-index: 1000;
	position: relative;
	border-top: 1px solid #e0e0e0;
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
	visibility: visible !important;
	opacity: 1 !important;
	overflow: visible;
}

.kbk-scanner-input-label {
	display: block;
	font-size: 0.875rem;
	color: #666;
	margin-bottom: 0.5rem;
	font-weight: 500;
}

.kbk-scanner-input-wrapper {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
}

.kbk-scanner-manual-code {
	flex: 1;
	padding: 0.875rem 1rem;
	font-size: 1rem;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	color: #333;
	min-height: 48px;
	-webkit-appearance: none;
	appearance: none;
}

.kbk-scanner-manual-code:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.kbk-scanner-submit-code {
	width: 48px;
	height: 48px;
	min-width: 48px;
	min-height: 48px;
	padding: 0;
	background: #000;
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kbk-scanner-submit-code:hover {
	background: #333;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.kbk-scanner-submit-code:active {
	background: #000;
	transform: scale(0.95);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.kbk-scanner-submit-code:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

.kbk-scanner-submit-code .material-icons {
	font-size: 24px;
	line-height: 1;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
	.kbk-scanner-container {
		height: 100vh;
		height: 100dvh;
	}

	.kbk-scanner-viewfinder {
		flex: 1 1 auto;
		min-height: 0;
	}

	.kbk-scanner-result {
		min-height: 100px;
		padding: 1rem;
		font-size: 1.25rem;
	}

	.kbk-scanner-result-title {
		font-size: 1.25rem;
	}

	.kbk-scanner-result-icon {
		width: 56px;
		height: 56px;
		margin-bottom: 0.5rem;
	}

	.kbk-scanner-result-icon .material-icons {
		font-size: 40px;
		width: 40px;
		height: 40px;
	}

	.kbk-scanner-result-details {
		font-size: 0.875rem;
		margin-top: 0.75rem;
	}

	.kbk-scanner-input-container {
		min-height: 90px;
		height: 90px;
		padding: 0.75rem;
		display: flex !important;
	}

	.kbk-scanner-input-label {
		font-size: 0.8125rem;
		margin-bottom: 0.375rem;
	}

	.kbk-scanner-manual-code {
		font-size: 0.9375rem;
		padding: 0.75rem;
		min-height: 44px;
	}

	.kbk-scanner-submit-code {
		width: 44px;
		height: 44px;
		min-width: 44px;
		min-height: 44px;
	}

	.kbk-scanner-submit-code .material-icons {
		font-size: 22px;
	}

	.kbk-scanner-torch {
		width: 45px;
		height: 45px;
		font-size: 1.25rem;
		bottom: 0.75rem;
		right: 0.75rem;
	}
}

/* Very small screens */
@media (max-height: 600px) {
	.kbk-scanner-viewfinder {
		flex: 1 1 auto;
		min-height: 0;
	}

	.kbk-scanner-result {
		min-height: 80px;
		padding: 0.75rem;
	}

	.kbk-scanner-result-title {
		font-size: 1.125rem;
	}

	.kbk-scanner-result-icon {
		width: 48px;
		height: 48px;
		margin-bottom: 0.5rem;
	}

	.kbk-scanner-result-icon .material-icons {
		font-size: 36px;
		width: 36px;
		height: 36px;
	}

	.kbk-scanner-result-details {
		font-size: 0.75rem;
		margin-top: 0.5rem;
	}

	.kbk-scanner-input-container {
		min-height: 80px;
		height: 80px;
		padding: 0.5rem;
		display: flex !important;
	}

	.kbk-scanner-input-label {
		font-size: 0.75rem;
		margin-bottom: 0.25rem;
	}

	.kbk-scanner-manual-code {
		font-size: 0.875rem;
		padding: 0.625rem;
		min-height: 40px;
	}

	.kbk-scanner-submit-code {
		width: 40px;
		height: 40px;
		min-width: 40px;
		min-height: 40px;
	}

	.kbk-scanner-submit-code .material-icons {
		font-size: 20px;
	}
}
