/* Map View Styles */
.eem-app-wrapper.eem-map-container {
	position: relative;
	width: 100%;
	height: 600px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.eem-map-tabs {
	position: absolute;
	top: 20px;
	left: 20px;
	display: flex;
	gap: 10px;
	z-index: 60;
	flex-wrap: wrap;
	max-width: calc(100% - 40px);
	align-items: flex-start;
}

.eem-tab-btn {
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(8px);
	border: 1px solid var(--eem-primary); /* Use primary color for border */
	padding: 8px 20px;
	cursor: pointer;
	border-radius: 30px;
	font-weight: 600;
	color: var(--eem-primary); /* Use primary color for text */
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	font-size: 13px;
	white-space: nowrap;
}

.eem-tab-btn:hover:not(.active) {
	background: var(--eem-primary);
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.eem-tab-btn.active {
	background: var(--eem-primary);
	color: #fff;
	border-color: var(--eem-primary);
	box-shadow: 0 8px 20px rgba(0,0,0,0.25);
	font-weight: 700;
	text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.eem-svg-viewport {
	position: relative;
	flex: 1;
	overflow: hidden; /* Important for pinch-to-zoom */
	cursor: grab;
	touch-action: none; /* Prevent browser handling of touch gestures */
	background: #fafafa;
}

.eem-svg-viewport:active {
	cursor: grabbing;
}

.eem-svg-layer {
	width: 100%;
	height: 100%;
	transform-origin: 0 0;
}

.eem-svg-layer svg {
	width: 100%;
	height: 100%;
}

/* Make paths with IDs clickable */
.eem-svg-layer svg .eem-interactive-booth {
	cursor: pointer;
	transition: fill 0.2s;
}

.eem-svg-layer svg text {
	pointer-events: none;
}

.eem-map-static .eem-svg-layer svg .eem-interactive-booth {
	cursor: default;
	pointer-events: none;
}

.eem-svg-layer svg .eem-interactive-booth:hover {
	opacity: 0.8;
}

.eem-map-static .eem-svg-layer svg .eem-interactive-booth:hover {
	opacity: 1;
}

.eem-svg-layer svg .eem-active-booth,
.eem-svg-layer svg .eem-active-booth *:not(text) {
	/* !important is required: the uploaded hall-plan SVGs set fill via an
	   inline style="fill:...", which otherwise beats this class rule. */
	fill: var(--eem-primary) !important;
	fill-opacity: 0.85 !important;
}

.eem-svg-layer svg .eem-active-booth text {
	fill: #fff !important; /* Ensure text stands out if needed, or just let it inherit */
}

.eem-map-controls {
	position: absolute;
	bottom: 20px;
	right: 20px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	z-index: 50;
}

.eem-map-controls button {
	width: 44px;
	height: 44px;
	font-size: 20px;
	color: #333;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	padding: 0;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(5px);
	border: 1px solid rgba(0,0,0,0.05);
	border-radius: 50%;
	transition: all 0.2s;
}

.eem-map-controls button:hover {
	background: var(--eem-primary);
	color: #fff;
	border-color: var(--eem-primary);
	transform: scale(1.05);
}

.eem-map-controls button:hover .dashicons {
	color: #fff;
}

/* Smart Sheet UI */
.eem-smart-sheet {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	border-radius: 20px 20px 0 0;
	box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
	transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
	z-index: 100;
	display: none;
	flex-direction: column;
	max-height: 80%;
	pointer-events: none;
	visibility: hidden;
	transform: translateY(100%);
	opacity: 0;
}

.eem-smart-sheet.active {
	display: flex !important;
	bottom: 0;
	pointer-events: auto !important;
	visibility: visible !important;
	transform: translateY(0) !important;
	opacity: 1 !important;
}

.eem-sheet-handle {
	width: 40px;
	height: 5px;
	background: #ccc;
	border-radius: 5px;
	margin: 10px auto;
}

.eem-sheet-close {
	position: absolute;
	top: 15px;
	right: 15px;
	bottom: auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #ffffff;
	border: 1px solid #e0e0e0;
	font-size: 24px !important;
	font-weight: 400 !important;
	font-family: Arial, Helvetica, sans-serif !important;
	line-height: 1 !important;
	color: #333333 !important;
	cursor: pointer;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 105;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: 0 4px 14px rgba(0,0,0,0.15);
	-webkit-appearance: none;
	appearance: none;
	outline: none;
}

.eem-sheet-close:hover {
	background: var(--eem-primary);
	color: #ffffff;
	border-color: var(--eem-primary);
	transform: rotate(90deg);
	box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}

@media (min-width: 768px) {
	.eem-sheet-close {
		top: 20px;
		right: 20px;
		bottom: auto;
	}
	html body .eem-modal .eem-map-modal-content.sheet-active .eem-modal-close,
	html body .eem-modal .eem-map-modal-content:has(.eem-smart-sheet.active) .eem-modal-close {
		right: 415px !important;
		transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
	}
}

.eem-sheet-content {
	padding: 0;
	overflow-y: auto;
}

.eem-sheet-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.3);
	transition: opacity 0.3s;
	z-index: 99;
	display: none;
}

.eem-sheet-overlay.active {
	display: block;
	opacity: 1;
	pointer-events: auto;
}

/* Desktop Side Panel */
@media (min-width: 768px) {
	.eem-smart-sheet {
		bottom: 0;
		right: -400px;
		left: auto;
		width: 400px;
		height: 100%;
		border-radius: 0;
		max-height: 100%;
		transform: none !important;
		opacity: 1 !important;
		transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
	}
	.eem-smart-sheet.active {
		display: flex !important;
		right: 0 !important;
		transform: none !important;
	}
	.eem-sheet-handle {
		display: none;
	}
}

.eem-sheet-content {
	padding: 0;
	overflow-y: auto;
}

.eem-sheet-header {
	display: flex;
	gap: 15px;
	padding: 20px 55px 20px 20px;
	background: #fcfcfc;
	border-bottom: 1px solid #eee;
	align-items: center;
	position: relative;
}

.eem-sheet-logo-wrap {
	width: 60px;
	height: 60px;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 5px;
	flex-shrink: 0;
}

.eem-sheet-logo {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.eem-sheet-main-info {
	flex: 1;
	min-width: 0;
	text-align: left;
}

.eem-sheet-title {
	margin: 0 0 5px 0;
	font-size: 1.25rem;
	color: #333;
	text-align: left;
	line-height: 1.35;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.eem-sheet-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	justify-content: flex-start;
}

.eem-sheet-body {
	padding: 20px;
}

.eem-sheet-meta-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 15px;
	margin-bottom: 15px;
}

.eem-meta-item {
	font-size: 0.9rem;
}

.eem-meta-item strong {
	display: block;
	color: #999;
	font-size: 0.75rem;
	text-transform: uppercase;
	margin-bottom: 2px;
}

.eem-sheet-locations {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 4px;
}

.eem-location-pill {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.2;
	border: 1px solid var(--eem-primary);
	background: #fff;
	color: var(--eem-primary);
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	outline: none;
	text-decoration: none;
	box-shadow: 0 1px 3px rgba(0,0,0,0.06);
	font-family: inherit;
}

.eem-location-pill:hover:not(.active) {
	background: var(--eem-primary);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.eem-location-pill.active {
	background: var(--eem-primary);
	color: #fff;
	border-color: var(--eem-primary);
	cursor: default;
	box-shadow: 0 2px 8px rgba(0,0,0,0.18);
	font-weight: 700;
}

.eem-smart-sheet .eem-badge-blue, 
.eem-smart-sheet .eem-badge-gray {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 50px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1;
	border: 1px solid transparent;
	box-sizing: border-box;
}

.eem-smart-sheet .eem-badge-blue {
	background: var(--eem-primary);
	color: #fff;
	border-color: var(--eem-primary);
}

.eem-smart-sheet .eem-badge-gray {
	background: #f0f0f1;
	color: #555;
	border-color: #e0e0e0;
}

.eem-sheet-desc {
	display: none;
	font-size: 0.85rem;
	color: #666;
	line-height: 1.5;
	margin-bottom: 20px;
}

@media (min-width: 768px) {
	.eem-sheet-desc {
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}

.eem-sheet-actions {
	display: flex;
	gap: 10px;
}

.eem-sheet-actions .eem-btn-action {
	height: 44px;
	padding: 0 20px;
	border-radius: 10px;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	border: none;
	transition: all 0.3s;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.eem-sheet-actions .eem-btn-primary {
	background: var(--eem-primary);
	color: #ffffff;
	flex: 0 1 auto;
	min-width: 140px;
	font-size: 14px;
	line-height: 1;
}

.eem-sheet-actions .eem-btn-primary:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.eem-sheet-actions .eem-btn-action.eem-btn-disabled,
.eem-sheet-actions button.eem-btn-disabled {
	background: #e2e8f0;
	color: #94a3b8;
	cursor: not-allowed;
	opacity: 0.75;
	transform: none;
	box-shadow: none;
}

.eem-sheet-actions .eem-btn-action.eem-btn-disabled:hover,
.eem-sheet-actions button.eem-btn-disabled:hover {
	background: #e2e8f0;
	color: #94a3b8;
	transform: none;
	opacity: 0.75;
}

.eem-sheet-actions .eem-btn-action.eem-fav-toggle {
	background: #f0f0f1;
	color: #999;
	width: 48px;
}

.eem-sheet-actions .eem-btn-action.eem-fav-toggle.active {
	background: #fff0f0;
	color: #ff4757;
}

/* Hover fuer den Favoriten-Button im Kartenblatt.
   Die beiden Regeln darueber sind mit drei bzw. vier Klassen spezifischer als
   das generische .eem-btn-action:hover aus eem-core.css - ohne eigene
   Hover-Regel bleibt der Button beim Ueberfahren daher unveraendert.
   Bewusst KEIN Volllaufen in der Primaerfarbe: Der Button bleibt in der roten
   Favoriten-Familie und wird nur eine Stufe kraeftiger. So bleibt der Wechsel
   ruhig, und der Hover zeigt zugleich, wohin der Klick fuehrt.
   Die Stufen: grau (neutral) -> blassrot (Hover) -> rot (Favorit). */
.eem-sheet-actions .eem-btn-action.eem-fav-toggle:hover {
	background: #fff5f5;
	color: #ff8a94;
}

/* Ist der Aussteller bereits Favorit, bleibt die Farbe stehen; nur der Grund
   wird eine Spur satter. */
.eem-sheet-actions .eem-btn-action.eem-fav-toggle.active:hover {
	background: #ffe3e6;
	color: #ff4757;
}

/* Share button: icon only, same footprint as the favorite toggle */
.eem-sheet-actions .eem-btn-action.eem-share-single-btn {
	background: #f0f0f1;
	color: var(--eem-primary);
	width: 48px;
	flex: 0 0 48px;
	padding: 0;
}

.eem-sheet-actions .eem-btn-action.eem-share-single-btn .eem-icon-svg {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	pointer-events: none;
}

.eem-sheet-actions .eem-btn-action.eem-share-single-btn .eem-icon-svg svg {
	width: 18px;
	height: 18px;
	display: block;
	fill: currentColor;
	pointer-events: none;
}

.eem-sheet-actions .eem-btn-action.eem-share-single-btn:hover,
.eem-sheet-actions .eem-btn-action.eem-share-single-btn.eem-active {
	background: var(--eem-primary);
	color: #fff;
}

/* Map Modal / Lightbox */
.eem-map-modal {
	/* Gleiche Spezifitaet wie .eem-modal (eem-core.css), aber spaeter geladen -
	   dieser Wert gewinnt also. Er lag mit 999995 unter der schwebenden
	   Suchleiste (2147483647), die dadurch ueber dem offenen Lightbox lag.
	   Beim Aendern den Wert in .eem-modal mitfuehren. */
	z-index: 2147483647;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.85);
	backdrop-filter: blur(5px);
	padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
	box-sizing: border-box;
}
html body .eem-modal .eem-map-modal-content {
	max-width: 95%;
	width: 1200px;
	height: 90vh;
	height: 90dvh;
	height: 90svh;
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
	background: #fff;
	border-radius: 12px;
}

/* Floating Layout for Map Modal (Desktop & Mobile) */
.eem-map-modal-content .eem-map-container {
	height: 100%;
	max-height: 100%;
	position: relative;
	display: block;
}
.eem-map-modal-content .eem-svg-viewport {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}
.eem-map-modal-content .eem-map-tabs {
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 10;
	background: transparent;
	padding: 0;
	box-shadow: none;
	display: flex;
	gap: 10px;
}
.eem-map-modal-content .eem-tab-btn {
	/* No overrides, use base .eem-tab-btn styles */
}
.eem-map-modal-content .eem-tab-btn.active {
	/* No overrides, use base .eem-tab-btn.active styles */
}

@media (max-width: 767px) {
	/* Hoehe bewusst mit derselben vh -> dvh -> svh Staffelung wie in der
	   Basisregel oben. Stand hier nur 90vh, war das Modal auf Mobilgeraeten
	   zu hoch: vh misst den LARGE viewport (Browserleisten eingefahren),
	   waehrend body.eem-modal-open das Scrollen sperrt und die Leisten
	   dadurch dauerhaft sichtbar bleiben. Die Unterkante des Smart Sheets
	   (Buttonzeile) lag deshalb hinter den Bedienelementen des Browsers. */
	html body .eem-modal .eem-map-modal-content {
		height: 90vh;
		height: 90dvh;
		height: 90svh;
		max-height: 90vh;
		max-height: 90dvh;
		max-height: 90svh;
		width: 95%;
		max-width: 95%;
		border-radius: 12px;
	}
}

html body .eem-modal .eem-map-modal-content .eem-modal-close {
	position: absolute;
	top: 15px;
	right: 15px;
	z-index: 999999;
	background: #fff;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(0,0,0,0.2);
	cursor: pointer;
	font-size: 28px;
	color: #333;
	transition: all 0.2s;
}
html body .eem-modal .eem-map-modal-content .eem-modal-close:hover {
	background: var(--eem-primary);
	color: #fff;
	transform: rotate(90deg);
}
.eem-map-modal-content .eem-map-container {
	flex: 1;
	border: none;
	border-radius: 0;
	height: 100%;
	background: #fdfdfd;
}

/* Loading State for SVG */
.eem-svg-layer.loading {
	opacity: 0.5;
	pointer-events: none;
}
.eem-svg-layer.loading::after {
	content: "Loading Plan...";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-weight: bold;
	color: var(--eem-primary);
}

/* Tab Dropdown Styles */
.eem-map-dropdown {
	position: relative;
	display: inline-block;
}

.eem-dropdown-menu {
	position: absolute;
	top: calc(100% + 5px);
	left: 0;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	border-radius: 15px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.15);
	min-width: 200px;
	z-index: 100;
	padding: 8px;
	display: none;
	opacity: 0;
	transform: translateY(10px);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border: 1px solid rgba(0,0,0,0.05);
}

.eem-map-dropdown.open .eem-dropdown-menu {
	display: block;
	opacity: 1;
	transform: translateY(0);
}

.eem-dropdown-item {
	padding: 12px 16px;
	cursor: pointer;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 600;
	color: #444;
	transition: all 0.2s;
	white-space: nowrap;
	margin-bottom: 2px;
}

.eem-dropdown-item:last-child {
	margin-bottom: 0;
}

.eem-dropdown-item:hover {
	background: var(--eem-secondary);
	color: var(--eem-primary);
}

.eem-dropdown-item.active {
	background: var(--eem-primary);
	color: #fff;
}

.eem-map-dropdown.open .eem-dropdown-arrow {
	transform: rotate(180deg);
}

.eem-dropdown-toggle {
	min-width: 180px;
	display: inline-flex;
	justify-content: space-between;
	align-items: center;
}
