.gallery-container {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  overflow-y: auto;
  height: calc(100vh - 200px); /* Adjust height based on your header/footer */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.5rem;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

.gallery-item {
  overflow: hidden;
  border-radius: 8px;
  
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.gallery-item:nth-child(n) {
  margin: auto;
  animation-delay: calc(0.1s * var(--i, 1));
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Scrollbar styling */
.gallery-container::-webkit-scrollbar {
  width: 8px;
}

.gallery-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.gallery-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.gallery-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Lightbox styles */
#lightbox {
  align-content: center;
  position: fixed; /* หรือ relative ก็ได้ */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  padding: inherit;
  text-align: center;
  animation: fadeInLightbox 0.5s ease;
}

#lightbox.fade-out {
  animation: fadeOutLightbox 0.5s ease forwards;
}
#lightbox-img {
  margin: auto;
  max-width: 90%;
  max-height: 80vh;
}

@keyframes fadeInLightbox {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOutLightbox {
  from { opacity: 1; }
  to { opacity: 0; }
}

.nav-btn {
  position: absolute;
  top: 50%;
  font-size: 40px;
  color: white;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  cursor: pointer;
  z-index: 1001;
  transform: translateY(-50%);
  padding: 50px 15px;
  border-radius: 4px;
}

.prev-btn {
  left: 10px;
}
.next-btn {
  right: 10px;
}

.nav-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  z-index: 1001;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .gallery-container {
    height: calc(100vh - 150px);
  }
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-filter-dropdown {
  text-align: center;
  margin-top: 20px;
}

#category-select {
  padding: 10px 15px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  min-width: 200px;
}