/* OPTIMIZED GALLERY PAGE STYLES - FIXED VERSION */

/* Gallery Hero Section */
.gallery-hero {
  height: 60vh;
  background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../gallery/gallery-hero-bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  margin-top: 80px;
}

.gallery-hero .hero-content h1 {
  font-family: 'Lato', sans-serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.gallery-hero .hero-content p {
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 300;
  color: #ffe600;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Gallery Navigation */
.gallery-nav {
  padding: 3rem 0;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 80px;
  z-index: 100;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 0.8rem 1.5rem;
  background: transparent;
  color: #666;
  border: 2px solid #ddd;
  border-radius: 25px;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.nav-btn:hover,
.nav-btn.active {
  background: #000;
  color: #fff;
  border-color: #000;
  transform: translateY(-2px);
}

/* Gallery Main Section */
.gallery-main {
  padding: 4rem 0;
  background: #f8f8f8;
}

.gallery-category {
  margin-bottom: 6rem;
  display: block;
}

.gallery-category.visible {
  display: block;
}

.gallery-category.hidden {
  display: none;
}

.category-header {
  text-align: center;
  margin-bottom: 3rem;
}

.category-header h2 {
  font-family: 'Lato', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 1rem;
}

.category-header p {
  font-size: 1.1rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

/* CRITICAL FIX: Gallery Grid - Always visible images */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  min-height: 600px;
}

/* CRITICAL FIX: Gallery Items - Force visibility */
.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* FORCE VISIBILITY */
  opacity: 1 !important;
  transform: translateY(0) !important;
  visibility: visible !important;
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* CRITICAL FIX: Images always visible */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
  /* FORCE VISIBILITY */
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

.gallery-item:hover img {
  filter: brightness(1.05);
}

/* Overlay only appears on hover */
.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  color: white;
  padding: 2rem 1.5rem 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.gallery-overlay p {
  margin: 0;
  font-size: 0.9rem;
  color: #ffe600;
  opacity: 0.9;
}

/* Loading States */
.gallery-loading {
  display: none;
  text-align: center;
  padding: 4rem 0;
  background: #f8f8f8;
}

.loading-spinner {
  display: inline-block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.gallery-loading p {
  font-size: 1.1rem;
  color: #666;
  margin-top: 1rem;
}

/* Pagination Styling */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin: 2rem 0;
  padding: 1rem;
}

.pagination-btn {
  padding: 0.8rem 1.5rem;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 25px;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #333;
  transform: translateY(-2px);
}

.pagination-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.pagination-info {
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.current-page {
  font-weight: 700;
  color: #000;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  backdrop-filter: blur(5px);
}

.lightbox-content {
  position: relative;
  margin: auto;
  padding: 20px;
  width: 90%;
  max-width: 1200px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 3rem;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.3s;
  z-index: 2001;
  background: rgba(0,0,0,0.5);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  color: #ffe600;
  background: rgba(0,0,0,0.8);
}

.lightbox-caption {
  color: #fff;
  text-align: center;
  margin-top: 1.5rem;
  font-size: 1.2rem;
  font-weight: 500;
  background: rgba(0,0,0,0.7);
  padding: 1rem 2rem;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 2rem;
  transform: translateY(-50%);
}

.lightbox-prev,
.lightbox-next {
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 1rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.3s;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,230,0,0.8);
  color: #000;
}

/* No Images State */
.no-images-state {
  text-align: center;
  padding: 4rem 2rem;
  background: #f8f8f8;
}

.no-images-content i {
  font-size: 4rem;
  color: #ccc;
  margin-bottom: 1rem;
}

.no-images-content h3 {
  font-size: 1.5rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.no-images-content p {
  color: #999;
}

/* Performance Debug Panel */
.performance-debug {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 12px;
  z-index: 10000;
  display: none;
}

.performance-debug.visible {
  display: block;
}

.performance-debug div {
  margin-bottom: 5px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.5rem;
  }
  
  .gallery-nav {
    top: 70px;
  }
  
  .pagination-container {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .gallery-hero {
    height: 40vh;
    margin-top: 70px;
    background-attachment: scroll;
  }
  
  .gallery-main {
    padding: 3rem 0;
  }
  
  .gallery-category {
    margin-bottom: 4rem;
  }
  
  .category-header h2 {
    font-size: 2rem;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1rem;
  }
  
  .nav-buttons {
    gap: 0.5rem;
  }
  
  .nav-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
  
  .gallery-nav {
    padding: 2rem 0;
    position: relative;
    top: auto;
  }
  
  .pagination-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, 1fr);
  }
  
  .nav-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .nav-btn {
    width: 200px;
    text-align: center;
  }
  
  .pagination-container {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Override any conflicting styles */
.gallery-item * {
  opacity: 1 !important;
  visibility: visible !important;
}