/**
 * Modal visualizzazione tracce GPX
 */
.tcl-gpx-modal {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	z-index: 99999999 !important; /* Aumentato per essere sopra qualsiasi header */
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	pointer-events: none;
}

.tcl-gpx-modal:not(.hidden) {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.tcl-gpx-modal.hidden {
	display: none;
}

.tcl-gpx-modal-overlay {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(2px);
	cursor: pointer;
	z-index: 99999998 !important; /* Sotto il content ma sopra tutto il resto */
}

.tcl-gpx-modal-content {
	position: relative;
	width: 90%;
	max-width: 1200px;
	max-height: 90vh;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 100000000 !important; /* Aumentato per essere sopra qualsiasi header */
	transform: scale(0.95);
	transition: transform 0.3s ease;
}

.tcl-gpx-modal:not(.hidden) .tcl-gpx-modal-content {
	transform: scale(1);
}

.tcl-gpx-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.5em 2em;
	border-bottom: 2px solid var(--awb-color3, #e2e8f0);
	background: var(--awb-color2, #f8f9fa);
}

.tcl-gpx-modal-title {
	margin: 0;
	font-size: 1.5em;
	font-weight: 600;
	color: var(--awb-color7, #1d2327);
	flex: 1;
}

.tcl-gpx-modal-close {
	background: none;
	border: none;
	font-size: 2em;
	line-height: 1;
	color: var(--awb-color6, #64748b);
	cursor: pointer;
	padding: 0;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s ease;
	margin-left: 1em;
}

.tcl-gpx-modal-close:hover {
	background: var(--awb-color3, #e2e8f0);
	color: var(--awb-color7, #1d2327);
}

.tcl-gpx-modal-tabs {
	display: flex;
	border-bottom: 2px solid var(--awb-color3, #e2e8f0);
	background: var(--awb-color2, #f8f9fa);
}

.tcl-gpx-tab-btn {
	flex: 1;
	padding: 1em 1.5em;
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	font-size: 1em;
	font-weight: 500;
	color: var(--awb-color6, #64748b);
	transition: all 0.2s ease;
	position: relative;
}

.tcl-gpx-tab-btn:hover {
	color: var(--awb-color7, #1d2327);
	background: rgba(0, 0, 0, 0.02);
}

.tcl-gpx-tab-btn.active {
	color: var(--awb-color7, #1d2327);
	border-bottom-color: var(--awb-color-primary, #2c5282);
	font-weight: 600;
	background: #fff;
}

.tcl-gpx-modal-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
	position: relative;
	min-height: 0;
}

.tcl-gpx-tab-content {
	display: none;
	flex: 1;
	flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
	min-height: 0;
	padding-bottom: 0;
}

.tcl-gpx-tab-content.active {
	display: flex;
}

.tcl-gpx-modal-loading {
	padding: 3em;
	text-align: center;
	color: var(--awb-color6, #64748b);
	font-size: 1.1em;
}

.tcl-gpx-modal-map {
	flex: 1 1 auto;
	min-height: 400px;
	width: 100%;
	display: block;
}

.tcl-gpx-modal-map-stats {
	padding: 1.5em 2em 2em 2em;
	margin-bottom: 1em;
	border-top: 2px solid var(--awb-color3, #e2e8f0);
	background: #fff;
	flex-shrink: 0;
}

.tcl-gpx-modal-map-stats .tcl-elevation-stats {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

.tcl-gpx-modal-map.leaflet-container {
	font-family: inherit;
	border-radius: 0;
}

/* Nascondi tutte le ombre dei marker nella mappa GPX */
.tcl-gpx-modal-map .leaflet-marker-shadow {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
}

/* Assicura che i marker personalizzati non abbiano ombre */
.tcl-gpx-modal-map .tcl-default-marker,
.tcl-gpx-modal-map .tcl-waypoint-marker,
.tcl-gpx-modal-map .tcl-start-marker,
.tcl-gpx-modal-map .tcl-end-marker,
.tcl-gpx-modal-map .tcl-gpx-waypoint-default {
	background: transparent !important;
	border: none !important;
}

/* Rimuovi box-shadow dai marker personalizzati se presente */
.tcl-gpx-modal-map .tcl-waypoint-marker div,
.tcl-gpx-modal-map .tcl-start-marker div,
.tcl-gpx-modal-map .tcl-end-marker div,
.tcl-gpx-modal-map .tcl-gpx-waypoint-default div {
	box-shadow: none !important;
}

.tcl-gpx-modal-info {
	padding: 1.5em 2em;
	border-top: 2px solid var(--awb-color3, #e2e8f0);
	background: var(--awb-color2, #f8f9fa);
	max-height: 200px;
	overflow-y: auto;
}

.tcl-gpx-modal-elevation {
	padding: 2em;
	padding-bottom: 2em;
	border-top: 2px solid var(--awb-color3, #e2e8f0);
	background: #fff;
}

/* Stili per i marker waypoint sulla mappa */
.tcl-waypoint-marker {
	background: transparent !important;
	border: none !important;
}

.tcl-waypoint-marker div {
	cursor: pointer;
	transition: transform 0.2s ease;
}

.tcl-waypoint-marker div:hover {
	transform: scale(1.2);
}

/* Stili per i marker di inizio e fine percorso */
.tcl-start-marker,
.tcl-end-marker {
	background: transparent !important;
	border: none !important;
}

.tcl-start-marker div,
.tcl-end-marker div {
	cursor: pointer;
	transition: transform 0.2s ease;
}

.tcl-start-marker div:hover,
.tcl-end-marker div:hover {
	transform: scale(1.15);
}
	overflow-x: auto;
	overflow-y: visible;
	flex: 1;
	min-height: 0;
}

.tcl-elevation-profile {
	width: 100%;
}

.tcl-elevation-profile h4 {
	margin: 0 0 1em;
	font-size: 1.1em;
	font-weight: 600;
	color: var(--awb-color7, #1d2327);
}

.tcl-elevation-chart {
	width: 100%;
	height: auto;
	min-width: 1000px;
	min-height: 300px;
	max-width: 100%;
	display: block;
	margin: 0 auto 1.5em;
	background: #fff;
	border-radius: 8px;
}

.tcl-elevation-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5em;
	margin-top: 1em;
	margin-bottom: 1em;
	padding-top: 1em;
	border-top: 1px solid var(--awb-color3, #e2e8f0);
}

.tcl-elevation-stat {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
}

.tcl-elevation-stat-label {
	font-size: 0.85em;
	color: var(--awb-color6, #64748b);
	font-weight: 500;
}

.tcl-elevation-stat-value {
	font-size: 1.1em;
	color: var(--awb-color7, #1d2327);
	font-weight: 600;
}

.tcl-gpx-info {
	margin-bottom: 1em;
}

.tcl-gpx-info:last-child {
	margin-bottom: 0;
}

.tcl-gpx-info h4 {
	margin: 0 0 0.5em;
	font-size: 1.1em;
	font-weight: 600;
	color: var(--awb-color7, #1d2327);
}

.tcl-gpx-info-item {
	margin: 0.5em 0;
	font-size: 0.95em;
	display: flex;
	gap: 0.5em;
}

.tcl-gpx-info-label {
	font-weight: 600;
	color: var(--awb-color6, #64748b);
}

.tcl-gpx-info-value {
	color: var(--awb-color7, #1d2327);
}

.tcl-gpx-error {
	padding: 2em;
	text-align: center;
	color: #e53e3e;
	font-weight: 500;
}

/* Pulsante Visualizza percorso */
.tcl-gpx-view-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.6em 1.25em;
	background: var(--awb-color4, #22c55e);
	color: var(--awb-color1, #fff) !important;
	border: none;
	border-radius: 10px;
	font-size: 0.95em;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.2s, box-shadow 0.2s;
	box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.tcl-gpx-view-btn:hover {
	background: var(--awb-color4, #22c55e);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
	color: var(--awb-color1, #fff) !important;
	text-decoration: none;
}

.tcl-gpx-view-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.tcl-gpx-view-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	line-height: 1;
}

.tcl-gpx-view-btn-icon svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
	fill: none;
}

/* Assicura che il modal sia sempre sopra l'header e qualsiasi altro elemento */
/* Forza header e footer sotto il modal GPX quando attivo */
body.tcl-gpx-modal-open .fusion-header-wrapper,
body.tcl-gpx-modal-open header,
body.tcl-gpx-modal-open .fusion-header,
body.tcl-gpx-modal-open .awb-header,
body.tcl-gpx-modal-open .fusion-sticky-header,
body.tcl-gpx-modal-open .fusion-header-sticky,
body.tcl-gpx-modal-open .fusion-secondary-header,
body.tcl-gpx-modal-open .fusion-mobile-menu-design-modern,
body.tcl-gpx-modal-open .fusion-mobile-menu-design-classic,
body.tcl-gpx-modal-open .fusion-header-outer-wrapper,
body.tcl-gpx-modal-open .fusion-header-inner-wrapper,
body.tcl-gpx-modal-open footer,
body.tcl-gpx-modal-open .fusion-footer,
body.tcl-gpx-modal-open .fusion-footer-wrapper,
body.tcl-gpx-modal-open #footer,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-header-wrapper,
body:has(.tcl-gpx-modal:not(.hidden)) header,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-header,
body:has(.tcl-gpx-modal:not(.hidden)) .awb-header,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-sticky-header,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-header-sticky,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-secondary-header,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-mobile-menu-design-modern,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-mobile-menu-design-classic,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-header-outer-wrapper,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-header-inner-wrapper,
body:has(.tcl-gpx-modal:not(.hidden)) footer,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-footer,
body:has(.tcl-gpx-modal:not(.hidden)) .fusion-footer-wrapper,
body:has(.tcl-gpx-modal:not(.hidden)) #footer {
	z-index: 1 !important; /* Forzato molto basso quando il modal è attivo */
	position: relative;
}

/* Assicura che il modal sia sopra qualsiasi elemento con z-index alto */
.tcl-gpx-modal:not(.hidden) {
	z-index: 99999999 !important;
}

.tcl-gpx-modal:not(.hidden) .tcl-gpx-modal-content {
	z-index: 100000000 !important;
}

.tcl-gpx-modal:not(.hidden) .tcl-gpx-modal-overlay {
	z-index: 99999998 !important;
}

/* Responsive */
@media (max-width: 768px) {
	.tcl-gpx-modal-content {
		width: 95%;
		max-height: 90vh;
	}
	
	.tcl-gpx-modal-tabs {
		flex-wrap: wrap;
	}
	
	.tcl-gpx-tab-btn {
		padding: 0.75em 1em;
		font-size: 0.9em;
		min-width: 50%;
	}
	
	.tcl-gpx-modal-map {
		min-height: 300px;
	}
	
	.tcl-gpx-modal-map-stats {
		padding: 1em 1.5em;
	}

	.tcl-gpx-modal-elevation {
		padding: 1em;
	}
	
	.tcl-elevation-chart {
		min-width: 100%;
		min-height: 250px;
	}

	.tcl-gpx-modal-header {
		padding: 1em 1.5em;
	}

	.tcl-gpx-modal-title {
		font-size: 1.2em;
	}

	.tcl-gpx-modal-info {
		padding: 1em 1.5em;
		max-height: 150px;
	}

	.tcl-gpx-modal-elevation {
		padding: 1em 1.5em;
	}

	.tcl-elevation-stats {
		flex-direction: column;
		gap: 1em;
	}

	.tcl-gpx-view-btn {
		margin-left: 0.5em;
		padding: 0.4em 0.8em;
		font-size: 0.85em;
	}
}
