/**
 * Datei: gallery.css
 * Pfad: /wp-content/plugins/mietp-core/inc/modules/gallery/css/gallery.css
 * Modul: Gallery
 * Plugin: MietPortalo Core
 * Autor: MARKS MEDIA
 *
 * Zweck:
 * - Styling der Galerie im Single-Listing (linke Spalte 7/5-Layout)
 * - Zeigt Hauptbild, Thumbs und Overlay an.
 * - Ohne Inline-Styles oder externe Slider-Library.
 * - Dynamische Anpassung über CSS-Variablen.
 */

/* ============================================================
   0. Variablen
============================================================ */
:root {
	--mp-thumb-width: 110px;   /* vom Admin/JS überschreibbar */
	--mp-thumb-height: 70px;   /* vom Admin/JS überschreibbar */
	--mp-thumb-gap: 8px;
}

/* ============================================================
   1. Grundlayout
============================================================ */
.mp-gallery {
	position: relative;
	width: 100%;
	margin-bottom: 25px;
	user-select: none;
}

/* Hauptbild dynamisch */
.mp-gallery-main {
	position: relative;
	width: 100%;
	height: var(--mp-gallery-height);
	max-width: 100%;
	overflow: hidden;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mp-gallery-main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	display: block;
	border-radius: 8px;
	cursor: pointer;
}

/* ============================================================
   3. Thumbnails
============================================================ */
.mp-gallery-thumbs-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 10px;
	width: 100%;
	overflow: hidden;
}

.mp-gallery-thumbs {
	display: flex;
	align-items: center;
	gap: var(--mp-thumb-gap);
	width: 100%;
	box-sizing: border-box;
	padding: 6px 0;
}

/* Scrollbare Innenebene */
.mp-gallery-thumbs-inner {
	display: flex;
	gap: var(--mp-thumb-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding: 0;
	max-width: 100%;
	box-sizing: border-box;
}

.mp-gallery-thumbs-inner::-webkit-scrollbar {
	display: none;
}

/* Thumbnails */
.mp-gallery-thumb {
	flex: 0 0 auto;
	cursor: pointer;
	position: relative;
	opacity: 0.7;
	transition: opacity 0.2s;
	scroll-snap-align: start;
}

.mp-gallery-thumb.active,
.mp-gallery-thumb:hover {
	opacity: 1;
}

.mp-gallery-thumb img {
	width: var(--mp-thumb-width);
	height: var(--mp-thumb-height);
	object-fit: cover;
	border-radius: 4px;
}

/* Sichtbare Thumbs per Adminwert */
.mp-gallery.thumbs-3 .mp-gallery-thumbs,
.mp-gallery.thumbs-4 .mp-gallery-thumbs,
.mp-gallery.thumbs-5 .mp-gallery-thumbs,
.mp-gallery.thumbs-6 .mp-gallery-thumbs,
.mp-gallery.thumbs-7 .mp-gallery-thumbs {
	max-width: 100%;
}

/* ============================================================
   4. Overlay
============================================================ */
.mp-gallery-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.9);
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
}

.mp-gallery-overlay.open { display: flex; }

.mp-gallery-overlay-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* ============================================================
   Overlay-Container mit fixer Basisgröße
============================================================ */
/* ============================================================
   Schließen-Button fixiert relativ zum Bild (nicht zum Container)
============================================================ */
/* ============================================================
   Overlay-Container und Schließen-Icon
============================================================ */
.mp-gallery-overlay-inner {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 900px;
	width: 100%;
	margin: 0 auto;
}

.mp-gallery-overlay-image {
	display: block;
	max-width: 100%;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
}

/* Icon hängt an der Ecke des 900px Containers */
.mp-gallery-overlay-close {
	position: absolute;
	top: -20px;
	right: -20px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	cursor: pointer;
	z-index: 20;
	transition: background 0.2s ease;
}

.mp-gallery-overlay-close:hover {
	background: rgba(0, 0, 0, 0.6);
}

.mp-gallery-overlay-close i {
	font-size: 20px;
	line-height: 1;
	color: #fff;
}

/* ============================================================
   5. Overlay Thumbs & Bullets
============================================================ */
.mp-gallery-overlay-thumbs {
	position: relative;
	display: flex;
	justify-content: center;
	margin-top: 15px;
	width: 100%;
	overflow: hidden;
}

.mp-gallery-overlay-thumbs-inner {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
}

.mp-gallery-overlay-thumbs-inner::-webkit-scrollbar {
	display: none;
}

.mp-gallery-overlay-thumb {
	flex: 0 0 90px;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.mp-gallery-overlay-thumb img {
	width: 90px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
}

.mp-gallery-overlay-thumb.active,
.mp-gallery-overlay-thumb:hover {
	opacity: 1;
}

/* Bullets unten */
.mp-gallery-overlay-bullets {
	margin-top: 12px;
	text-align: center;
}

.mp-gallery-overlay-bullet {
	display: inline-block;
	width: 12px;
	height: 12px;
	margin: 0 4px;
	padding: 0;
	line-height: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255,255,255,0.45);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
}

.mp-gallery-overlay-bullet.active {
	background: #fff;
}
/* ============================================================
   Overlay Thumb Pfeile (gleiches Design wie normale Pfeile)
============================================================ */
.mp-gallery-overlay-thumbs-prev,
.mp-gallery-overlay-thumbs-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	z-index: 5;
	transition: background 0.2s ease;
}

.mp-gallery-overlay-thumbs-prev:hover,
.mp-gallery-overlay-thumbs-next:hover {
	background: rgba(0, 0, 0, 0.6);
}

.mp-gallery-overlay-thumbs-prev i,
.mp-gallery-overlay-thumbs-next i {
	font-size: 18px;
	line-height: 1;
	color: #fff;
}

.mp-gallery-overlay-thumbs-prev { left: 8px; }
.mp-gallery-overlay-thumbs-next { right: 8px; }
/* ============================================================
   8. Video-Thumbs in der Galerie
============================================================ */
.mp-thumb-video {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	width: var(--mp-thumb-width);
	height: var(--mp-thumb-height);
}

.mp-thumb-video img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.mp-thumb-video .mp-video-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 36px;
	height: 36px;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mp-thumb-video .mp-video-icon i {
	color: #fff;
	font-size: 14px;
}

.mp-thumb-video:hover .mp-video-icon {
	background: rgba(0, 0, 0, 0.8);
}
