/* Main container */
body {
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on input focus in iOS */
input,
select,
textarea {
	font-size: 16px;
}

/* Map container styling */
#mapContainer {
	height: 90vh;
	position: relative;
	z-index: 1;
}

@media (min-width: 992px) {
	#mapContainer {
		height: 500px;
	}
}

@media (max-width: 768px) {
	#mapContainer {
		height: 70vh;
	}
}

/* Custom marker styling */
.marker-number {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, #282f6c 0%, #7d85b5 100%);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 15px;
	border: 3px solid white;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: transform 0.2s;
}

.marker-number:hover,
.marker-number:active {
	transform: scale(1.15);
}

/* @media (max-width: 768px) {
	.marker-number {
		width: 40px;
		height: 40px;
		font-size: 17px;
		border: 4px solid white;
	}
} */

/* Loading animation */
@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* Data panel collapsible */
#dataPanel {
	transition: all 0.3s ease-in-out;
}

#dataPanel.minimized {
	max-width: 80px !important;
	flex: 0 0 80px !important;
}

#dataPanel.minimized section {
	padding: 1rem 0.5rem !important;
	display: flex;
	flex-direction: column;
	align-items: center;
}

#mapPanel {
	transition: all 0.3s ease-in-out;
}

#dataPanelContent {
	transition: opacity 0.2s;
	overflow: hidden;
}

/* Botón de recentrar ubicación */
#recenterButton {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1000;
	width: 40px;
	height: 40px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: white;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	outline: none;
}

#recenterButton i {
	font-size: 20px;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
}

#recenterButton:hover {
	background-color: #f8f9fa;
	border-color: #4285f4;
}

#recenterButton:hover i {
	color: #4285f4;
}

#recenterButton:active {
	transform: scale(0.95);
}

#dataPanel.minimized h5 {
	writing-mode: vertical-rl;
	text-orientation: mixed;
	margin: 1rem 0;
}

.leaflet-control-layers {
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	border: 2px solid #1e2c49;
}

.leaflet-control-layers-toggle {
	background-color: white;
	width: 35px;
	height: 35px;
	border-radius: 8px;
}

.leaflet-control-layers-expanded {
	padding: 12px;
	min-width: 180px;
}

.leaflet-control-layers-base label {
	display: flex;
	align-items: center;
	padding: 8px 4px;
	cursor: pointer;
	font-size: 14px;
	color: #1e2c49;
	font-weight: 500;
	transition: background-color 0.2s;
	border-radius: 4px;
}

.leaflet-control-layers-base label:hover {
	background-color: #f0f4ff;
}

.leaflet-control-layers-base input[type="radio"] {
	margin-right: 8px;
	cursor: pointer;
	accent-color: #1e2c49;
}

.leaflet-control-layers-separator {
	height: 0;
	border-top: 1px solid #e0e0e0;
	margin: 8px 0;
}

@media (max-width: 768px) {
	.leaflet-control-layers-expanded {
		font-size: 16px;
		min-width: 200px;
	}

	.leaflet-control-layers-base label {
		padding: 12px 6px;
		font-size: 15px;
	}
}

/* Animations */
@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes shake {
	0%,
	100% {
		transform: translateX(0);
	}
	10%,
	30%,
	50%,
	70%,
	90% {
		transform: translateX(-5px);
	}
	20%,
	40%,
	60%,
	80% {
		transform: translateX(5px);
	}
}

#resultsCard {
	animation: slideIn 0.5s ease-out;
}

#responseSection .card,
#failedSection .card {
	animation: fadeIn 0.6s ease-in;
}

#errorContainer {
	animation: shake 0.5s;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
	.btn {
		touch-action: manipulation;
	}
}

.loading {
	font-family: "Arial Black", "Arial Bold", Gadget, sans-serif;
	text-transform: uppercase;

	width: 150px;
	text-align: center;
	line-height: 50px;

	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	margin: auto;
	transform: translateY(-50%);
}

.loading span {
	position: relative;
	z-index: 999;
	color: #fff;
}
.loading:before {
	content: "";
	background: var(--orange-pci);
	width: 150px;
	height: 36px;
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: auto;

	animation: 3s loadingBefore infinite ease-in-out;
}

@keyframes loadingBefore {
	0% {
		transform: translateX(-14px);
	}
	50% {
		transform: translateX(14px);
	}
	100% {
		transform: translateX(-14px);
	}
}

.loading:after {
	content: "";
	background: #087333;
	width: 14px;
	height: 60px;
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: auto;
	opacity: 0.5;

	animation: 3s loadingAfter infinite ease-in-out;
}

@keyframes loadingAfter {
	0% {
		transform: translateX(-50px);
	}
	50% {
		transform: translateX(50px);
	}
	100% {
		transform: translateX(-50px);
	}
}

.status-loading-text {
	position: absolute;
	width: 100%;
	text-align: center;
	top: 60%;
	left: 0;
	right: 0;
	margin: auto;
	transform: translateY(-50%);
}

#recenterButton {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1000;
	width: 40px;
	height: 40px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: white;
	border-radius: 4px;
	cursor: pointer;
	font-size: 20px;
	color: #666;
}

#recenterButton:hover {
	color: #4285f4;
	background-color: #f8f9fa;
}

#recenterButton:active {
	transform: scale(0.95);
}

/* Estilos para el escáner de códigos de barras */
#scannerContainer {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.85);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 100;
	transition: opacity 0.3s ease-in-out;
	opacity: 0;
	pointer-events: none;
}

#scannerContainer.active {
	opacity: 1;
	pointer-events: auto;
}

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

#scannerContainer canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

#cancelScanButton {
	z-index: 1100;
	position: absolute;
	top: 1rem;
	right: 1rem;
}

#cancelScanButton:hover {
	cursor: pointer;
	color: #c43f4e;
}

#scanArea {
	position: absolute;
	top: 30%;
	left: 10%;
	width: 80%;
	height: 30%;
	border: 3px solid rgba(255, 255, 255, 0.85);
	border-radius: 15px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.75);
	box-sizing: border-box;
	z-index: 1100;
	pointer-events: none;
	animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
	0% {
		border-color: rgba(255, 255, 255, 0.8);
		box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	}
	50% {
		border-color: rgba(0, 255, 0, 0.75);
		box-shadow: 0 0 25px rgba(0, 255, 0, 0.5);
	}
	100% {
		border-color: rgba(255, 255, 255, 0.8);
		box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	}
}

/* ========================================
   Text Scanner OCR (Modular - puede eliminarse)
   ======================================== */
#textScannerContainer {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.9);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 100;
	transition: opacity 0.3s ease-in-out;
	opacity: 0;
	pointer-events: none;
}

#textScannerContainer.active {
	opacity: 1;
	pointer-events: auto;
}

#textScannerVideo {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Guía visual para el escáner */
.scanner-guide {
	width: 250px;
	height: 150px;
	border: 3px solid rgba(255, 255, 255, 0.8);
	border-radius: 8px;
	position: relative;
	margin: 0 auto;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-guide::before,
.scanner-guide::after {
	content: "";
	position: absolute;
	width: 20px;
	height: 20px;
	border: 3px solid #00ff00;
}

.scanner-guide::before {
	top: -3px;
	left: -3px;
	border-right: none;
	border-bottom: none;
}

.scanner-guide::after {
	top: -3px;
	right: -3px;
	border-left: none;
	border-bottom: none;
}

.scanner-guide {
	animation: scanner-pulse 2s infinite;
}

@keyframes scanner-pulse {
	0%,
	100% {
		border-color: rgba(255, 255, 255, 0.8);
	}
	50% {
		border-color: rgba(0, 255, 0, 0.8);
	}
}

#scanArea {
	position: absolute;
	top: 30%; /* Coincide con Quagga */
	left: 10%; /* Coincide con Quagga */
	width: 80%; /* Calculado como (100% - 10% - 10%) */
	height: 30%; /* Ajustado para la altura */
	border: 3px solid rgba(255, 255, 255, 0.85);
	border-radius: 15px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.75);
	box-sizing: border-box;
	z-index: 1100;
	pointer-events: none;
	animation: pulseBorder 1.5s infinite;
	/* backdrop-filter: blur(5px); Efecto de desenfoque en lo que no está dentro del área */
}

#videoContainer::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7); /* Oscurece el fondo */
	backdrop-filter: blur(5px); /* Desenfoque suave */
	z-index: 1000;
	pointer-events: none;
}

/* "Recortamos" el área de escaneo para que quede clara */
#videoContainer::after {
	content: "";
	position: absolute;
	top: 40%;
	left: 20%;
	width: 60%;
	height: 20%;
	border-radius: 15px;
	background-color: transparent;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
	z-index: 1001;
	pointer-events: none;
}

/* Animación elegante en los bordes */
@keyframes pulseBorder {
	0% {
		border-color: rgba(255, 255, 255, 0.8);
		box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	}
	50% {
		border-color: rgba(0, 255, 0, 0.75); /* Verde claro al pulso */
		box-shadow: 0 0 25px rgba(0, 255, 0, 0.5);
	}
	100% {
		border-color: rgba(255, 255, 255, 0.8);
		box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	}
}

/* Estilos para el overlay offline del mapa */
.leaflet-offline-control {
	margin-top: 10px !important;
	animation: slideInDown 0.5s ease-out;
}

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

/* Estilos adicionales para tiles offline */
.leaflet-tile-container img {
	image-rendering: auto;
	image-rendering: crisp-edges;
	image-rendering: -moz-crisp-edges;
	image-rendering: -webkit-optimize-contrast;
}

/* Botón de pantalla completa en el mapa */
#fullscreenMapButton {
	position: absolute;
	top: 60px;
	right: 10px;
	z-index: 1000;
	width: 40px;
	height: 40px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: white;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	outline: none;
}

#fullscreenMapButton i {
	font-size: 18px;
	color: #333;
}

#fullscreenMapButton:hover {
	background-color: #f8f9fa;
	border-color: #1e2c49;
}

#fullscreenMapButton:hover i {
	color: #1e2c49;
}

#fullscreenMapButton:active {
	transform: scale(0.95);
}

/* Overlay de pantalla completa */
.fullscreen-map-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: #1e2c49;
	z-index: 9999;
	display: none;
	flex-direction: column;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

.fullscreen-map-overlay.active {
	display: flex;
	opacity: 1;
}

.fullscreen-map-header {
	background: linear-gradient(135deg, #1e2c49 0%, #2a3f6f 100%);
	color: white;
	padding: 12px 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	z-index: 10001;
}

#fullscreenMapContainer {
	flex: 1;
	position: relative;
	width: 100%;
	overflow: hidden;
}

.fullscreen-map-controls {
	background: linear-gradient(135deg, #1e2c49 0%, #2a3f6f 100%);
	padding: 12px 16px;
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
	z-index: 10001;
}

/* Indicador de guardado */
.capturing-indicator {
	display: none;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10002;
	text-align: center;
	background: rgba(0, 0, 0, 0.8);
	padding: 2rem;
	border-radius: 10px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mostrar indicador y ocultar controles en modo captura */
.fullscreen-map-overlay.capturing .capturing-indicator {
	display: block !important;
}

.fullscreen-map-overlay.capturing .fullscreen-map-header,
.fullscreen-map-overlay.capturing .fullscreen-map-controls {
	display: none !important;
}

/* Ajustes responsive */
@media (max-width: 576px) {
	.fullscreen-map-header {
		padding: 10px 12px;
		font-size: 14px;
	}

	.fullscreen-map-controls {
		padding: 10px 12px;
	}

	#fullscreenManualMetersInput {
		font-size: 16px;
	}
}

.fullscreen-map-overlay .badge {
	font-size: 0.9rem;
	padding: 0.4em 0.8em;
}

#fullscreenDistanceDisplay {
	margin-bottom: 0.5rem;
	background-color: rgba(8, 115, 51, 0.9) !important;
	border: none;
	color: white;
}

#fullscreenDistanceDisplay .badge {
	font-size: 1.3rem;
	padding: 0.5em 1em;
}

#openHelpPanelBtn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid rgba(255, 255, 255, 0.3);
	background-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(8px);
	transition: all 0.25s ease;
}

#openHelpPanelBtn i {
	font-size: 1.1rem;
}

#openHelpPanelBtn:hover {
	background-color: rgba(255, 255, 255, 0.2);
	border-color: rgba(255, 255, 255, 0.5);
	color: white;
	transform: scale(1.05);
}

#openHelpPanelBtn:active {
	transform: scale(0.98);
	background-color: rgba(255, 255, 255, 0.15);
}

#openHelpPanelBtn:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

#helpOffcanvas {
	width: 400px !important;
}

#helpOffcanvas .offcanvas-body {
	padding: 0;
}

#helpOffcanvas .accordion-item {
	border: none;
	border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

#helpOffcanvas .accordion-item:last-child {
	border-bottom: none;
}

#helpOffcanvas .accordion-button {
	font-weight: 500;
	padding: 1rem 1.25rem;
}

#helpOffcanvas .accordion-button:not(.collapsed) {
	background-color: #e7f1ff;
	color: #1e2c49;
}

#helpOffcanvas .accordion-button:focus {
	box-shadow: none;
	border-color: rgba(0, 0, 0, 0.125);
}

#helpOffcanvas .accordion-body {
	padding: 1.25rem;
	font-size: 0.95rem;
	line-height: 1.6;
}

@media (max-width: 576px) {
	#helpOffcanvas {
		width: 85vw !important;
	}

	#helpOffcanvas .accordion-button {
		font-size: 0.9rem;
		padding: 0.875rem 1rem;
	}

	#helpOffcanvas .accordion-body {
		padding: 1rem;
		font-size: 0.875rem;
	}
}

.manual-section {
	background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
	border-radius: 0;
}

.manual-section .bi-file-earmark-pdf {
	opacity: 0.9;
	filter: drop-shadow(0 2px 4px rgba(220, 53, 69, 0.2));
}

#downloadManualBtn {
	border-width: 2px;
	font-weight: 500;
	padding: 0.5rem 1.25rem;
	transition: all 0.3s ease;
	border-radius: 8px;
}

#downloadManualBtn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

#downloadManualBtn:active {
	transform: translateY(0);
}

/* WhatsApp Contact Buttons */
#helpSection7 .btn-success {
	width: 36px;
	height: 36px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.3s ease;
}

#helpSection7 .btn-success:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
}

#helpSection7 .btn-success:active {
	transform: scale(0.95);
}

#helpSection7 .btn-success i {
	font-size: 1.1rem;
}

#helpSection7 ul li {
	padding: 0.75rem;
	border-radius: 8px;
	transition: background-color 0.2s ease;
}

#helpSection7 ul li:hover {
	background-color: rgba(13, 110, 253, 0.05);
}

#responseSection .card {
	background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#responseSection .card .bi {
	font-size: 1.25rem;
}

#responseSection .card strong {
	font-size: 1.05rem;
	color: #1e2c49;
	display: block;
	margin-top: 0.25rem;
	word-break: break-word;
}
