/* ===== GALERIE DE PHOTOS RESPONSIVE ===== */

/* Variables CSS pour la responsivité - Cohérent avec projets-carousel.css */
:root {
  --gallery-item-width-mobile: 150px;
  --gallery-item-width-tablet: 160px;
  --gallery-item-width-desktop: 180px;
  
  --gallery-items-visible-mobile: 2;
  --gallery-items-visible-tablet: 3;
  --gallery-items-visible-desktop: 3;
  
  --gallery-transition-duration: 0.7s;
  --gallery-item-spacing: 16px;
}

/* ===== STYLES MOBILE SPÉCIFIQUES ===== */
.mobile-gallery-container {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  background: #f3f4f6;
}

.mobile-gallery-carousel {
  position: relative;
  width: 100%;
  height: 100%;
}

.mobile-gallery-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.mobile-gallery-item {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
}

.mobile-gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-gallery-image:hover {
  transform: scale(1.02);
}

.mobile-gallery-indicators {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  padding: .5rem;
  border-radius: .8rem;
  background: black;
  opacity: 0.5;  
}

.mobile-gallery-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-gallery-indicator.active {
  background: white;
  transform: scale(1.2);
}

/* Responsive pour tablette */
@media (min-width: 768px) {
  .mobile-gallery-container {
    height: 600px;
  }
}

/* ===== CARROUSEL DE MINIATURES ===== */
.photo-gallery-carousel {
  position: relative;
  max-width: 100%;
  overflow: hidden;
}

.carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform var(--gallery-transition-duration) ease-in-out;
  gap: var(--gallery-item-spacing);
  width: max-content; /* Permet au track de dépasser la largeur du container */
}

.carousel-item {
  flex-shrink: 0;
  transition: all 0.3s ease;
  cursor: pointer;
}

/* Effets de dégradé comme les carrousels de projets */
.photo-gallery-carousel::before,
.photo-gallery-carousel::after {
  content: "";
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Mobile */
@media (max-width: 767px) {
  .photo-gallery-carousel::before,
  .photo-gallery-carousel::after {
    width: 1rem;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1365px) {
  .photo-gallery-carousel::before,
  .photo-gallery-carousel::after {
    width: 1.5rem;
  }
}

/* Desktop */
@media (min-width: 1366px) {
  .photo-gallery-carousel::before,
  .photo-gallery-carousel::after {
    width: 2.5rem;
  }
}

.photo-gallery-carousel::before {
  left: 0;
  background: linear-gradient(to right, white, transparent);
}

.photo-gallery-carousel::after {
  right: 0;
  background: linear-gradient(to left, white, transparent);
}

.carousel-thumbnail {
  width: 100%;
  height: 8rem;
  object-fit: cover;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  aspect-ratio: 16 / 9;
}

/* Responsive - Mobile: 2 photos visibles */
@media (max-width: 767px) {
  .carousel-item {
    width: var(--gallery-item-width-mobile);
    min-width: var(--gallery-item-width-mobile);
  }
  
  .photo-gallery-carousel {
    padding: 0 1rem;
  }
  
  .carousel-track {
    padding-left: 0;
  }
  
  .carousel-thumbnail {
    height: 10rem;
  }
}

/* Responsive - Tablet: 4 photos visibles */
@media (min-width: 768px) and (max-width: 1365px) {
  .carousel-item {
    width: var(--gallery-item-width-tablet);
    min-width: var(--gallery-item-width-tablet);
  }
  
  .photo-gallery-carousel {
    padding: 0 2rem;
  }
  
  .carousel-track {
    padding-left: 0;
  }
  
  .carousel-thumbnail {
    height: 14rem;
  }
}

/* Responsive - Desktop: 5 photos visibles */
@media (min-width: 1366px) {
  .carousel-item {
    width: var(--gallery-item-width-desktop);
    min-width: var(--gallery-item-width-desktop);
  }
  
  .photo-gallery-carousel {
    padding: 0 3rem;
  }
  
  .carousel-track {
    padding-left: 0;
  }
  
  .carousel-thumbnail {
    height: 16rem;
  }
}

/* Navigation du carrousel - Style cohérent avec projets-carousel.css */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: white;
  border-radius: 50%;
  padding: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
  opacity: 0.8;
  cursor: pointer;
}

.carousel-nav-prev {
  left: 0;
}

.carousel-nav-next {
  right: 0;
}

.carousel-nav:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

/* Masquer les flèches sur mobile et tablette - Cohérent avec projets-carousel.css */
.carousel-nav {
  display: none;
}

@media (min-width: 1366px) {
  .carousel-nav {
    display: block;
    position: absolute;
  }
}

/* Indicateurs du carrousel - Style cohérent avec projets-carousel.css */
.carousel-indicators {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  gap: 0.5rem;
  padding-bottom: 0.05rem;
}

.carousel-indicator {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: #d1d5db;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.carousel-indicator:hover {
  transform: scale(1.2);
  background-color: #9ca3af;
}

.carousel-indicator.active {
  background-color: #626772;
  transform: scale(1.1);
}

/* ===== MODAL PLEIN ÉCRAN ===== */
#fullscreenGallery {
  backdrop-filter: blur(4px);
}

.gallery-main-container {
  position: relative;
  max-width: 97vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-main-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.5rem;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

.gallery-main-image.zoomed {
  transform: scale(1.5);
  cursor: zoom-out;
}

.gallery-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1.125rem;
  font-weight: 500;
  max-width: 80%;
}

/* Navigation plein écran */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  z-index: 20;
}

.gallery-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.gallery-nav-prev {
  left: 2rem;
}

.gallery-nav-next {
  right: 2rem;
}

/* Contrôles plein écran */
.gallery-controls {
  position: absolute;
  top: 2rem;
  right: 2rem;
  display: flex;
  gap: 0.5rem;
  z-index: 20;
}

.gallery-control-btn {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
}

.gallery-control-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

/* Indicateurs plein écran */
.gallery-fullscreen-indicators {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 20;
}

.gallery-fullscreen-indicator {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-fullscreen-indicator.active {
  background: white;
  transform: scale(1.2);
}

.gallery-fullscreen-indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
  .carousel-item {
    flex: 0 0 var(--gallery-item-width-mobile);
  }
  
  .carousel-thumbnail {
    height: 10rem;
  }
  
  .carousel-nav {
    width: 2rem;
    height: 2rem;
  }
  
  .carousel-nav-prev {
    left: 0.25rem;
  }
  
  .carousel-nav-next {
    right: 0.25rem;
  }
  
  .gallery-nav {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .gallery-nav-prev {
    left: 1rem;
  }
  
  .gallery-nav-next {
    right: 1rem;
  }
  
  .gallery-controls {
    top: 1rem;
    right: 1rem;
  }
  
  .gallery-fullscreen-indicators {
    bottom: 1rem;
  }
  
  .gallery-caption {
    font-size: 1rem;
    margin-top: 0.5rem;
  }
}

/* Tablet (768px - 1365px) */
@media (min-width: 768px) and (max-width: 1365px) {
  .carousel-item {
    flex: 0 0 var(--gallery-item-width-tablet);
  }
  
  .carousel-thumbnail {
    height: 14rem;
  }
  
  .gallery-main-image {
    max-height: 75vh;
  }
}

/* Desktop (≥ 1366px) */
@media (min-width: 1366px) {
  .carousel-item {
    flex: 0 0 var(--gallery-item-width-desktop);
  }
  
  .carousel-thumbnail {
    height: 16rem;
  }
  
  .gallery-main-image {
    max-height: 80vh;
  }
  
  .gallery-main-container {
    max-width: 85vw;
  }
}

/* ===== AMÉLIORATIONS TACTILES ET ACCESSIBILITÉ ===== */
.photo-gallery-carousel {
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.carousel-item {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Curseur de glissement sur desktop */
.photo-gallery-carousel {
  cursor: grab;
}

.photo-gallery-carousel:active {
  cursor: grabbing;
}

/* ===== ANIMATIONS ET TRANSITIONS ===== */
.carousel-track {
  transition: transform var(--gallery-transition-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-thumbnail {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-main-image {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation d'entrée pour les nouvelles photos visibles */
.carousel-item.entering {
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
  .carousel-track,
  .carousel-thumbnail,
  .gallery-main-image {
    transition: none;
  }
}

/* Focus visible pour l'accessibilité */
.carousel-nav:focus,
.gallery-nav:focus,
.gallery-control-btn:focus,
.carousel-indicator:focus,
.gallery-fullscreen-indicator:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ===== ÉTATS DE CHARGEMENT ===== */
.carousel-thumbnail[src=""] {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
