.custom-inline-gallery {
  max-width: 800px;
  margin: 0 auto;
  font-family: sans-serif;
}

/* Hauptcontainer
.gallery-main-container {
  position: relative;
  width: 100%;
  margin-bottom: 15px;
  background-color: #000;
  overflow: hidden;
}*/

.gallery-main-display img {
  width: 100%;
  height: auto;
  display: block;
  /* Sanfter Übergang für Opacity mit elegantem Easing */
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Klasse für den sanften Bildwechsel */
.gallery-main-display img.fade-out {
  opacity: 0;
}
.gallery-main-container {
  position: relative;
  overflow: hidden; /* Schneidet eventuelle Überstände sauber ab */
}
/* NEU: Bildunterschrift unten zentriert über dem Bild */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); /* Schicker Schattenverlauf */
  color: #fff;
  padding: 12px 15px; /* Platzhalter, damit Text nicht unter den Pfeilen liegt */
  text-align: center;
  box-sizing: border-box;
  font-size: 14px;
  letter-spacing: 0.5px;
  z-index: 5;
  transition: opacity 0.3s ease;
}

/* Verstecke Caption automatisch, falls kein Text vorhanden ist */
.gallery-caption:empty {
  opacity: 0;
}

/* UI-Elemente: Pfeile */
.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  font-size: 24px;
  padding: 15px 12px;
  cursor: pointer;
  transition: background 0.2s, cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 10;
}
.gallery-arrow:hover {
  background: rgba(0, 0, 0, 0.8);
}
.arrow-prev { left: 0; border-radius: 0 4px 4px 0; }
.arrow-next { right: 0; border-radius: 4px 0 0 4px; }

/* UI-Elemente: Counter */
.gallery-counter {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 20px;
  z-index: 10;
}

/* Thumbnails als einzeiliges, horizontales Scroll-Band */
.gallery-thumbnails {
  display: flex;
  gap: 10px;
  justify-content: flex-start; /* Geändert von center, damit Scrollen sauber startet */
  flex-wrap: nowrap;           /* Verhindert den Zeilenumbruch */
  overflow-x: auto;            /* Aktiviert horizontales Scrollen */
  overflow-y: hidden;          /* Verhindert vertikales Scrollen */
  padding: 10px 5px;           /* Etwas Platz für Schatten/Rahmen */
  scroll-behavior: smooth;     /* Sanftes Scrollen per JS */

  /* Versteckt die Scrollbar für ein sauberes Design */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;       /* Firefox */
}

/* Versteckt Scrollbar für Chrome, Safari und Edge */
.gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

.thumb-item {
  flex: 0 0 auto; /* WICHTIG: Verhindert, dass die Thumbs zusammengedrückt werden */
  border: 2px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.thumb-item img {
  display: block;
  width: 80px;
  height: 55px;
  object-fit: cover; /* Schneidet Thumbs sauber quadratisch/rechteckig zu */
}
.thumb-item.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px #0056b3; /* Doppelrahmen-Effekt */
  opacity: 1;
}
.thumb-item:hover {
  opacity: 1;
}

/* Der Container für das Hauptbild bekommt eine feste Höhe */
.gallery-main-container {
  width: 100%;
  height: 500px; /* Hier deine Wunschhöhe für Desktop eintragen */
  background-color: #f5f5f5; /* Optional: Neutraler Hintergrund bei Ladezeiten */
  display: flex;
  align-items: center;     /* Zentriert das Bild vertikal */
  justify-content: center;  /* Zentriert das Bild horizontal */
  overflow: hidden;
}

/* Das Hauptbild füllt den Container exakt aus, ohne sich zu verzerren */
.main-view-image {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Schneidet das Bild perfekt zu wie ein Hintergrundbild */
  max-height: 500px;
  object-position: center; /* Zentriert den Bildausschnitt */
  display: block;
  opacity: 1;
  transition: opacity 0.4s ease-in-out;
}

/* Fade-Klasse für den JS-Übergang */
.main-view-image.fade-out {
  opacity: 0;
}

/* --- Responsive Anpassung für Mobilgeräte --- */
@media (max-width: 768px) {
  .gallery-main-container {
    height: 300px; /* Kleinere, feste Höhe auf dem Smartphone */
  }
  .main-view-image {
    max-height: 300px;
  }
}
