* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: white;
  display: flex;
  flex-direction: column;
}

/* Header - FIXED */
.site-header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 999; /* Reduced from 100 to 999 - lower than expanded image */
}

.site-header h1 {
  font-size: 1.8rem;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navigation */
.nav-bar {
  display: flex;
  gap: 1rem;
}

.nav-bar a {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgb(21, 21, 21);
  text-decoration: none;
  padding: 0.8rem 2rem;
  border-radius: 25px;
  font-size: 20px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  min-width: 100px;
  text-align: center;
}

.nav-bar a:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Main Image Viewer - FIXED */
#mainImageViewer {
  display: block;
  margin: 6rem auto 2rem;
  border-radius: 15px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 95%;
  max-width: 1000px;
  height: 600px;
  transition: all 0.5s ease;
  position: relative; /* Added this */
  z-index: 500; /* Added this - higher than header */
}

/* Expanded view - FIXED */
#mainImageViewer.expanded {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000; /* Increased significantly to be above everything */
  margin: 0;
  border-radius: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: rgba(0, 0, 0, 0.95);
}

/* Close button for expanded view - FIXED */
.close-btn {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001; /* Higher than expanded image */
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.close-btn.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Navigation buttons - FIXED */
.nav-btn {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001; /* Higher than expanded image */
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.8rem;
  font-weight: bold;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.nav-btn.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.prev-btn {
  left: 20px;
}

.next-btn {
  right: 20px;
}

/* Image counter - FIXED */
.image-counter {
  display: none;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001; /* Higher than expanded image */
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.image-counter.show {
  display: block;
}

/* No Image Message */
#noImage {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  margin: 3rem auto;
  max-width: 600px;
}

/* Image Container */
#imageContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  flex: 1;
}

/* Thumbnail Wrapper */
.thumbnailWrapper {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  text-align: center;
}

.thumbnailWrapper:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.2);
}

/* Thumbnail Images */
.thumbnailWrapper img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
}

.thumbnailWrapper:hover img {
  transform: scale(1.05);
}

/* Photo Titles */
.photoTitle {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  opacity: 0.9;
  line-height: 1.4;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Footer */
.site-footer {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 2rem;
  text-align: center;
  margin-top: auto;
}

.site-footer p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 300;
}

/* Responsive Design */
@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .site-header h1 {
    font-size: 1.5rem;
    text-align: center;
  }
  
  .nav-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .nav-bar a {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    min-width: 80px;
  }
  
  #imageContainer {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
  }
  
  .thumbnailWrapper {
    padding: 1rem;
  }
  
  .thumbnailWrapper img {
    height: 150px;
  }
  
  #mainImageViewer {
    width: 95%;
    height: 400px;
    max-width: 800px;
  }
  
  .close-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .nav-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .prev-btn {
    left: 10px;
  }
  
  .next-btn {
    right: 10px;
  }
  
  .image-counter {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  #noImage {
    font-size: 1.2rem;
    margin: 2rem auto;
    padding: 0 1rem;
  }
  
  .site-footer {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .site-header h1 {
    font-size: 1.3rem;
  }
  
  .nav-bar a {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  #imageContainer {
    grid-template-columns: 1fr;
  }
  
  .thumbnailWrapper img {
    height: 120px;
  }
  
  #noImage {
    font-size: 1rem;
    margin: 1.5rem auto;
  }
}

/* Loading Animation */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.loading {
  animation: pulse 2s infinite;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.thumbnailWrapper {
  animation: fadeInUp 0.6s ease forwards;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}