/* Gallery Component V3 - Flat Design, Minimalist */

.gallery-container-v3 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8f9fa;
  z-index: 9997;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.gallery-container-v3.active {
  display: flex;
}

/* Header */
.gallery-header-v3 {
  background: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.gallery-title-v3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-close-v3 {
  background: #6c757d;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.gallery-close-v3:hover {
  background: #495057;
  transform: scale(1.05);
}

/* Content */
.gallery-content-v3 {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 1.5rem;
}

/* Album Grid */
.album-grid-v3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  overflow-y: auto;
  height: 100%;
  padding: 0 0.5rem;
}

.album-item-v3 {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  border: 1px solid #e9ecef;
}

.album-item-v3:hover {
  transform: scale(1.02);
}

.album-thumbnail-v3 {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.album-item-v3:hover .album-thumbnail-v3 {
  transform: scale(1.05);
}

.album-overlay-v3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.album-item-v3:hover .album-overlay-v3 {
  transform: translateY(0);
}

.album-name-v3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  line-height: 1.2;
}

.album-count-v3 {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0;
}

/* Album View */
.album-view-v3 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: none;
  flex-direction: column;
  z-index: 20;
}

.album-view-v3.active {
  display: flex;
}

.album-view-header-v3 {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9ecef;
  background: white;
  flex-shrink: 0;
}

.album-view-title-v3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.album-back-btn-v3 {
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.album-back-btn-v3:hover {
  background: #495057;
}

.album-images-grid-v3 {
  flex: 1;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  overflow-y: auto;
}

.album-image-item-v3 {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
}

.album-image-item-v3:hover {
  transform: scale(1.02);
}

.album-image-v3 {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.album-image-item-v3:hover .album-image-v3 {
  transform: scale(1.05);
}

/* Lightbox */
.lightbox-v3 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.lightbox-v3.active {
  display: flex;
}

.lightbox-image-v3 {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close-v3 {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.lightbox-close-v3:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.lightbox-nav-v3 {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav-v3:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.lightbox-prev-v3 {
  left: 1rem;
}

.lightbox-next-v3 {
  right: 1rem;
}

.lightbox-counter-v3 {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
}

/* Loading States */
.gallery-loading-v3 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  font-size: 1rem;
  flex-direction: column;
  gap: 1rem;
}

.loading-spinner-v3 {
  width: 32px;
  height: 32px;
  border: 3px solid #e9ecef;
  border-top: 3px solid #6c757d;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Empty State */
.gallery-empty-v3 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  text-align: center;
  flex-direction: column;
  gap: 1rem;
}

.gallery-empty-v3 i {
  font-size: 3rem;
  opacity: 0.5;
}

.gallery-empty-v3 h3 {
  font-size: 1.25rem;
  margin: 0;
  opacity: 0.8;
}

.gallery-empty-v3 p {
  font-size: 1rem;
  margin: 0;
  opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .album-grid-v3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  
  .album-images-grid-v3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .gallery-header-v3 {
    padding: 1rem;
  }
  
  .gallery-title-v3 {
    font-size: 1.25rem;
  }
  
  .gallery-content-v3 {
    padding: 1rem;
  }
  
  .album-grid-v3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0 0.25rem;
  }
  
  .album-view-header-v3 {
    padding: 1rem;
  }
  
  .album-images-grid-v3 {
    padding: 0;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .lightbox-close-v3 {
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .album-grid-v3 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .album-images-grid-v3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gallery-title-v3 {
    font-size: 1.125rem;
  }
  
  .album-view-title-v3 {
    font-size: 1.125rem;
  }
}

/* Touch-friendly improvements */
@media (hover: none) {
  .album-item-v3:hover,
  .album-image-item-v3:hover {
    transform: none;
  }
  
  .album-item-v3:hover .album-thumbnail-v3,
  .album-image-item-v3:hover .album-image-v3 {
    transform: none;
  }
  
  .album-item-v3:hover .album-overlay-v3 {
    transform: translateY(0);
  }
}

/* Smooth transitions */
.gallery-container-v3,
.album-view-v3,
.lightbox-v3 {
  transition: all 0.3s ease;
}

/* Scrollbar styling */
.album-grid-v3::-webkit-scrollbar,
.album-images-grid-v3::-webkit-scrollbar {
  width: 6px;
}

.album-grid-v3::-webkit-scrollbar-track,
.album-images-grid-v3::-webkit-scrollbar-track {
  background: #f1f3f4;
  border-radius: 3px;
}

.album-grid-v3::-webkit-scrollbar-thumb,
.album-images-grid-v3::-webkit-scrollbar-thumb {
  background: #c1c7cd;
  border-radius: 3px;
}

.album-grid-v3::-webkit-scrollbar-thumb:hover,
.album-images-grid-v3::-webkit-scrollbar-thumb:hover {
  background: #a8b0b8;
}

/* Focus states for accessibility */
.gallery-close-v3:focus,
.album-back-btn-v3:focus,
.lightbox-close-v3:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .album-item-v3,
  .album-image-item-v3,
  .album-thumbnail-v3,
  .album-image-v3,
  .album-overlay-v3 {
    transition: none;
  }
  
  .loading-spinner-v3 {
    animation: none;
  }
}