/* Judging Gallery Styles */

.bg {
  background-image: url("../asset/background.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
}

/* Gallery Styles */
.gallery-container {
  min-height: 50vh;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

/* Simple fade-in animation for gallery items */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item {
  animation: fadeIn 0.4s ease-out;
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 4/3;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  /* Use will-change to optimize animations */
  will-change: transform;
  transition: transform 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(119, 166, 150, 0.3);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Use GPU acceleration */
  transform: translateZ(0);
  backface-visibility: hidden;
  /* Disable scaling on hover to improve performance */
  transition: opacity 0.3s ease;
}

.gallery-item:hover img {
  /* Instead of scaling, just change opacity slightly */
  opacity: 0.95;
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
  padding: 1rem;
  padding-top: 2rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  transform: translateY(0);
}

.gallery-overlay h5 {
  color: #77a696;
  font-family: 'Lemon Milk', sans-serif;
  font-size: 0.9rem;
  margin: 0;
}

.gallery-overlay p {
  color: white;
  font-family: 'Lemon Milk', sans-serif;
  font-size: 0.75rem;
  margin: 0.25rem 0 0 0;
}

/* Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  flex-wrap: wrap;
  background-color: #203d3444;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  margin: 1rem auto;
  max-width: 80vw;
}

.pagination button {
  padding: 0.75rem 1.5rem;
  background: rgba(119, 166, 150, 0.15);
  color: white;
  border: 1px solid rgba(119, 166, 150, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Lemon Milk', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
}

.pagination button:hover:not(:disabled) {
  background: rgba(81, 255, 130, 0.15);
  color: #f2fff3;
  border-color: rgba(81, 255, 130, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(81, 255, 130, 0.3);
}

.pagination button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: rgba(119, 166, 150, 0.08);
}

.pagination button.active {
  background: rgba(81, 255, 130, 0.2);
  color: #f2fff3;
  border-color: rgba(81, 255, 130, 0.5);
  box-shadow: 0 0 15px rgba(81, 255, 130, 0.4);
}

/* Page info text */
.pagination .page-info {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  padding: 0 0.5rem;
}

/* Pagination dots */
.pagination-dots {
  color: rgba(255, 255, 255, 0.4);
  font-size: 1rem;
  padding: 0 0.25rem;
}

/* Mobile pagination styles */
@media (max-width: 768px) {
  .pagination {
    gap: 0.35rem;
    padding: 0.7rem 0.4rem;
    max-width: 94vw;
  }
  
  .pagination button {
    padding: 0.4rem 0.55rem;
    font-size: 0.68rem;
    min-width: 34px;
    border-radius: 8px;
  }
  
  .pagination-dots {
    padding: 0 0.08rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .pagination {
    gap: 0.25rem;
    padding: 0.55rem 0.35rem;
    max-width: 97vw;
  }
  
  .pagination button {
    padding: 0.3rem 0.4rem;
    font-size: 0.62rem;
    min-width: 30px;
    border-radius: 6px;
  }
  
  .pagination-dots {
    padding: 0 0.05rem;
    font-size: 0.68rem;
  }
}

/* Filter Buttons */
.filter-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  background: rgba(51, 51, 51, 0.8);
  color: white;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Lemon Milk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
}

.filter-btn:hover {
  background: rgba(67, 101, 90, 0.8);
  border-color: #77a696;
}

.filter-btn.active {
  background: #77a696;
  border-color: #77a696;
  box-shadow: 0 0 15px rgba(119, 166, 150, 0.5);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  padding: 2rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.modal-content img {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  max-height: calc(90vh - 80px);
  height: auto;
  border-radius: 12px;
}

.modal-close {
  position: absolute;
  top: -50px;
  right: 80px;
  background: #77a696;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(119, 166, 150, 0.8);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  border-radius: 16px;
}

.modal-prev {
  left: -60px;
}

.modal-next {
  right: -60px;
}

@media (max-width: 768px) {
  .modal-nav {
    padding: 0.5rem;
    font-size: 1.2rem;
  }
  
  .modal-prev {
    left: 10px;
  }
  
  .modal-next {
    right: 10px;
  }
  
  .modal-close {
    top: 10px;
    right: 10px;
  }
}

@media (min-width: 769px) {
  .modal-prev,
  .modal-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001; 
    padding: 1rem;
    font-size: 1.5rem;
    background: rgba(119,166,150,0.9);
    border-radius: 8px;
  }

  .modal-prev {
    left: 20px;
  }

  .modal-next {
    right: 20px;
  }
}

/* Loading Spinner */
.loading {
  text-align: center;
  padding: 2rem;
  color: #77a696;
  font-size: 1.2rem;
}

/* Lazy load placeholder */
img[data-src] {
  filter: blur(10px);
  transition: filter 0.3s;
}

img.loaded {
  filter: blur(0);
}
