/**
 * Estilos CSS para el sistema offline
 */

/* Indicador de estado de red */
.network-status {
	position: fixed;
	top: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 5px 10px;
	border-radius: 15px;
	font-size: 12px;
	z-index: 1000;
	transition: all 0.3s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.network-status.online {
	background: rgba(40, 167, 69, 0.9);
}

.network-status.offline {
	background: rgba(220, 53, 69, 0.9);
	animation: pulse 2s infinite;
}

@keyframes pulse {
	0% {
		opacity: 0.9;
	}
	50% {
		opacity: 0.6;
	}
	100% {
		opacity: 0.9;
	}
}

/* Alertas offline */
#offline-alerts {
	position: fixed;
	top: 70px;
	right: 20px;
	z-index: 1050;
	max-width: 400px;
}

#offline-alerts .alert {
	margin-bottom: 10px;
	border: none;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(10px);
	transform: translateX(100px);
	transition: all 0.3s ease;
}

/* Estilos específicos para alertas de estado */
#offline-alerts .alert-status {
	border: 2px solid #0d6efd !important;
	box-shadow: 0 6px 25px rgba(13, 110, 253, 0.3) !important;
	background: linear-gradient(135deg, #e7f3ff 0%, #f8f9ff 100%) !important;
	max-width: 450px;
}

/* Protección para alertas persistentes */
#offline-alerts .persistent-alert,
#offline-alerts .alert[data-persistent="true"] {
	/* Evitar que eventos externos afecten la alerta */
	pointer-events: auto !important;
	visibility: visible !important;
	opacity: 1 !important;
	display: block !important;
	position: relative !important;
	z-index: 1060 !important;

	/* Proteger contra cambios de estilo externos */
	transform: translateX(0) !important;
	transition: none !important;
}

/* Asegurar que SOLO el botón de cierre sea interactivo en alertas persistentes */
#offline-alerts .persistent-alert * {
	pointer-events: none;
}

#offline-alerts .persistent-alert .btn-close,
#offline-alerts .persistent-alert .btn-close-enhanced {
	pointer-events: auto !important;
}

.offline-status-detail h6 {
	color: #0d6efd;
	border-bottom: 1px solid #dee2e6;
	padding-bottom: 8px;
	margin-bottom: 15px;
	font-weight: 600;
}

.status-grid {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.status-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 6px 0;
	border-bottom: 1px solid rgba(13, 110, 253, 0.1);
}

.status-item:last-child {
	border-bottom: none;
}

.status-item strong {
	color: #495057;
	font-size: 14px;
}

.status-item .badge {
	font-size: 12px;
	padding: 4px 8px;
}

.status-actions {
	background: rgba(13, 110, 253, 0.05);
	border-radius: 6px;
	padding: 8px;
	margin-top: 10px;
}

.status-actions small {
	font-size: 12px;
	color: #6c757d;
}

/* Botón de cierre mejorado */
.btn-close-enhanced {
	background: rgba(220, 53, 69, 0.1);
	border-radius: 50%;
	width: 24px;
	height: 24px;
	opacity: 0.8;
	transition: all 0.2s ease;
	position: relative;
	border: none;
	cursor: pointer;
}

.btn-close-enhanced:hover {
	background: rgba(220, 53, 69, 0.2);
	opacity: 1;
	transform: scale(1.1);
}

.btn-close-enhanced:focus {
	outline: 2px solid #0d6efd;
	outline-offset: 2px;
}

/* Asegurar que los botones de cierre sean siempre visibles y funcionen */
#offline-alerts .alert .btn-close,
#offline-alerts .alert .btn-close-enhanced {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 10;
	width: 24px;
	height: 24px;
	background-color: rgba(220, 53, 69, 0.1);
	border: none;
	border-radius: 50%;
	opacity: 0.8;
	transition: all 0.2s ease;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

#offline-alerts .alert .btn-close:hover,
#offline-alerts .alert .btn-close-enhanced:hover {
	background-color: rgba(220, 53, 69, 0.2);
	opacity: 1;
	transform: scale(1.1);
}

/* Evitar que Bootstrap interfiera */
#offline-alerts .alert .btn-close:not(:disabled):not(.disabled):hover,
#offline-alerts .alert .btn-close:not(:disabled):not(.disabled):focus {
	opacity: 1 !important;
}

/* Asegurar que las alertas de estado sean persistentes */
#offline-alerts .alert-status {
	position: relative;
	pointer-events: all;
	animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

/* Indicador de estado de red */
.network-status {
	position: fixed;
	top: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 5px 10px;
	border-radius: 15px;
	font-size: 12px;
	z-index: 1000;
	transition: all 0.3s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.network-status.online {
	background: rgba(40, 167, 69, 0.9);
}

.network-status.offline {
	background: rgba(220, 53, 69, 0.9);
	animation: pulse 2s infinite;
}

@keyframes pulse {
	0% {
		opacity: 0.9;
	}
	50% {
		opacity: 0.6;
	}
	100% {
		opacity: 0.9;
	}
}

/* Controles offline */
.offline-controls {
	border: 1px solid #bee5eb;
	border-radius: 8px;
	background: linear-gradient(135deg, #d1ecf1 0%, #e2f3f5 100%);
	margin-bottom: 20px;
	padding: 15px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.offline-controls h6 {
	color: #0c5460;
	margin-bottom: 5px;
	font-weight: 600;
}

.offline-controls small {
	color: #5f6368;
	font-size: 0.85em;
}

.offline-controls .btn {
	margin: 5px 0;
	transition: all 0.2s ease;
}

.offline-controls .btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Barra de progreso de descarga */
.download-progress {
	margin-top: 10px;
	height: 20px;
	background-color: rgba(255, 255, 255, 0.3);
	border-radius: 10px;
	overflow: hidden;
}

.download-progress .progress-bar {
	height: 100%;
	background: linear-gradient(90deg, #007bff, #0056b3);
	transition: width 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 11px;
	font-weight: 500;
}

/* Alertas offline */
#offline-alerts {
	position: fixed;
	top: 70px;
	right: 20px;
	z-index: 1050;
	max-width: 400px;
}

#offline-alerts .alert {
	margin-bottom: 10px;
	border: none;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(10px);
}

/* Página offline */
.offline-page {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.offline-container {
	max-width: 500px;
	margin: 0 auto;
	background: white;
	padding: 40px;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	text-align: center;
}

.offline-icon {
	font-size: 64px;
	margin-bottom: 20px;
	opacity: 0.8;
}

.offline-container h1 {
	color: #2c3e50;
	margin-bottom: 15px;
	font-weight: 700;
}

.offline-container p {
	color: #6c757d;
	margin-bottom: 20px;
	line-height: 1.6;
}

.offline-container .btn {
	background: linear-gradient(135deg, #007bff, #0056b3);
	color: white;
	padding: 12px 24px;
	text-decoration: none;
	border-radius: 8px;
	display: inline-block;
	font-weight: 500;
	transition: all 0.3s ease;
}

.offline-container .btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
	text-decoration: none;
	color: white;
}

/* Modo offline activado */
.offline-mode-banner {
	background: linear-gradient(90deg, #ffc107, #fd7e14);
	color: #212529;
	padding: 8px 0;
	text-align: center;
	font-weight: 500;
	font-size: 14px;
	position: sticky;
	top: 0;
	z-index: 1030;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.offline-mode-banner i {
	margin-right: 8px;
}

/* Lista de pilones offline */
.pilones-offline {
	background: rgba(255, 255, 255, 0.95);
	border-radius: 8px;
	margin-top: 20px;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pilones-offline .list-group-item {
	border: none;
	border-bottom: 1px solid #e9ecef;
	transition: all 0.2s ease;
	padding: 15px 20px;
}

.pilones-offline .list-group-item:hover {
	background-color: #f8f9fa;
	transform: translateX(5px);
}

.pilones-offline .list-group-item:last-child {
	border-bottom: none;
}

.pilones-offline h5 {
	margin-bottom: 8px;
	color: #2c3e50;
	font-weight: 600;
}

.pilones-offline .mb-1 {
	color: #6c757d;
	line-height: 1.4;
}

.pilones-offline small {
	color: #007bff;
	font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
	.offline-controls {
		padding: 12px;
	}

	.offline-controls .d-flex {
		flex-direction: column;
		align-items: flex-start !important;
	}

	.offline-controls .btn {
		width: 100%;
		margin: 5px 0;
	}

	#offline-alerts {
		right: 10px;
		left: 10px;
		max-width: none;
	}

	.network-status {
		right: 10px;
		font-size: 11px;
		padding: 4px 8px;
	}

	.offline-container {
		margin: 20px;
		padding: 30px 20px;
	}
}

/* Animaciones suaves */
.offline-controls,
.pilones-offline .list-group-item,
#offline-alerts .alert {
	animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Estados de carga */
.btn.loading {
	position: relative;
	color: transparent;
}

.btn.loading::after {
	content: "";
	position: absolute;
	width: 16px;
	height: 16px;
	top: 50%;
	left: 50%;
	margin-left: -8px;
	margin-top: -8px;
	border: 2px solid transparent;
	border-top-color: currentColor;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Mejoras para el mapa offline */
.offline-map-notice {
	position: absolute;
	top: 10px;
	left: 10px;
	right: 10px;
	background: rgba(255, 193, 7, 0.95);
	color: #856404;
	padding: 10px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	z-index: 1000;
	text-align: center;
}

/* Tarjetas de información offline */
.info-card-offline {
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
	position: relative;
	overflow: hidden;
}

.info-card-offline::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, #007bff, #28a745);
}

.info-card-offline h3 {
	color: #495057;
	margin-bottom: 15px;
	font-weight: 600;
}

.info-card-offline p {
	color: #6c757d;
	line-height: 1.6;
	margin-bottom: 10px;
}

.info-card-offline strong {
	color: #495057;
}
