/* =========================================================================
   GALLERY-SPEZIFISCHE STYLES - Mäxx Foto Website
   ========================================================================= */

/* =========================================================================
   GALLERY TABS
   ========================================================================= */

.gallery-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.gallery-tab {
  background: var(--background-overlay-strong);
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  padding: var(--spacing-xs) var(--spacing-sm);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  font-family: inherit;
}

.gallery-tab:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gallery-tab.active {
  background: var(--primary-color);
}

/* =========================================================================
   GALLERY GRID
   ========================================================================= */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md); /* Vergrößerter Gap für besseren Abstand */
  max-width: 100%;
  padding: 0 var(--spacing-xs); /* Kleiner Padding für bessere Darstellung */
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast);
  aspect-ratio: 1/1; /* Quadratische Kacheln */
  background: var(--background-overlay);
}

.gallery-item:hover {
  transform: scale(1.05);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition-medium);
  border-radius: var(--radius-md);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* =========================================================================
   PREVIEW GRID FÜR STARTSEITE
   ========================================================================= */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.preview-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-medium);
  aspect-ratio: 4/3;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.preview-item:hover {
  transform: translateY(-5px);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-medium);
}

.preview-item:hover img {
  transform: scale(1.05);
}

.preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: var(--text-primary);
  padding: var(--spacing-lg) var(--spacing-sm) var(--spacing-sm);
  transition: padding var(--transition-fast);
}

.preview-item:hover .preview-overlay {
  padding-bottom: var(--spacing-md);
}

.preview-overlay h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin: 0;
  font-family: var(--font-heading);
}

/* =========================================================================
   LIGHTBOX THUMBNAILS
   ========================================================================= */

.lightbox-thumbnails {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--spacing-xs);
  overflow-x: auto;
  padding: var(--spacing-sm);
  max-width: 90%;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-md);
  z-index: 6;
}

.lightbox-thumbnails img {
  height: 60px;
  cursor: pointer;
  opacity: 0.6;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s, transform 0.2s;
}

.lightbox-thumbnails img:hover,
.lightbox-thumbnails img.active-thumb {
  opacity: 1;
  transform: scale(1.05);
  border: 2px solid var(--text-primary);
}

/* =========================================================================
   RESPONSIVE GALLERY
   ========================================================================= */

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm); /* Angepasster Gap für mobile */
    padding: 0 var(--spacing-xs);
  }
  
  .preview-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .gallery-tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .gallery-tab {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
  
  .lightbox-thumbnails {
    position: static;
    transform: none;
    margin-top: var(--spacing-sm);
    left: auto;
    bottom: auto;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: transparent;
  }
  
  .lightbox-thumbnails img {
    width: 40px;
    height: 40px;
  }
  
  .lightbox .close {
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
  }
  
  .lightbox-nav button {
    font-size: 1.5rem;
    padding: 0.3rem 0.7rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-xs);
  }
  
  .gallery-item {
    margin-bottom: var(--spacing-sm);
  }
  
  .gallery-tab {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }
  
  .lightbox img {
    max-height: 70vh;
  }
}
