.gallery-popup .main-content {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

#unit-mobile-gallery-slider {
	display: none;
}

#unit-gallery-grid.grid-layout {
	display: grid !important;
	/* TODO: Check whether there is a more elegant solution to stop everything from rendering before css is loaded*/
	grid-template-columns: repeat(4, 1fr);
	grid-template-rows: repeat(2, 1fr);
	padding: 0;
	margin: 0;
	list-style-type: none;
	overflow: hidden;
	grid-column-gap: 20px;
	grid-row-gap: 20px;
	padding-top: 26px;
}

#unit-gallery-grid.grid-layout img {
	height: 100%;
	width: 100%;
	object-fit: cover;
	border-radius: var(--beon-unit-gallery-border-radius);
}

#unit-gallery-grid.grid-layout button.unit-gallery-button,
#unit-mobile-gallery-slider button.unit-gallery-button {
	font: var(--beon-unit-gallery-button-font);
	color: var(--beon-unit-gallery-button-text-color);
	background-color: var(--beon-unit-gallery-button-bg-color);
	border: var(--beon-unit-gallery-button-border);
	border-radius: var(--beon-unit-gallery-button-border-radius);
	height: 45px !important;
	padding: 0 15px;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

#unit-gallery-grid.grid-layout button.unit-gallery-button img,
#unit-mobile-gallery-slider button.unit-gallery-button img {
	filter: var(--beon-unit-gallery-button-icon-filter);
	width: 12px;
	height: 12px;
	border-radius: 0;
}

#grundriss_btn img {
	width: 22px !important;
	height: 22px !important;
}

/* Gallery Pop up*/
.open-gallery-popup {
	cursor: pointer;
}

.gallery-popup {
	background-color: var(--beon-unit-gallery-popup-bg-color);
	height: 100%;
	max-height: 100%;
	width: 100vw;
	/*hides scrollbar, 100% does not*/
	max-width: 100vw;
	z-index: 10;
	/* display: flex; */
	/* flex-direction: column; */
	padding: 0px;
	overflow: auto;
	border: none;
}

button.gallery-popup-close {
	/* position: fixed; */
	top: 15px;
	right: 50px;
	cursor: pointer;
	height: 40px;
	width: 40px;
	border: none;
	background-color: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1;
	padding: 0px;
}

#grundriss-popup-close {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	top: 16px;
	right: calc(-1 * (100% - 16px));
	width: 32px;
	height: 32px;
	padding: 10px;
	cursor: pointer;
	border: var(--beon-popup-close-border);
	border-radius: var(--beon-popup-close-border-radius);
	box-shadow: var(--beon-popup-close-shadow);
	background-color: var(--beon-popup-close-bg-color);
}

button.gallery-popup-close:hover,
button.gallery-popup-close:focus {
	background-color: transparent;
	border: none;
}

.gallery-popup-close img {
	height: 20px;
	width: 20px;
	filter: var(--beon-unit-gallery-popup-close-icon-filter);
}

.gallery-popup-image-wrapper,
.gallery-popup-floorplan-wrapper,
.gallery-popup-decorative-wrapper {
	/* max-width: 1200px; */
	margin: 0 auto;
	padding: 30px;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 24px 24px;
	align-items: stretch;
	justify-items: stretch;
}

/* ROW 1 → 40% | 60% */
.gallery-popup-image:nth-child(4n + 1),
.grundriss-item:nth-child(4n + 1),
.decorative-detail-item:nth-child(4n + 1) {
	grid-column: span 2;
	/* make it larger */
}

.gallery-popup-image:nth-child(4n + 2),
.grundriss-item:nth-child(4n + 2),
.decorative-detail-item:nth-child(4n + 2) {
	grid-column: span 3;
}

/* ROW 2 → 60% | 40% */
.gallery-popup-image:nth-child(4n + 3),
.grundriss-item:nth-child(4n + 3),
.decorative-detail-item:nth-child(4n + 3) {
	grid-column: span 3;
}

.gallery-popup-image:nth-child(4n + 4),
.grundriss-item:nth-child(4n + 4),
.decorative-detail-item:nth-child(4n + 4) {
	grid-column: span 2;
}

/* .gallery-popup-image-wrapper .gallery-popup-image:nth-child(3n) {
	grid-column: span 2;
	grid-row: span 1;
} */

.gallery-popup-image,
.grundriss-item,
.decorative-detail-item {
	aspect-ratio: 16/8;
	width: 100%;
	overflow: hidden;
	border-radius: var(--beon-unit-gallery-border-radius);
}

.gallery-popup-image img,
.grundriss-item img,
.decorative-detail-item img {
	height: 100%;
	width: 100%;
	object-fit: cover;
	transition: filter ease-out 0.3s;
}

.gallery-popup-image img:hover,
.gallery-popup-image img:focus-visible,
.grundriss-item img:hover,
.grundriss-item img:focus-visible,
.decorative-detail-item img:hover,
.decorative-detail-item img:focus-visible {
	filter: brightness(0.7);
}

/*TODO Check for errors*/
.c-lightbox.open {
	overflow-y: hidden;
	overflow: hidden;
}

#unit-mobile-gallery-slider.flexslider .flex-control-nav {
	bottom: 20px;
	opacity: 1;
}

#unit-mobile-gallery-slider.flexslider .flex-control-nav li a {
	width: 7px;
	height: 7px;
	background: var(--beon-unit-gallery-dots-color-inactive);
	box-shadow: none;
}

#unit-mobile-gallery-slider.flexslider .flex-control-nav li a.flex-active {
	background: var(--beon-unit-gallery-dots-color-active);
}

/* Work further */

#unit-mobile-gallery-slider.flexslider {
	background: transparent !important;
	border: none !important;
}

#unit-mobile-gallery-slider .flex-next,
#unit-mobile-gallery-slider .flex-next::before,
#unit-mobile-gallery-slider .flex-prev::before,
#unit-mobile-gallery-slider .flex-prev {
	display: none;
}

#unit-gallery-grid.grid-layout .open-gallery-popup:first-child {
	position: relative;
	grid-column: 1 / 3;
	grid-row: 1 / 3;
	height: 70vh;
}

#unit-gallery-grid.grid-layout .open-gallery-popup:not(:first-child) {
	height: calc((70vh /2) - 10px);
}


.unit-gallery-buttons {
	position: absolute;
	bottom: 16px;
	left: 16px;
	display: flex;
	gap: 8px;
	z-index: 10;
}

#unit-gallery-grid.grid-layout .highlight-marker-wrapper {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	position: absolute;
	top: 16px;
	transform: none;
	left: 16px;
	height: 30px !important;
	gap: 5px;

}

.beon-video-player~.highlight-marker-wrapper {
	z-index: -1;
}

.open-gallery-popup:hover .highlight-marker-wrapper {
	z-index: 1 !important;
}

#unit-gallery-grid.grid-layout .weber-boutique-highlight {
	background-color: var(--beon-listing-img-marker-group-bg-color);
	color: var(--beon-listing-img-marker-group-text-color);
	display: flex;
	gap: 10px;
	align-items: center;
	border-radius: var(--beon-listing-img-marker-border-radius);
	box-shadow: var(--beon-listing-img-marker-shadow);
	padding: 7px 12px;
	font: var(--beon-listing-img-marker-font);
	cursor: default;
}

#unit-gallery-grid.grid-layout .weber-plus-highlight {
	background-color: var(--beon-white);
	color: var(--beon-primary-color-2);
	display: flex;
	gap: 10px;
	align-items: center;
	border-radius: var(--beon-listing-img-marker-border-radius);
	box-shadow: var(--beon-listing-img-marker-shadow);
	padding: 6px 12px;
	font: var(--beon-listing-img-marker-font);
	cursor: default;
}

#unit-gallery-grid.grid-layout .weber-boutique-highlight img,
#unit-gallery-grid.grid-layout .weber-plus-highlight img {
	width: 16px;
	height: 16px;
}


/* Tooltip */
#unit-gallery-grid .weber-tooltip {
	display: flex;
	flex-direction: row;
	gap: 5px;
	z-index: 1;
	flex-wrap: wrap;
}

#unit-gallery-grid .weber-tooltip::after {
	content: attr(data-tip);
	position: absolute;
	top: 40px;
	visibility: hidden;
	opacity: 0;
	transition: all 0.3s ease-in-out;
	background-color: var(--beon-white);
	color: var(--beon-primary-text-color);
	text-align: left;
	border-radius: var(--beon-border-radius-small);
	font-size: var(--beon-font-size-small);
	padding: 10px 16px;
	z-index: 1;
	min-width: 240px;
}

#unit-gallery-grid .weber-tooltip:hover::after {
	visibility: visible;
	opacity: 1;
}


#unit-gallery-grid.grid-layout .popup-button-wrapper {
	display: flex;
	width: fit-content;
	position: absolute;
	top: 16px;
	transform: none;
	left: 16px;
	height: 45px !important;
	gap: 10px;
}

#unit-gallery-grid.grid-layout .rating-box {
	background-image: url(/wp-content/themes/weber-foehr-theme/assets/images/rating_star.svg);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	color: var(--beon-unit-rating-box-text-color);
	font: var(--beon-unit-rating-box-font);
	display: flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
	position: absolute;
	right: 16px;
	top: 16px;
	transform: none;
	height: 36px !important;
	width: 36px;
	padding-bottom: 3px;

}

.beon-video-player~.rating-box {
	z-index: -1;
}

.unit-wrap-gallery {
	position: relative;
	z-index: 0;
}

.gallery-popup-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	height: 50px;
	border-bottom: var(--beon-fp-search-border);
	background-color: var(--beon-unit-gallery-popup-bg-color);
}

.gallery-popup-logo {
	display: flex;
	align-items: center;
	gap: 30px;
}

.gallery-popup-logo img {
	margin-right: 50px;
}

.gallery-popup-tabs {
	display: flex;
	gap: 30px;
}

.gallery-popup-tabs .tab-btn {
	flex-shrink: 0;
	white-space: nowrap;
}

button.tab-btn {
	background: none !important;
	border: none !important;
	border-radius: 0px !important;
	padding: 0px !important;
	cursor: pointer;
	height: 50px;
	font: var(--beon-unit-highlights-font-m);
	color: var(--beon-primary-text-color) !important;
	border-bottom: 4px solid transparent !important;
	outline: none !important;
}

/* button.tab-btn:focus {
	border: none !important;
	border-radius: 0px !important;
	height: 46px;
} */

button.tab-btn.active {
	font-weight: bold;
	border: none !important;
	border-radius: 0px !important;
	/* height: 46px; */
	border-bottom: 4px solid var(--beon-primary-color) !important;
}

/* CONTENT */
.tab-panel {
	display: none;
}

.tab-panel.active {
	display: block;
}

.beon-video-player.ods-video,
.ods-video .beon-video {
	height: 70vh !important;
	border-radius: var(--beon-border-radius-small);
}

.ods-video .beon-video {
	position: relative;
	z-index: -1;
}

.gallery-popup-video-wrapper {
	margin: 0 auto;
	padding: 30px;
}

.gallery-popup-video .beon-video {
	border-radius: var(--beon-unit-gallery-border-radius);
}

@media only screen and (max-width: 1200px) {
	#unit-gallery-grid.grid-layout {
		display: none !important;
	}

	#unit-mobile-gallery-slider {
		display: block !important;
		height: 340px;
		margin-bottom: -20px;
	}


	#unit-mobile-gallery-slider.flexslider .slides>li,
	#unit-mobile-gallery-slider.flexslider .flex-viewport,
	#unit-mobile-gallery-slider.flexslider .slides>li img,
	.beon-video-player.ods-video,
	.ods-video .beon-video {
		height: 340px !important;
	}

	#unit-mobile-gallery-slider.flexslider .slides .unit-gallery-button img {
		height: 11px;
	}

	.open-gallery-popup {
		height: 100%;
	}

	.gallery-popup .main-content {
		padding: 0px 30px;
	}

	.gallery-popup {
		padding: 0px;
	}

	/* .gallery-popup-image {
		height: 200px;
	} */

	.gallery-popup-close {
		top: 20px;
		right: 20px;
	}
}


@media only screen and (max-width: 767px) {

	.flex-direction-nav .flex-next {
		right: 30px !important;
	}

	.flex-direction-nav .flex-prev {
		left: 30px !important;
	}

	.gallery-popup-image-wrapper,
	.gallery-popup-video-wrapper,
	.gallery-popup-decorative-wrapper {
		gap: 10px;
		padding: 30px;
	}

	#unit-mobile-gallery-slider.flexslider .slides>li,
	#unit-mobile-gallery-slider.flexslider .flex-viewport,
	#unit-mobile-gallery-slider.flexslider .slides>li img,
	#unit-mobile-gallery-slider {
		height: 273px !important;
	}

	.beon-video-player.ods-video,
	.ods-video .beon-video {
		height: 273px !important;
		border-radius: 0px;
	}

	.gallery-popup-video-wrapper .beon-video {
		border-radius: var(--beon-border-radius-small);
	}

	/* Tabs scroll horizontally instead of overflowing the viewport */
	.gallery-popup .main-content {
		padding: 0px 0px 0px 16px;
		gap: 10px;
	}

	.gallery-popup-logo {
		flex: 1;
		min-width: 0;
		gap: 20px;
	}

	.gallery-popup-logo img {
		margin-right: 0;
		flex-shrink: 0;
	}

	.gallery-popup-tabs {
		gap: 20px;
		min-width: 0;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.gallery-popup-tabs::-webkit-scrollbar {
		display: none;
	}

	button.gallery-popup-close {
		flex-shrink: 0;
	}
}