/**
 * Gallery Styles - Styles pour la galerie
 * Pour CobaltWeb
 */

/* Solution sans barre de défilement visible, mais en prévenant les sauts de mise en page */
html {
  /* Au lieu de overflow-y: scroll qui montre toujours la barre de défilement */
  scrollbar-gutter: stable; /* Réserve l'espace pour la barre de défilement sans l'afficher */
}

/* Fallback pour les navigateurs ne supportant pas scrollbar-gutter */
@supports not (scrollbar-gutter: stable) {
  html {
    /* Calcul de la largeur de la barre de défilement et ajout de padding pour compensation */
    padding-right: calc(100vw - 100%);
    overflow-x: hidden; /* Évite les barres horizontales */
  }
}

/* Style spécifique pour la section slide05 - Effet de dégradé sur le fp-scroller */
[data-section="slide05"] .fp-scroller {
  /* Masque pour créer un effet de disparition en haut et en bas */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
}

/* Style pour .fp-scrollable dans la section slide05 */
[data-section="slide05"] .fp-scrollable {
  /* Masque pour créer un effet de disparition en haut et en bas */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
}

/* Style pour le sélecteur complet mentionné */
#fullpage > div.section.animated-row.fp-section.fp-table.active.fp-completely > div > div > div.fp-scroller {
  /* Masque pour créer un effet de disparition en haut et en bas */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 4%, rgba(0,0,0,1) 96%, rgba(0,0,0,0));
}

/* Amélioration de la transition des éléments intérieurs lors du défilement */
[data-section="slide05"] .gallery-container {
  position: relative;
  z-index: 1;
}

/* Effet de transition pour les éléments de la galerie lors du défilement */
[data-section="slide05"] .gallery-item-wrapper {
  transition: opacity 0.4s ease, transform 0.4s ease;
  will-change: opacity, transform;
}

/* Styles de base pour la galerie */
.gallery-container {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden; /* Prévient le défilement horizontal */
}

/* Grille Packery */
.gallery-grid {
  width: 100%;
  position: relative;
  box-sizing: border-box;
}

/* Élément de référence pour les colonnes - DESKTOP: 4 colonnes */
.grid-sizer {
  width: 25%; /* 4 colonnes en desktop */
}

/* Wrapper pour les éléments de galerie - Styles communs */
.gallery-item-wrapper {
  float: left; /* Important pour Packery */
  box-sizing: border-box;
  padding: 5px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Format carré: 1x1 - DESKTOP: 1/4 de largeur */
.gallery-item-wrapper.width-1.height-1 {
  width: 25%; /* 1/4 de largeur en desktop */
}

/* Format paysage: 2x1 - DESKTOP: 1/2 de largeur */
.gallery-item-wrapper.width-2.height-1 {
  width: 50%; /* 1/2 de largeur en desktop */
}

/* Format portrait: 1x2 - DESKTOP: 1/4 de largeur */
.gallery-item-wrapper.width-1.height-2 {
  width: 25%; /* 1/4 de largeur en desktop */
}

.gallery-item-wrapper.show {
  opacity: 1;
  transform: translateY(0);
}

/* Élément de galerie */
.gallery-item {
  position: relative;
  width: 100%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Format carré: 1x1 */
.gallery-item-wrapper.width-1.height-1 .gallery-item {
  padding-bottom: 100%; /* Hauteur égale à la largeur (carré parfait) */
}

/* Format paysage: 2x1 */
.gallery-item-wrapper.width-2.height-1 .gallery-item {
  padding-bottom: 50%; /* Moitié de la hauteur par rapport à la largeur */
}

/* Format portrait: 1x2 */
.gallery-item-wrapper.width-1.height-2 .gallery-item {
  padding-bottom: 200%; /* Double de la hauteur par rapport à la largeur */
}

.gallery-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Indicateur pour les vidéos et GIFs */
.media-indicator {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  z-index: 2;
  transition: all 0.3s ease;
}

.gallery-item:hover .media-indicator {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

/* Style spécifique pour l'indicateur vidéo */
.media-indicator .fa-play-circle {
  color: #e74c3c;
}

/* Style spécifique pour l'indicateur GIF */
.media-indicator .fa-image {
  color: #9b59b6;
}

/* Effet de survol */
.gallery-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.gallery-item:hover::before {
  opacity: 1;
}

.gallery-item::after {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 60px;
  height: 60px;
  background: rgba(52, 152, 219, 0.8);
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2;
}

.gallery-item:hover::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Overlay pour affichage plein écran */
.gallery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

.gallery-overlay.closing {
  animation: fadeOut 0.3s forwards;
}

/* Styles spécifiques pour les vidéos */
video.media-content {
  background-color: #000;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 90vh;
  display: block;
  margin: 0 auto;
  z-index: 1;
  filter: brightness(2) !important;
}

/* Conteneur centré pour les médias */
.centered-media-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
  transition: opacity 0.5s ease;
  opacity: 0;
  width: 100%;
  height: 100%;
}

.centered-media-container.loaded {
  opacity: 1;
}

/* Style pour le contenu média */
.media-content {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 5px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
}

/* Contrôles vidéo personnalisés */
video::-webkit-media-controls {
  background-color: rgba(0, 0, 0, 0.5);
}

video::-webkit-media-controls-panel {
  padding: 5px;
}

/* Panneau d'informations */
.media-info-panel {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 10px;
  width: 300px;
  color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.5s ease;
}

.media-info-panel.loaded {
  transform: translateX(0);
  opacity: 1;
}

.media-info-panel h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: #fff;
}

.media-info-panel p {
  font-size: 14px;
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.8);
}

.media-info-panel .tech-info {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Bouton de fermeture */
.overlay-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.overlay-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Media queries pour la responsivité */
/* BREAKPOINT PRINCIPAL: 768px - passage de 4 à 3 colonnes */
@media (max-width: 768px) {
  /* 3 colonnes en responsive */
  .grid-sizer,
  .gallery-item-wrapper.width-1.height-1,
  .gallery-item-wrapper.width-1.height-2 {
    width: 33.33%; /* Exactement 1/3 pour 3 colonnes */
  }
  
  .gallery-item-wrapper.width-2.height-1 {
    width: 66.66%; /* Exactement 2/3 pour éléments larges */
  }
  
  /* Ajustement des gaps */
  .gallery-item-wrapper {
    padding: 4px; /* Réduire légèrement le padding pour les petits écrans */
  }
}

/* Très petits écrans seulement - garder 3 colonnes mais réduire spacing */
@media (max-width: 480px) {
  .gallery-item-wrapper {
    padding: 2px; /* Réduire davantage pour les très petits écrans */
  }
  
  /* Forcer une hauteur carrée pour les formats portrait */
  .gallery-item-wrapper.width-1.height-2 .gallery-item {
    padding-bottom: 100%; /* Format carré pour les très petits écrans */
  }
}

/* Indicateur de chargement dans l'overlay */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 10;
}

.loading-indicator .spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto 10px;
}

.loading-indicator span {
  display: block;
  font-size: 14px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.8);
}

/* Animation pour le spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Message d'erreur */
.error-message {
  padding: 20px;
  background: rgba(255, 0, 0, 0.3);
  color: white;
  border-radius: 10px;
  text-align: center;
  font-size: 16px;
}

/* Indicateur de progression pour l'upload */
.upload-progress {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  height: 30px;
  margin: 15px 0;
  position: relative;
  overflow: hidden;
}

.upload-progress .progress-bar {
  height: 100%;
  background: #3498db;
  width: 0%;
  transition: width 0.3s;
}

.upload-progress .progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Style pour les éléments en cours de déplacement (drag) */
.gallery-item-wrapper.is-dragging {
  z-index: 2;
  cursor: grabbing;
}

.gallery-item-wrapper.is-dragging .gallery-item {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
  opacity: 0.8;
}

/* Notification de sauvegarde */
.save-notification {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 20px;
  border-radius: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.save-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.save-notification i {
  margin-right: 10px;
}

.save-notification.success {
  border-left: 4px solid #2ecc71;
}

.save-notification.error {
  border-left: 4px solid #e74c3c;
} 