.react-gallery {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.gallery-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  gap: 2.5rem;
}

.gallery-slide {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  padding: 0 1rem;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-slide-image-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.gallery-slide-image {
  width: 100%;
  max-width: 100%;
  max-height: 80%;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 0.2s ease-out;
  transform-origin: center center;
  user-select: none;
}

.gallery-slide-image.image-loaded {
  opacity: 1;
}

.gallery-slide-image.zoomed {
  transition: transform 0.1s ease-out;
  z-index: 5;
}

/* Image Skeleton */
.gallery-slide-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-background-muted);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-slide-skeleton::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-text-faint) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* Image Error State */
.gallery-slide-error {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-background-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
}

.gallery-slide-error svg {
  margin-bottom: 1rem;
  opacity: 0.6;
}

.gallery-slide-error span {
  font-size: var(--font-size-sm);
  font-family: var(--font-ntype82regular);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Caption über der Pagination */
.gallery-caption-above-nav {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--color-background-muted);
  border-radius: var(--radius-md);
  max-width: 80%;
  text-align: center;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.gallery-caption-above-nav p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-soft);
  font-family: var(--font-ntype82regular);
}

/* Top Controls Container */
.gallery-top-controls {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 10;
}

/* Zoom Controls */
.gallery-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-background-muted);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.gallery-zoom-button {
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--color-text);
  min-width: 32px;
  min-height: 32px;
}

.gallery-zoom-button:hover:not(:disabled) {
  background: var(--color-background-soft);
  color: var(--color-accent);
}

.gallery-zoom-button:active:not(:disabled) {
  transform: scale(0.95);
}

.gallery-zoom-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gallery-zoom-button svg {
  width: 18px;
  height: 18px;
}

.gallery-zoom-percentage {
  min-width: 3rem;
  text-align: center;
  font-family: var(--font-ntype82regular);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  padding: 0 0.25rem;
}

.gallery-navigation {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
}

.gallery-nav {
  background: var(--color-background-muted);
  border: none;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--color-text-muted);
  backdrop-filter: blur(10px);
}

.gallery-nav:hover {
  color: var(--color-text);
  background: var(--color-background-soft);
}

.gallery-indicators {
  display: flex;
  gap: 10px;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.indicator.active {
  background-color: var(--color-accent);
}

.gallery-counter {
  background: var(--color-background-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ndot55);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.slide-separator {
  margin: 0 0.25rem;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .gallery-wrapper {
    gap: 2rem;
  }

  .gallery-slide {
    padding: 3rem 1rem 5rem 1rem; /* Platz für Counter oben und Navigation unten */
    justify-content: center; /* Zentriere Bilder vertikal im verfügbaren Bereich */
  }

  .gallery-slide-image-container {
    max-height: 55vh; /* Fallback für ältere Browser */
    max-height: 55dvh; /* Dynamic viewport height für Mobile - berücksichtigt Browser-UI */
    min-height: 150px;
  }

  .gallery-slide-image {
    width: 100%;
    max-width: 100%;
    max-height: 55vh; /* Fallback für ältere Browser */
    max-height: 55dvh; /* Dynamic viewport height für Mobile - berücksichtigt Browser-UI */
    height: auto;
    object-fit: contain;
  }

  .gallery-caption-above-nav {
    bottom: 70px;
    max-width: 90%;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
  }

  .gallery-top-controls {
    top: 0.5rem;
    left: 0.5rem;
    gap: 0.75rem;
  }

  .gallery-zoom-controls {
    padding: 0.375rem;
    gap: 0.375rem;
  }

  .gallery-counter {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
  }

  .gallery-zoom-button {
    padding: 0.375rem;
    min-width: 28px;
    min-height: 28px;
  }

  .gallery-zoom-button svg {
    width: 16px;
    height: 16px;
  }

  .gallery-zoom-percentage {
    min-width: 2.5rem;
    font-size: var(--font-size-xs);
    padding: 0 0.125rem;
  }


  .gallery-navigation {
    bottom: 10px;
    gap: 12px;
  }

  .gallery-nav {
    padding: 6px;
  }

  .gallery-nav svg {
    width: 18px;
    height: 18px;
  }

  .gallery-indicators {
    gap: 8px;
  }

  .indicator {
    width: 8px;
    height: 8px;
  }

  .gallery-counter {
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
  }

  .gallery-slide-error {
    padding: 1rem;
  }

  .gallery-slide-error svg {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
  }

  .gallery-slide-error span {
    font-size: var(--font-size-xs);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gallery-slide-skeleton::before {
    animation: none;
  }

  .gallery-slide-image {
    transition: opacity 0.3s ease-in-out;
  }
}

