/**
 * Carousel avec Lightbox - Styles CSS
 * Utilise Swiper.js
 * 
 * @package Npru\Theme
 * @since 1.0.0
 */

/* ====================
   Variables CSS
   ==================== */
:root {
  --carousel-gap: 20px;
  --carousel-border-radius: 8px;
  --carousel-overlay-bg: rgba(0, 0, 0, 0.3);
  --carousel-overlay-hover-bg: rgba(0, 0, 0, 0.5);
  --carousel-nav-size: 44px;
  --carousel-nav-color: #fff;
  --carousel-nav-bg: rgba(0, 0, 0, 0.7);
  --carousel-nav-hover-bg: rgba(0, 0, 0, 0.9);
  --lightbox-bg: rgba(0, 0, 0, 0.95);
  --lightbox-nav-size: 60px;
  --lightbox-close-size: 40px;
  --lightbox-z-index: 9999;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* ====================
   Bloc Carousel
   ==================== */
.carousel-lightbox {
  margin: 2rem 0;
}

.carousel-lightbox__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.carousel-lightbox__title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #333;
}

.carousel-lightbox__wrapper {
  position: relative;
}

/* ====================
   Swiper Customization
   ==================== */
.carousel-lightbox .swiper {
  padding: 0;
  margin: 0;
  overflow: hidden; /* Cache les slides adjacentes */
}

.carousel-lightbox .swiper-wrapper {
  display: flex;
  align-items: stretch;
}

.carousel-lightbox .swiper-slide {
  height: auto;
  display: flex;
}

/* ====================
   Slides du Carousel
   ==================== */
.carousel-lightbox__slide {
  position: relative;
  width: 100%;
  height: 300px;
  border-radius: var(--carousel-border-radius);
  overflow: hidden;
  background: #f5f5f5;
  transition: transform var(--transition-fast);
}

.carousel-lightbox__slide:hover {
  transform: translateY(-2px);
}

.carousel-lightbox__image-button {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: block;
  overflow: hidden;
}

.carousel-lightbox__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.carousel-lightbox__image-button:hover .carousel-lightbox__image {
  transform: scale(1.05);
}

/* ====================
   Overlay et icône zoom
   ==================== */
.carousel-lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--carousel-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.carousel-lightbox__image-button:hover .carousel-lightbox__overlay,
.carousel-lightbox__image-button:focus .carousel-lightbox__overlay {
  opacity: 1;
}

.carousel-lightbox__zoom-icon {
  width: 48px;
  height: 48px;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ====================
   Légendes des slides
   ==================== */
.carousel-lightbox__slide-caption {
  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 var(--transition-fast);
}

.carousel-lightbox__slide:hover .carousel-lightbox__slide-caption {
  transform: translateY(0);
}

.carousel-lightbox__slide-caption p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ====================
   Navigation Swiper
   ==================== */
.carousel-lightbox__nav {
  position: absolute;
  width: var(--carousel-nav-size);
  height: var(--carousel-nav-size);
  background: var(--carousel-nav-bg);
  border-radius: 50%;
  color: var(--carousel-nav-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.carousel-lightbox__nav:hover {
  background: var(--carousel-nav-hover-bg);
  transform: translateY(-50%) scale(1.1);
}

.carousel-lightbox__nav::after {
  font-size: 18px;
  font-weight: bold;
}

.carousel-lightbox__nav.swiper-button-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-lightbox__nav.swiper-button-disabled:hover {
  background: var(--carousel-nav-bg);
  transform: translateY(-50%) scale(1);
}

/* ====================
   Pagination Swiper
   ==================== */
.carousel-lightbox__pagination {
  position: relative;
  margin-top: 1.5rem;
  text-align: center;
}

.carousel-lightbox__pagination .swiper-pagination-bullet {
  width: 12px;
  height: 12px;
  background: #ccc;
  opacity: 1;
  transition: all var(--transition-fast);
}

.carousel-lightbox__pagination .swiper-pagination-bullet-active {
  background: #007cba;
  transform: scale(1.2);
}

/* ====================
   Lightbox Modal
   ==================== */
.carousel-lightbox__modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--lightbox-z-index);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.carousel-lightbox__modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.carousel-lightbox__modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--lightbox-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.carousel-lightbox__modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ====================
   Bouton fermer lightbox
   ==================== */
.carousel-lightbox__modal-close {
  position: absolute;
  top: -60px;
  right: 0;
  width: var(--lightbox-close-size);
  height: var(--lightbox-close-size);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}

.carousel-lightbox__modal-close:hover {
  background: white;
  transform: scale(1.1);
}

.carousel-lightbox__close-icon {
  width: 20px;
  height: 20px;
  color: #333;
}

/* ====================
   Navigation lightbox
   ==================== */
.carousel-lightbox__modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--lightbox-nav-size);
  height: var(--lightbox-nav-size);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
}

.carousel-lightbox__modal-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.carousel-lightbox__modal-nav--prev {
  left: -80px;
}

.carousel-lightbox__modal-nav--next {
  right: -80px;
}

.carousel-lightbox__modal-nav svg {
  width: 24px;
  height: 24px;
  color: #333;
}

/* ====================
   Image lightbox
   ==================== */
.carousel-lightbox__modal-image-container {
  position: relative;
  max-width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-lightbox__modal-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--carousel-border-radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ====================
   Légende et compteur lightbox
   ==================== */
.carousel-lightbox__modal-caption {
  margin-top: 1rem;
  max-width: 600px;
  text-align: center;
}

.carousel-lightbox__modal-caption p {
  color: white;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

.carousel-lightbox__modal-counter {
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ====================
   État body avec modal ouverte
   ==================== */
body.carousel-lightbox-modal-open {
  overflow: hidden;
}

/* ====================
   Empty state
   ==================== */
.carousel-lightbox__empty {
  padding: 3rem;
  text-align: center;
  background: #f8f9fa;
  border-radius: var(--carousel-border-radius);
  border: 2px dashed #dee2e6;
}

.carousel-lightbox__empty p {
  margin: 0;
  color: #6c757d;
  font-style: italic;
}

/* ====================
   Responsive Design
   ==================== */
@media (max-width: 768px) {
  .carousel-lightbox .swiper {
    padding: 0 30px;
    margin: 0 -30px;
  }
  
  .carousel-lightbox__nav {
    width: 36px;
    height: 36px;
  }
  
  .carousel-lightbox__nav::after {
    font-size: 14px;
  }
  
  .carousel-lightbox__modal-backdrop {
    padding: 1rem;
  }
  
  .carousel-lightbox__modal-close {
    top: -50px;
    width: 36px;
    height: 36px;
  }
  
  .carousel-lightbox__close-icon {
    width: 18px;
    height: 18px;
  }
  
  .carousel-lightbox__modal-nav {
    width: 48px;
    height: 48px;
  }
  
  .carousel-lightbox__modal-nav--prev {
    left: -60px;
  }
  
  .carousel-lightbox__modal-nav--next {
    right: -60px;
  }
  
  .carousel-lightbox__modal-image-container {
    max-height: 60vh;
  }
  
  .carousel-lightbox__slide {
    height: 200px;
  }
}

@media (max-width: 480px) {
  .carousel-lightbox .swiper {
    padding: 0 20px;
    margin: 0 -20px;
  }
  
  .carousel-lightbox__nav {
    width: 32px;
    height: 32px;
  }
  
  .carousel-lightbox__modal-nav--prev {
    left: 10px;
  }
  
  .carousel-lightbox__modal-nav--next {
    right: 10px;
  }
  
  .carousel-lightbox__modal-close {
    top: 10px;
    right: 10px;
  }
  
  .carousel-lightbox__slide {
    height: 180px;
  }
  
  .carousel-lightbox__title {
    font-size: 1.5rem;
  }
}

/* ====================
   Focus et accessibilité
   ==================== */
.carousel-lightbox__image-button:focus,
.carousel-lightbox__nav:focus,
.carousel-lightbox__modal-close:focus,
.carousel-lightbox__modal-nav:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Animation d'apparition de la modal */
.carousel-lightbox__modal[aria-hidden="false"] .carousel-lightbox__modal-content {
  animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
