/**
 * Gallery Module Styles
 *
 * @package WP_Immo_Detail
 */

/* Gallery Module Container */
.wp-r2go4-gallery-module {
	position: relative;
	width: 100%;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
}

/* ===========================================
   HERO MODE (Fullwidth / 100vh)
   =========================================== */

/* Hero mode container */
.wp-r2go4-gallery-hero {
	position: relative;
}

/* Hero mode main image - 100vh minus header */
.wp-r2go4-gallery-hero .wp-r2go4-gallery-main {
	height: calc(100vh - var(--wp-r2go4-header-height, 80px));
	aspect-ratio: unset;
	margin-bottom: 0;
}

/* Hero mode hides thumbnails */
.wp-r2go4-gallery-hero .wp-r2go4-gallery-thumbs-wrapper {
	display: none;
}

/* Hero mode hides action buttons (Grundrisse, Virtual Tour) */
.wp-r2go4-gallery-hero .wp-r2go4-gallery-actions {
	display: none;
}

/* Hero mode navigation buttons - larger and centered */
.wp-r2go4-gallery-hero .wp-r2go4-gallery-main-nav {
	width: 50px;
	height: 100px;
}

.wp-r2go4-gallery-hero .wp-r2go4-gallery-main-prev::after,
.wp-r2go4-gallery-hero .wp-r2go4-gallery-main-next::after {
	width: 16px;
	height: 16px;
	border-width: 4px;
}

/* ===========================================
   END HERO MODE
   =========================================== */

/* ===========================================
   SLIDER MODE (with dots instead of thumbnails)
   =========================================== */

/* Slider mode hides thumbnails */
.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-thumbs-wrapper {
	display: none;
}

/* Slider mode hides action buttons */
.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-actions {
	display: none;
}

/* Dots Navigation Container - positioned next to anchor nav */
.wp-r2go4-gallery-dots {
	position: absolute;
	bottom: 60px;
	right: calc(80px + 60px + 30px);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 15px 0;
	z-index: 100;
	background-color: transparent;
}

/* Individual Dot */
.wp-r2go4-gallery-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid #fff;
	background-color: transparent;
	cursor: pointer;
	padding: 0;
	transition: all 0.2s ease;
	outline: none;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
	box-sizing: content-box;
}

.wp-r2go4-gallery-dot:hover {
	background-color: rgba(255, 255, 255, 0.5);
	transform: translateY(-3px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 1);
}

.wp-r2go4-gallery-dot:focus {
	outline: none;
}

/* Active Dot */
.wp-r2go4-gallery-dot-active {
	background-color: #fff;
}

/* Gallery Counter (mobile only) */
.wp-r2go4-gallery-counter {
	display: none;
	position: absolute;
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
	background-color: rgba(0, 0, 0, 0.6);
	color: #fff;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 14px;
	font-weight: 500;
	z-index: 100;
	white-space: nowrap;
}

.wp-r2go4-gallery-counter-separator {
	margin: 0 4px;
	opacity: 0.7;
}

/* Many images (>10): Show counter instead of dots on all devices */
.wp-r2go4-gallery-many-images .wp-r2go4-gallery-dots {
	display: none;
}

.wp-r2go4-gallery-many-images .wp-r2go4-gallery-counter {
	display: block;
	left: auto;
	right: calc(80px + 60px + 30px);
	transform: none;
	bottom: 60px;
}

/* Responsive Dots */
@media (max-width: 1200px) {
	.wp-r2go4-gallery-dots {
		left: auto;
		right: 20px;
		transform: none;
	}
}

@media (max-width: 768px) {
	.wp-r2go4-gallery-dots {
		bottom: 10px;
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		padding: 10px 15px;
	}

	.wp-r2go4-gallery-dot {
		width: 10px;
		height: 10px;
	}
}

/* Slider mode navigation */
.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-nav {
	width: 60px;
	height: 60px;
	top: auto;
	bottom: 50px;
	transform: none;
	background-color: transparent;
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-nav:hover,
.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-nav:active {
	background-color: transparent;
	box-shadow: none;
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev:hover::after {
	transform: translate(calc(-30% - 5px), -50%) rotate(45deg);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 1));
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next:hover::after {
	transform: translate(calc(30% + 5px), -50%) rotate(-135deg);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 1));
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev::after,
.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next::after {
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev {
	left: 80px;
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next {
	right: 80px;
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev::after {
	border-color: #fff;
	border-width: 3px;
	width: 36px;
	height: 36px;
	left: 50%;
	transform: translate(-30%, -50%) rotate(45deg);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next::after {
	border-color: #fff;
	border-width: 3px;
	width: 36px;
	height: 36px;
	right: 50%;
	transform: translate(30%, -50%) rotate(-135deg);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

/* ===========================================
   END SLIDER MODE
   =========================================== */

/* Remove all blue colors and outlines */
.wp-r2go4-gallery-module *,
.wp-r2go4-gallery-module *:focus,
.wp-r2go4-gallery-module *:active,
.wp-r2go4-gallery-module *:visited {
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

/* Main Image Container */
.wp-r2go4-gallery-main {
	position: relative;
	width: 100%;
	overflow: hidden;
	background-color: #f5f5f5;
	margin-bottom: 1rem;
}

/* Verkaufsstatus-Banderole für Detailseite */
.status-ribbon {
	position: absolute;
	top: 60px;
	right: -80px;
	width: 300px;
	padding: 12px 0 10px 0;
	background: #8B0000;
	color: white;
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	transform: rotate(45deg);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
	z-index: 10;
	letter-spacing: 1px;
}

/* Banderolen-Farben */
.status-ribbon.verkauft {
	background: var(--ribbon-verkauft, #8B0000);
}

.status-ribbon.vermietet {
	background: var(--ribbon-vermietet, #8B0000);
}

.status-ribbon.reserviert {
	background: var(--ribbon-reserviert, #006400);
}

.status-ribbon.vorbereitung {
	background: var(--ribbon-vorbereitung, #aa9a7f);
}

.status-ribbon.preisreduziert {
	background: var(--ribbon-preisreduziert, #00008B);
}

/* Aspect Ratios */
.wp-r2go4-gallery-ratio-16-9 {
	aspect-ratio: 16 / 9;
}

.wp-r2go4-gallery-ratio-4-3 {
	aspect-ratio: 4 / 3;
}

/* Main Image */
.wp-r2go4-gallery-main-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

/* Main Image Navigation */
.wp-r2go4-gallery-main-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 30px;
	height: 60px;
	border: none;
	background-color: rgba(0, 0, 0, 0.5);
	cursor: pointer;
	z-index: 10;
	outline: none;
	transition: none;
	padding: 0;
	margin: 0;
	box-sizing: border-box;
}

.wp-r2go4-gallery-main-nav:hover,
.wp-r2go4-gallery-main-nav:active {
	background-color: rgba(0, 0, 0, 0.7);
}

.wp-r2go4-gallery-main-prev {
	left: 0;
}

.wp-r2go4-gallery-main-prev::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 17px;
	transform: translate(-50%, -50%) rotate(45deg);
	width: 12px;
	height: 12px;
	border-left: 3px solid #ffffff;
	border-bottom: 3px solid #ffffff;
}

.wp-r2go4-gallery-main-next {
	right: 0;
}

.wp-r2go4-gallery-main-next::after {
	content: '';
	position: absolute;
	top: 50%;
	right: 17px;
	transform: translate(50%, -50%) rotate(-135deg);
	width: 12px;
	height: 12px;
	border-left: 3px solid #ffffff;
	border-bottom: 3px solid #ffffff;
}

/* Thumbnails Wrapper */
.wp-r2go4-gallery-thumbs-wrapper {
	position: relative;
	width: 100%;
}

/* Navigation Buttons - Hidden */
.wp-r2go4-gallery-nav {
	display: none;
}

/* Thumbnails Container */
.wp-r2go4-gallery-thumbs {
	width: 100%;
	overflow: hidden;
	position: relative;
}

/* Navigation Overlay Left - Fixed Position */
.wp-r2go4-gallery-thumbs::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 30px;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 10;
	pointer-events: none;
	transition: none;
}

.wp-r2go4-gallery-thumbs:hover::before {
	background-color: rgba(0, 0, 0, 0.7);
}

/* Chevron Left - Fixed Position */
.wp-r2go4-gallery-thumbs::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 17px;
	transform: translate(-50%, -50%) rotate(45deg);
	width: 12px;
	height: 12px;
	border-left: 3px solid #ffffff;
	border-bottom: 3px solid #ffffff;
	z-index: 11;
	pointer-events: none;
}

/* Navigation Overlay Right - Fixed Position */
.wp-r2go4-gallery-thumbs-wrapper::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 30px;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 10;
	pointer-events: none;
	transition: none;
}

.wp-r2go4-gallery-thumbs-wrapper:hover::before {
	background-color: rgba(0, 0, 0, 0.7);
}

/* Chevron Right - Fixed Position */
.wp-r2go4-gallery-thumbs-wrapper::after {
	content: '';
	position: absolute;
	top: 50%;
	right: 17px;
	transform: translate(50%, -50%) rotate(-135deg);
	width: 12px;
	height: 12px;
	border-left: 3px solid #ffffff;
	border-bottom: 3px solid #ffffff;
	z-index: 11;
	pointer-events: none;
}

/* Thumbnails Track */
.wp-r2go4-gallery-thumbs-track {
	display: flex;
	gap: 0.5rem;
	transition: transform 0.3s ease;
}

/* Thumbnail Container */
.wp-r2go4-gallery-thumb-container {
	position: relative;
	flex: 0 0 calc(20% - 0.4rem);
	overflow: hidden;
	background-color: #f5f5f5;
}

/* Thumbnail Button */
.wp-r2go4-gallery-thumb {
	position: relative;
	width: 100%;
	height: 100%;
	border: none;
	padding: 0;
	cursor: pointer;
	display: block;
	background: none;
	outline: none;
}

.wp-r2go4-gallery-thumb:focus,
.wp-r2go4-gallery-thumb:active {
	outline: none;
	border: none;
	background: none;
}

/* Thumbnail Image */
.wp-r2go4-gallery-thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

/* Thumbnail Overlay */
.wp-r2go4-gallery-thumb-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.4);
	transition: opacity 0.2s;
	pointer-events: none;
}

/* Active Thumbnail */
.wp-r2go4-gallery-thumb-active .wp-r2go4-gallery-thumb-overlay {
	opacity: 0;
}

/* Thumbnail Hover */
.wp-r2go4-gallery-thumb:hover .wp-r2go4-gallery-thumb-overlay {
	opacity: 0;
}

/* Lightbox */
.wp-r2go4-gallery-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 9999;
	display: none;
}

.wp-r2go4-gallery-lightbox.wp-r2go4-gallery-lightbox-open {
	display: block;
}

/* Lightbox Overlay */
.wp-r2go4-gallery-lightbox-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.9);
}

/* Lightbox Content */
.wp-r2go4-gallery-lightbox-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
}

/* Lightbox Close Button */
.wp-r2go4-gallery-lightbox-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 3rem;
	height: 3rem;
	border: none;
	background-color: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s;
	z-index: 10;
	outline: none;
}

.wp-r2go4-gallery-lightbox-close:hover {
	background-color: rgba(255, 255, 255, 0.2);
}

.wp-r2go4-gallery-lightbox-close:focus,
.wp-r2go4-gallery-lightbox-close:active {
	outline: none;
	border: none;
}

/* X icon via CSS */
.wp-r2go4-gallery-lightbox-close::before,
.wp-r2go4-gallery-lightbox-close::after {
	content: '';
	position: absolute;
	width: 20px;
	height: 2px;
	background-color: #ffffff;
}

.wp-r2go4-gallery-lightbox-close::before {
	transform: rotate(45deg);
}

.wp-r2go4-gallery-lightbox-close::after {
	transform: rotate(-45deg);
}

/* Lightbox Navigation */
.wp-r2go4-gallery-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 3rem;
	height: 3rem;
	border: none;
	background-color: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s;
	z-index: 10;
	outline: none;
}

.wp-r2go4-gallery-lightbox-nav:hover {
	background-color: rgba(255, 255, 255, 0.2);
}

.wp-r2go4-gallery-lightbox-nav:focus,
.wp-r2go4-gallery-lightbox-nav:active {
	outline: none;
	border: none;
}

.wp-r2go4-gallery-lightbox-prev {
	left: 2rem;
}

.wp-r2go4-gallery-lightbox-next {
	right: 2rem;
}

/* Arrow icons via CSS */
.wp-r2go4-gallery-lightbox-nav::after {
	content: '';
	position: absolute;
	width: 12px;
	height: 12px;
	border-left: 2px solid #ffffff;
	border-bottom: 2px solid #ffffff;
}

.wp-r2go4-gallery-lightbox-prev::after {
	transform: rotate(45deg);
	margin-left: 4px;
}

.wp-r2go4-gallery-lightbox-next::after {
	transform: rotate(-135deg);
	margin-right: 4px;
}

/* Lightbox Image Wrapper */
.wp-r2go4-gallery-lightbox-image-wrapper {
	max-width: 90%;
	max-height: 90%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Lightbox Image */
.wp-r2go4-gallery-lightbox-img {
	max-width: 100%;
	max-height: 80vh;
	width: auto;
	height: auto;
	display: block;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Lightbox Caption */
.wp-r2go4-gallery-lightbox-caption {
	margin-top: 1rem;
	color: #ffffff;
	font-size: 1rem;
	text-align: center;
	max-width: 600px;
}

/* Tablet Optimizations */
@media (max-width: 1024px) {
	/* Hero mode - fixed height instead of 100vh */
	.wp-r2go4-gallery-hero .wp-r2go4-gallery-main {
		height: 400px;
	}

	/* Slider mode arrows - centered vertically, closer to edge */
	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-nav {
		top: 50%;
		bottom: auto;
		transform: translateY(-50%);
	}

	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev {
		left: 30px;
	}

	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next {
		right: 30px;
	}

	/* Hide dots on tablet, show counter instead (dots overflow into tabs with many images) */
	.wp-r2go4-gallery-dots {
		display: none;
	}

	/* Show counter on tablet - positioned right like dots were */
	.wp-r2go4-gallery-counter {
		display: block;
		left: auto;
		right: 50px;
		transform: none;
		bottom: 20px;
	}
}

/* Mobile Optimizations */
@media (max-width: 768px) {
	/* Hide thumbnails on mobile */
	.wp-r2go4-gallery-thumbs-wrapper {
		display: none;
	}

	/* Main image - fixed height 300px on mobile */
	.wp-r2go4-gallery-main {
		height: 300px;
		aspect-ratio: unset;
		margin-bottom: 0;
	}

	/* Hero mode also 300px on mobile */
	.wp-r2go4-gallery-hero .wp-r2go4-gallery-main {
		height: 300px;
	}

	/* Navigation buttons centered vertically on mobile */
	.wp-r2go4-gallery-main-nav {
		width: 40px;
		height: 40px;
		top: 50%;
		bottom: auto;
		transform: translateY(-50%);
	}

	.wp-r2go4-gallery-main-prev {
		left: 20px;
	}

	.wp-r2go4-gallery-main-next {
		right: 20px;
	}

	/* Slider mode arrows centered vertically on mobile */
	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-nav {
		top: 50%;
		bottom: auto;
		transform: translateY(-50%);
		width: 40px;
		height: 40px;
	}

	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev {
		left: 20px;
	}

	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next {
		right: 20px;
	}

	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-prev::after,
	.wp-r2go4-gallery-slider-mode .wp-r2go4-gallery-main-next::after {
		width: 20px;
		height: 20px;
		border-width: 2px;
	}

	/* Hide dots on mobile, show counter instead */
	.wp-r2go4-gallery-dots {
		display: none;
	}

	/* Show counter on mobile - same right margin as arrow (20px) */
	.wp-r2go4-gallery-counter {
		display: block;
		left: auto;
		right: 20px;
		transform: none;
	}

	/* Adjust lightbox padding */
	.wp-r2go4-gallery-lightbox-content {
		padding: 1rem;
	}

	/* Smaller navigation buttons in lightbox */
	.wp-r2go4-gallery-lightbox-prev {
		left: 0.5rem;
	}

	.wp-r2go4-gallery-lightbox-next {
		right: 0.5rem;
	}

	.wp-r2go4-gallery-lightbox-nav {
		width: 2.5rem;
		height: 2.5rem;
	}

	/* Close button positioning */
	.wp-r2go4-gallery-lightbox-close {
		top: 0.5rem;
		right: 0.5rem;
		width: 2.5rem;
		height: 2.5rem;
	}

	/* Full height image on mobile */
	.wp-r2go4-gallery-lightbox-img {
		max-height: 70vh;
	}
}

/* Gallery Action Buttons */
.wp-r2go4-gallery-actions {
	display: flex;
	gap: 15px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.wp-r2go4-gallery-action-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	padding: 12px 24px;
	background-color: var(--wp-r2go4-ci-color-1);
	color: var(--wp-r2go4-ci-color-2);
	border: none;
	border-radius: 0;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
	box-sizing: border-box;
}

.wp-r2go4-gallery-action-btn:hover,
.wp-r2go4-gallery-action-btn.active {
	background-color: #ffffff;
	color: var(--wp-r2go4-ci-color-1);
	text-decoration: none;
}

.wp-r2go4-gallery-action-btn:visited {
	color: var(--wp-r2go4-ci-color-2);
}

.wp-r2go4-gallery-action-btn:hover:visited,
.wp-r2go4-gallery-action-btn.active:visited {
	color: var(--wp-r2go4-ci-color-1);
}

/* Virtual Tour Modal */
.wp-r2go4-virtual-tour-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 99999;
	background-color: rgba(0, 0, 0, 0.9);
}

.wp-r2go4-virtual-tour-modal.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-r2go4-virtual-tour-content {
	position: relative;
	width: 90%;
	height: 90%;
	max-width: 1400px;
	background-color: #000;
}

.wp-r2go4-virtual-tour-iframe {
	width: 100%;
	height: 100%;
	border: none;
}

.wp-r2go4-virtual-tour-close {
	position: absolute;
	top: 15px;
	right: 15px;
	width: 50px;
	height: 50px;
	background-color: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: #000;
	z-index: 100000;
	transition: background-color 0.3s ease;
}

.wp-r2go4-virtual-tour-close:hover {
	background-color: #fff;
}

.wp-r2go4-virtual-tour-close .dashicons {
	width: 24px;
	height: 24px;
}

@media (max-width: 768px) {
	.wp-r2go4-gallery-actions {
		flex-direction: column;
		gap: 10px;
	}

	.wp-r2go4-gallery-action-btn {
		width: 100%;
		justify-content: center;
		padding: 12px 20px;
	}

	.wp-r2go4-virtual-tour-content {
		width: 95%;
		height: 85%;
	}

	.wp-r2go4-virtual-tour-close {
		top: 10px;
		right: 10px;
		width: 40px;
		height: 40px;
		font-size: 20px;
	}
}
