/* ===============================
   RESET E CONFIGURAÇÕES GLOBAIS
   =============================== */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 20px;

}

/* ===============================
   CONTAINER PRINCIPAL
   =============================== */
.facial-detection-root {
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	padding: 40px;
	max-width: 600px;
	width: 100%;
	text-align: center;
	position: relative;
	overflow: hidden;
	margin: 0 auto; /* centraliza sem flex */
}

.facial-detection-root::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, #3b82f6, #2563eb, #1d4ed8);
}

/* ===============================
   TÍTULO
   =============================== */
.facial-detection-title {
	color: #1e40af;
	font-size: 28px;
	font-weight: 600;
	margin-bottom: 30px;
	letter-spacing: -0.5px;
}

/* ===============================
   BOTÃO PRINCIPAL
   =============================== */
.facial-detection-start {
	background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
	color: #ffffff;
	border: none;
	border-radius: 12px;
	padding: 16px 40px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.facial-detection-start:hover {
	background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
	box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
	transform: translateY(-2px);
}

.facial-detection-start:active {
	transform: translateY(0);
	box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

.facial-detection-start:disabled {
	background: #cbd5e1;
	cursor: not-allowed;
	box-shadow: none;
}

/* ===============================
   QR CODE
   =============================== */
#biometry-qrcode {
	margin: 30px 0;
	padding: 30px;
	background: #f1f5f9;
	border-radius: 12px;
	border: 2px dashed #3b82f6;
}

.biometry-qrcode-hint {
	color: #1e40af;
	font-size: 14px;
	font-weight: 500;
	margin-bottom: 20px;
}

#biometry-qrcode canvas {
	margin: 0 auto;
	display: block;
	border-radius: 8px;
	background: white;
	padding: 10px;
}
/* ===============================
   CONTAINER DA CÂMERA (CORRIGIDO)
   =============================== */
.facial-camera-container {
	display: none; /* começa escondido */
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4; /* mantém proporção estável */
	margin: 30px 0;
	border-radius: 16px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Vídeo e canvas SOBREPOSTOS */
.facial-camera-container video,
.facial-camera-container canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Ordem correta */
.facial-camera-container video {
	z-index: 1;
}

.facial-camera-container canvas {
	z-index: 2;
	pointer-events: none;
}

/* Moldura */
.facial-camera-container::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 3px solid #3b82f6;
	border-radius: 16px;
	pointer-events: none;
	z-index: 3;
}

/* ===============================
   MENSAGENS DE STATUS
   =============================== */
.facial-status-text {
	margin-top: 20px;
	padding: 16px 24px;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 500;
	min-height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.facial-status-text:empty {
	display: none;
}

.facial-status-text.status-info {
	background: #dbeafe;
	color: #1e40af;
	border-left: 4px solid #3b82f6;
}

.facial-status-text.status-success {
	background: #d1fae5;
	color: #065f46;
	border-left: 4px solid #10b981;
}

.facial-status-text.status-warning {
	background: #fef3c7;
	color: #92400e;
	border-left: 4px solid #f59e0b;
}

.facial-status-text.status-error {
	background: #fee2e2;
	color: #991b1b;
	border-left: 4px solid #ef4444;
}

/* ===============================
   LOADING
   =============================== */
.loading-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid rgba(59, 130, 246, 0.3);
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
	margin-right: 10px;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* ===============================
   RESPONSIVIDADE
   =============================== */
@media (max-width: 768px) {
	.facial-detection-root {
		padding: 30px 20px;
	}

	.facial-detection-title {
		font-size: 24px;
	}
}

@media (max-width: 480px) {
	body {
		padding: 10px;
	}

	.facial-detection-root {
		padding: 25px 15px;
	}

	.facial-detection-title {
		font-size: 22px;
	}
}

/* ===============================
   ESTADOS DO MODO
   =============================== */
.facial-detection-root[data-mode="scanning"] .facial-detection-start {
	display: none;
}

.facial-detection-root[data-mode="processing"] {
	pointer-events: none;
	opacity: 0.8;
}

/* ===============================
   ANIMAÇÕES
   =============================== */
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.facial-camera-container,
.facial-status-text {
	animation: fadeIn 0.4s ease;
}


.facial-camera-text {
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 20;

	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	padding: 8px 14px;
	border-radius: 6px;
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;

	pointer-events: none;
}
