/* ============================================
   GALLERY COMPONENT STYLES
   Hover-to-show-caption with Flipkart 3D effect
   ============================================ */

.gallery-container {
  width: 100%;
  padding: var(--space-md, 2rem) 0;
}

/* Category Filters */
.gallery-filters {
  display: flex;
  gap: var(--space-sm, 1rem);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg, 2rem);
}

.filter-btn {
  padding: 10px 24px;
  background: transparent;
  border: 2px solid var(--glass-border, rgba(250, 143, 49, 0.2));
  border-radius: 50px;
  color: var(--text-primary, #f0f0f0);
  font-weight: 600;
  font-size: var(--font-size-sm, 0.9rem);
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: capitalize;
}

.filter-btn:hover {
  border-color: var(--primary, #FA8F31);
  background: rgba(250, 143, 49, 0.1);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary, #FA8F31), var(--primary-dark, #F16D26));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(250, 143, 49, 0.4);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md, 1.5rem);
  padding: var(--space-sm, 1rem) 0;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm, 1rem);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Gallery Item */
.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  perspective: 1000px;
}

.gallery-item:focus {
  outline: 2px solid var(--primary, #FA8F31);
  outline-offset: 4px;
}

/* Flipkart-style 3D tilt on hover */
.gallery-item.hovered {
  transform: scale(1.05) rotateY(2deg) rotateX(2deg);
  box-shadow: 
    0 10px 40px rgba(250, 143, 49, 0.3),
    0 0 20px rgba(250, 143, 49, 0.2);
  z-index: 10;
}

/* Image Wrapper */
.gallery-image-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--glass-bg, rgba(11, 6, 5, 0.4));
}

.gallery-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.4s ease;
}

.gallery-item.hovered .gallery-image-wrapper img {
  transform: scale(1.1);
  filter: brightness(0.9);
}

/* Placeholder shimmer effect */
.image-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(11, 6, 5, 0.6) 0%,
    rgba(250, 143, 49, 0.2) 50%,
    rgba(11, 6, 5, 0.6) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.placeholder-shimmer {
  width: 100%;
  height: 100%;
}

/* Caption Overlay */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md, 1.5rem);
  background: linear-gradient(
    to top,
    rgba(11, 6, 5, 0.95) 0%,
    rgba(11, 6, 5, 0.8) 60%,
    transparent 100%
  );
  backdrop-filter: blur(10px);
  color: #fff;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-caption.visible {
  transform: translateY(0);
  opacity: 1;
}

.gallery-caption h4 {
  font-size: var(--font-size-base, 1rem);
  font-weight: 700;
  color: var(--primary, #FA8F31);
  margin: 0 0 var(--space-xs, 0.5rem) 0;
}

.gallery-caption p {
  font-size: var(--font-size-sm, 0.9rem);
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 var(--space-xs, 0.5rem) 0;
  line-height: 1.4;
}

.gallery-caption .image-date {
  font-size: var(--font-size-xs, 0.8rem);
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

/* Empty State */
.gallery-empty {
  text-align: center;
  padding: var(--space-xl, 4rem) var(--space-md, 2rem);
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
}

.gallery-empty .material-icons {
  font-size: 64px;
  color: var(--glass-border, rgba(250, 143, 49, 0.2));
  margin-bottom: var(--space-md, 1rem);
}

.gallery-empty p {
  font-size: var(--font-size-lg, 1.25rem);
}

/* ============================================
   LIGHTBOX MODAL
   ============================================ */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: var(--z-modal, 1000);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md, 2rem);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(250, 143, 49, 0.2);
  transform: rotate(90deg);
}

.lightbox-close .material-icons {
  font-size: 32px;
}

/* Navigation Buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(11, 6, 5, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border, rgba(250, 143, 49, 0.2));
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-nav:hover {
  background: var(--primary, #FA8F31);
  border-color: var(--primary, #FA8F31);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav .material-icons {
  font-size: 32px;
  color: #fff;
}

.lightbox-prev {
  left: -70px;
}

.lightbox-next {
  right: -70px;
}

@media (max-width: 768px) {
  .lightbox-prev {
    left: 10px;
  }
  
  .lightbox-next {
    right: 10px;
  }
  
  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}

/* Image Container */
.lightbox-image-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md, 1.5rem);
  background: rgba(11, 6, 5, 0.3);
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
}

.lightbox-image-container img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: opacity 0.3s ease;
  border-radius: 8px;
}

/* Loading Spinner */
.lightbox-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(250, 143, 49, 0.2);
  border-top-color: var(--primary, #FA8F31);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Lightbox Caption */
.lightbox-caption {
  background: rgba(11, 6, 5, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border, rgba(250, 143, 49, 0.2));
  border-radius: 12px;
  padding: var(--space-md, 1.5rem);
  color: #fff;
}

.lightbox-caption h3 {
  font-size: var(--font-size-xl, 1.5rem);
  font-weight: 700;
  color: var(--primary, #FA8F31);
  margin: 0 0 var(--space-sm, 0.75rem) 0;
}

.lightbox-caption p {
  font-size: var(--font-size-base, 1rem);
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 var(--space-sm, 0.75rem) 0;
  line-height: 1.6;
}

.lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm, 0.9rem);
  color: rgba(255, 255, 255, 0.7);
  padding-top: var(--space-sm, 0.75rem);
  border-top: 1px solid rgba(250, 143, 49, 0.2);
}

.meta-date {
  font-style: italic;
}

.meta-counter {
  font-weight: 600;
  color: var(--primary, #FA8F31);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .lightbox-overlay {
    padding: var(--space-sm, 1rem);
  }
  
  .lightbox-container {
    max-height: 95vh;
  }
  
  .lightbox-image-container {
    min-height: 300px;
  }
  
  .lightbox-image-container img {
    max-height: 60vh;
  }
  
  .lightbox-caption {
    padding: var(--space-sm, 1rem);
  }
  
  .lightbox-caption h3 {
    font-size: var(--font-size-lg, 1.25rem);
  }
  
  .lightbox-nav {
    width: 40px;
    height: 40px;
  }
  
  .lightbox-nav .material-icons {
    font-size: 24px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Auto-show caption on tap for touch devices */
  .gallery-item:active .gallery-caption {
    transform: translateY(0);
    opacity: 1;
  }
}
