/**
 * Floor Plan Widget Styles
 */

/* Floor Plan Container */
.ts-floor-plan-container {
	position: relative;
	width: 100%;
}

.ts-floor-plan {
	position: relative;
	width: 100%;
	height: 600px;
	/* Default fixed height */
	overflow: visible;
	/* Allow popups to overlay */
	background: #f5f5f5;
	border-radius: 8px;
}

.ts-floor-plan--auto {
	height: auto !important;
}

.fp-image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	border-radius: inherit;
}

.ts-floor-plan--auto .fp-image {
	height: auto;
	object-fit: cover;
	/* Or just default, since height is auto */
}

/* Markers Container */
.fp-markers-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	overflow: visible;
	/* Ensure popups are not cut off */
}

/* Marker Base Styles */
.fp-marker {
	position: absolute;
	transform: translate(-50%, -50%);
	cursor: pointer;
	pointer-events: all;
	transition: transform 0.3s ease, z-index 0.3s ease;
	z-index: 10;
}

.fp-marker:hover {
	z-index: 20;
	transform: translate(-50%, -50%) scale(1.1);
}

.fp-marker-active {
	z-index: 30;
	transform: translate(-50%, -50%) scale(1.2);
}

/* Icon Marker */
.fp-marker-icon {
	width: 25px;
	height: 25px;
	background-color: #ff0000;
	color: #ffffff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fp-marker-colored {
	color: #ffffff !important;
}

.fp-marker-colored i {
	color: #ffffff !important;
}

.fp-marker-colored svg {
	fill: #ffffff !important;
}

.fp-marker-icon i,
.fp-marker-icon svg,
.fp-marker-icon .ts-svg {
	font-size: 16px;
	width: 16px;
	height: 16px;
	fill: #ffffff !important;
	color: #ffffff !important;
	stroke: #ffffff !important;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: auto;
	position: relative;
	z-index: 2;
}

.fp-marker-icon svg *,
.fp-marker-icon .ts-svg * {
	fill: #ffffff !important;
	stroke: #ffffff !important;
}

.ts-floor-plan .fp-marker-colored .ts-svg * {
	color: #ffffff !important;
	fill: #ffffff !important;
	stroke: #ffffff !important;
}

.fp-marker-svg {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	padding: 4px !important;
	filter: brightness(0) invert(1) !important;
	display: block !important;
}

/* Cluster Markers */
.fp-cluster {
	position: absolute;
	transform: translate(-50%, -50%);
	cursor: pointer;
	pointer-events: all;
	z-index: 15;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #6366f1, #8b5cf6);
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
	border: 3px solid rgba(255, 255, 255, 0.9);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fp-cluster:hover {
	transform: translate(-50%, -50%) scale(1.15);
	box-shadow: 0 6px 16px rgba(99, 102, 241, 0.6);
	z-index: 25;
}

.fp-cluster-count {
	color: #ffffff;
	font-weight: 700;
	font-size: 12px;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	line-height: 1;
}

/* Cluster Size Variants */
.fp-cluster-small {
	width: 36px;
	height: 36px;
}

.fp-cluster-small .fp-cluster-count {
	font-size: 12px;
}

.fp-cluster-medium {
	width: 44px;
	height: 44px;
}

.fp-cluster-medium .fp-cluster-count {
	font-size: 14px;
}

.fp-cluster-large {
	width: 52px;
	height: 52px;
}

.fp-cluster-large .fp-cluster-count {
	font-size: 16px;
}

/* Cluster Popup */
.fp-cluster-popup {
	min-width: 180px;
	max-width: 280px;
}

.fp-cluster-list {
	padding: 12px;
}

.fp-cluster-header {
	padding-bottom: 8px;
	margin-bottom: 8px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	color: #374151;
}

.fp-cluster-items {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 200px;
	overflow-y: auto;
}

.fp-cluster-item {
	padding: 6px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	cursor: pointer;
}

.fp-cluster-item:last-child {
	border-bottom: none;
}

.fp-cluster-item:hover {
	background-color: rgba(99, 102, 241, 0.1);
	margin: 0 -12px;
	padding: 6px 12px;
}

.fp-cluster-item a {
	color: #3b82f6;
	text-decoration: none;
	font-size: 13px;
}

.fp-cluster-item a:hover {
	text-decoration: underline;
}

/* Text Marker */
.fp-marker-text {
	background-color: #ff0000;
	color: #ffffff;
	padding: 6px 12px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Image Marker */
.fp-marker-image {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	border: 2px solid #ffffff;
}

.fp-marker-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Marker Popup */
.fp-marker-popup {
	position: absolute;
	transform: translate(-50%, calc(-100% - 15px));
	z-index: 10000;
	pointer-events: all;
	animation: fpPopupFadeIn 0.2s ease;
	width: 250px;
	min-width: 220px;
	max-width: 320px;
}

/* Popup Close Button */
.fp-popup-close {
	position: absolute;
	top: 0;
	right: 0;
	width: 26px;
	height: 26px;
	border: none;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	border-radius: 50%;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.15s;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.fp-popup-close:hover {
	background: rgba(0, 0, 0, 0.8);
	transform: scale(1.1);
}

.fp-marker-popup::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 8px solid transparent;
	border-top-color: #ffffff;
}

.fp-marker-popup.fp-popup-bottom {
	transform: translate(-50%, 45px) !important;
	animation: fpPopupFadeInBottom 0.2s ease;
}

.fp-marker-popup.fp-popup-bottom::after {
	top: auto !important;
	bottom: 100% !important;
	border-top-color: transparent !important;
	border-bottom-color: #ffffff !important;
}

@keyframes fpPopupFadeInBottom {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(55px);
	}

	to {
		opacity: 1;
		transform: translateX(-50%) translateY(45px);
	}
}


.fp-marker-popup .ts-preview {
	background: #ffffff;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
	overflow: hidden;
}

.fp-marker-popup .ts-preview-details {
	padding: 12px 15px 0;
}

.fp-marker-popup .ts-preview-details h4 {
	margin: 0;
	font-size: var(--e-global-typography-text-font-size, 15px);
	line-height: 1.4;
	font-weight: 600;
	color: var(--ts-shade-1, #1f2937);
	word-wrap: break-word;
}

.fp-marker-popup .ts-preview-actions {
	padding: 10px 15px 15px;
}

.fp-marker-popup .ts-preview-actions .ts-btn {
	height: 38px;
	font-size: 14px;
	width: 100%;
}

@keyframes fpPopupFadeIn {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-5px);
	}

	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* Floor Plan Picker (for admin/frontend form) */
.fp-picker-container {
	position: relative;
	margin-bottom: 20px;
}

.fp-picker-image-wrapper {
	position: relative;
	width: 100%;
	max-width: 800px;
	margin-bottom: 15px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
}

.fp-picker-image {
	width: 100%;
	height: auto;
	display: block;
	cursor: crosshair;
}

.fp-current-marker {
	position: absolute;
	width: 20px;
	height: 20px;
	background-color: #ef4444;
	border: 2px solid #ffffff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	pointer-events: none;
	display: none;
	z-index: 10;
	animation: fpMarkerPulse 1.5s ease-in-out infinite;
}

@keyframes fpMarkerPulse {

	0%,
	100% {
		box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3), 0 0 0 0 rgba(239, 68, 68, 0.4);
	}

	50% {
		box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3), 0 0 0 10px rgba(239, 68, 68, 0);
	}
}

.fp-coordinates-display {
	padding: 10px 15px;
	background: #f9fafb;
	border-radius: 6px;
	font-size: 14px;
	color: #6b7280;
	margin-bottom: 15px;
}

.fp-coordinates-display strong {
	color: #1f2937;
	font-weight: 600;
}

.fp-coordinate-inputs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 15px;
}

.fp-coordinate-input {
	display: flex;
	flex-direction: column;
}

.fp-coordinate-input label {
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 5px;
}

.fp-coordinate-input input {
	padding: 8px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 14px;
}

.fp-coordinate-input input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Loading State */
.fp-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: #6b7280;
	font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
	.fp-marker-popup {
		min-width: 150px;
		padding: 10px 12px;
	}

	.fp-marker-popup .ts-preview-details h4 {
		font-size: 13px;
	}

	.fp-marker-popup .ts-btn {
		font-size: 12px;
	}

	.fp-coordinate-inputs {
		grid-template-columns: 1fr;
	}
}

/* Floor Plan Label */
.fp-floor-label {
	position: absolute;
	top: 100%;
	bottom: auto;
	margin-top: 15px;
	margin-bottom: 0px;
	left: 50%;
	transform: translateX(-50%);
	background-color: rgba(255, 255, 255, 0.9);
	padding: 8px 16px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	color: #1f2937;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	z-index: 9999;
	pointer-events: none;

	white-space: nowrap;
}

/* Zoom Controls - Fixed to viewport so they stay visible in popups */
.fp-zoom-controls {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: all;
}

.fp-zoom-btn {
	width: 36px;
	height: 36px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	transition: all 0.2s ease;
	color: #374151;
}

.fp-zoom-btn:hover {
	background: #f9fafb;
	border-color: #d1d5db;
	transform: translateY(-1px);
	box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.1), 0 3px 6px -1px rgba(0, 0, 0, 0.06);
}

.fp-zoom-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
	background: #f3f4f6;
}

.fp-zoom-btn svg,
.fp-zoom-btn i {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

/* Reset button - slightly different style to distinguish */
.fp-zoom-btn.fp-zoom-reset {
	border-top: 1px dashed #d1d5db;
	margin-top: 4px;
}

/* Ensure controls don't overlap with label if it's at the bottom */
.fp-marker-popup.fp-popup-bottom~.fp-zoom-controls {
	bottom: 80px;
}

/* Mobile-optimized zoom controls */
@media (max-width: 768px) {
	.fp-zoom-controls {
		bottom: 15px;
		right: 15px;
		flex-direction: row;
		gap: 10px;
	}

	.fp-zoom-btn {
		width: 44px;
		height: 44px;
		border-radius: 10px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	}

	.fp-zoom-btn svg,
	.fp-zoom-btn i {
		width: 22px;
		height: 22px;
		font-size: 22px;
	}

	.fp-zoom-btn.fp-zoom-reset {
		border-top: none;
		border-left: 1px dashed #d1d5db;
		margin-top: 0;
	}
}

/* Floor Plan / Feed Switcher Button */
.vfp-switcher-btn {
	width: 100%;
	display: inline-flex;
	position: fixed;
	justify-content: center;
	bottom: 90px;
	z-index: 600;
	left: 0;
	pointer-events: none;
}

.vfp-switcher-btn .ts-btn {
	width: auto;
	background: #fff;
	pointer-events: all;
	padding: 10px 20px;
	border: 1px solid var(--ts-shade-3, #bfc3c8);
	border-radius: 7px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: var(--e-global-typography-text-font-size, 15px);
	color: var(--ts-shade-2, #797a88);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
}

.vfp-switcher-btn .ts-btn:hover {
	border-color: var(--ts-shade-2, #797a88);
	color: var(--ts-shade-1, #313135);
}

.vfp-switcher-btn .ts-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
	flex-shrink: 0;
}

/* Hide switcher when disabled via breakpoint */
@media (min-width: 1025px) {
	.vfp-switcher-btn.vfp-hidden-desktop {
		display: none !important;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.vfp-switcher-btn.vfp-hidden-tablet {
		display: none !important;
	}
}

@media (max-width: 767px) {
	.vfp-switcher-btn.vfp-hidden-mobile {
		display: none !important;
	}

	/* Prevent button from expanding to 100% width on mobile */
	.vfp-switcher-btn .ts-btn {
		width: auto !important;
		max-width: fit-content !important;
	}
}