/**
 * 🖼️ Lightbox moderne pour images
 * Affichage en overlay avec zoom, fermeture ESC/click
 */

/* Overlay fullscreen */
.bes-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: var(--bes-z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--bes-duration-base) var(--bes-ease-out);
  cursor: zoom-out;
}

.bes-lightbox.active {
  display: flex;
  opacity: 1;
}

/* Image container */
.bes-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bes-space-4);
  animation: scaleIn var(--bes-duration-base) var(--bes-ease-bounce);
}

/* Image agrandie */
.bes-lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--bes-radius-lg);
  box-shadow: var(--bes-shadow-2xl);
  cursor: default;
}

/* Bouton fermeture */
.bes-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: var(--bes-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bes-border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--bes-transition-fast);
  z-index: 10;
}

.bes-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--bes-primary);
  transform: rotate(90deg) scale(1.1);
  box-shadow: var(--bes-shadow-lg);
}

.bes-lightbox-close svg {
  width: 24px;
  height: 24px;
  color: white;
  stroke-width: 2.5;
}

/* Caption sous l'image (optionnel) */
.bes-lightbox-caption {
  max-width: 600px;
  padding: var(--bes-space-3) var(--bes-space-4);
  background: var(--bes-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bes-border-light);
  border-radius: var(--bes-radius-lg);
  color: white;
  font-size: var(--bes-text-sm);
  text-align: center;
  line-height: var(--bes-leading-relaxed);
}

/* Loading spinner pendant chargement image */
.bes-lightbox-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--bes-primary);
  border-radius: 50%;
  animation: spin var(--bes-duration-slow) linear infinite;
}

/* Responsive mobile */
@media (max-width: 768px) {
  .bes-lightbox-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .bes-lightbox-close svg {
    width: 20px;
    height: 20px;
  }

  .bes-lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .bes-lightbox-image {
    max-height: 80vh;
  }

  .bes-lightbox-caption {
    font-size: var(--bes-text-xs);
    max-width: 90vw;
  }
}
