/* G2RD Carousel Styles */

.g2rd-carousel {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Header Styles */
.carousel-header {
  position: relative;
  margin-bottom: 30px;
}

.carousel-badge {
  position: absolute;
  left: 20px;
  top: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  z-index: 10;
}

.badge-icon {
  margin-right: 6px;
  color: #eebde0;
}

.carousel-title {
  text-align: center;
  padding-top: 60px;
  margin-bottom: 30px;
}

.carousel-title h2 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0 0 10px 0;
  color: inherit;
  opacity: inherit;
}

.carousel-title p {
  font-size: 1.1rem;
  color: var(--wp--preset--color--secondary, #666);
  margin: 0;
}

/* Container Styles */
.carousel-container {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  align-items: center;
}

/* Swiper Styles - Version moderne */
.swiper {
  width: 100%;
  padding-bottom: 50px;
}

.swiper-slide {
  background-position: center;
  background-size: cover;
  width: 280px;
  height: 350px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Box shadow désactivé */
.carousel-slide.no-shadow {
  box-shadow: none;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.carousel-slide:hover .carousel-image {
  transform: scale(1.03);
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  margin: 0;
  font-size: 14px;
  text-align: center;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Styles pour les informations des posts */
.carousel-post-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 20px 15px 15px;
  margin: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.carousel-post-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: white;
}

.carousel-post-excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Navigation Styles - Design moderne */
.swiper-button-prev,
.swiper-button-next {
  background: var(--wp--preset--color--primary, #667eea);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  color: var(--wp--preset--color--background, white);
  box-shadow: 0 8px 25px
    var(--wp--preset--color--primary, rgba(102, 126, 234, 0.3));
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid
    var(--wp--preset--color--background, rgba(255, 255, 255, 0.2));
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.swiper-button-prev::before,
.swiper-button-next::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 35px
    var(--wp--preset--color--primary, rgba(102, 126, 234, 0.4));
  background: var(--wp--preset--color--secondary, #5a6fd8);
}

.swiper-button-prev:hover::before,
.swiper-button-next:hover::before {
  opacity: 1;
}

.swiper-button-prev:active,
.swiper-button-next:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 4px 15px
    var(--wp--preset--color--primary, rgba(102, 126, 234, 0.3));
}

.swiper-button-prev::after,
.swiper-button-next::after {
  font-size: 20px;
  font-weight: 600;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Flèche précédente personnalisée */
.swiper-button-prev::after {
  content: "‹";
  font-size: 32px;
  line-height: 1;
}

/* Flèche suivante personnalisée */
.swiper-button-next::after {
  content: "›";
  font-size: 32px;
  line-height: 1;
}

/* Animation d'entrée pour les flèches */
.swiper-button-prev,
.swiper-button-next {
  animation: slideInButtons 0.6s ease-out;
}

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

/* Styles pour les couleurs personnalisées du thème */
.has-primary-color .swiper-button-prev,
.has-primary-color .swiper-button-next {
  background: var(--wp--preset--color--primary);
}

.has-secondary-color .swiper-button-prev,
.has-secondary-color .swiper-button-next {
  background: var(--wp--preset--color--secondary);
}

.has-primary-background-color .swiper-button-prev,
.has-primary-background-color .swiper-button-next {
  color: var(--wp--preset--color--primary);
}

.has-secondary-background-color .swiper-button-prev,
.has-secondary-background-color .swiper-button-next {
  color: var(--wp--preset--color--secondary);
}

/* Pagination avec couleurs du thème */
.has-primary-color .swiper-pagination-bullet-active {
  background: var(--wp--preset--color--primary);
}

.has-secondary-color .swiper-pagination-bullet-active {
  background: var(--wp--preset--color--secondary);
}

/* Responsive pour les flèches */
@media (max-width: 768px) {
  .swiper-button-prev,
  .swiper-button-next {
    width: 45px;
    height: 45px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .swiper-button-prev,
  .swiper-button-next {
    width: 40px;
    height: 40px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 24px;
  }
}

/* Pagination Styles */
.swiper-pagination {
  bottom: 10px;
}

.swiper-pagination-bullet {
  background: var(--wp--preset--color--text, rgba(0, 0, 0, 0.3));
  opacity: 1;
  transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
  background: var(--wp--preset--color--primary, #007cba);
  transform: scale(1.2);
}

/* Coverflow Effect Styles */
.swiper-3d .swiper-slide-shadow-left,
.swiper-3d .swiper-slide-shadow-right {
  background: none;
}

/* Amélioration de l'effet Coverflow */
.swiper-effect-coverflow .swiper-slide {
  width: 280px;
  height: 350px;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  /* Assurer que les slides se suivent */
  position: relative;
  z-index: 1;
}

/* Ajustement de l'espacement selon le nombre de slides visibles */
.swiper[data-slides-per-view="1"] .swiper-slide {
  width: 100%;
  max-width: 400px;
}

.swiper[data-slides-per-view="3"] .swiper-slide {
  width: 280px;
}

.swiper[data-slides-per-view="5"] .swiper-slide {
  width: 200px;
}

.swiper[data-slides-per-view="7"] .swiper-slide {
  width: 150px;
}

.swiper-effect-coverflow .swiper-slide-active {
  transform: scale(1.1) translateZ(0);
  z-index: 3;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
}

.swiper-effect-coverflow .swiper-slide-prev,
.swiper-effect-coverflow .swiper-slide-next {
  transform: scale(0.85) translateZ(-100px);
  opacity: 0.7;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

/* Slides plus éloignées - défilement progressif */
.swiper-effect-coverflow .swiper-slide-prev + .swiper-slide,
.swiper-effect-coverflow .swiper-slide + .swiper-slide-next {
  transform: scale(0.7) translateZ(-200px);
  opacity: 0.4;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* Toutes les autres slides */
.swiper-effect-coverflow
  .swiper-slide:not(.swiper-slide-active):not(.swiper-slide-prev):not(
    .swiper-slide-next
  ) {
  transform: scale(0.6) translateZ(-300px);
  opacity: 0.2;
  transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Alignement Wide et Full */
.wp-block-g2rd-carousel.alignwide {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.wp-block-g2rd-carousel.alignfull {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
  position: relative !important;
  left: 50% !important;
  right: 50% !important;
  margin-left: -50% !important;
  margin-right: -50% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: hidden !important;
}

/* Gestion des conflits avec les styles WordPress globaux */
.has-global-padding > .wp-block-g2rd-carousel.alignfull {
  margin-left: -50% !important;
  margin-right: -50% !important;
}

/* Assurer que le contenu interne respecte la pleine largeur */
.wp-block-g2rd-carousel.alignfull .g2rd-carousel {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 20px 0 !important;
  overflow-x: hidden !important;
}

/* S'assurer que le conteneur Swiper ne déborde pas */
.wp-block-g2rd-carousel.alignfull .swiper {
  overflow: hidden !important;
  width: 100% !important;
}

/* Gestion responsive pour alignfull */
@media (max-width: 768px) {
  .wp-block-g2rd-carousel.alignfull {
    width: 100% !important;
    margin-left: -50% !important;
    margin-right: -50% !important;
  }

  /* Ajuster les slides visibles en responsive */
  .swiper[data-slides-per-view="3"] .swiper-slide,
  .swiper[data-slides-per-view="5"] .swiper-slide,
  .swiper[data-slides-per-view="7"] .swiper-slide {
    width: 280px !important;
  }
}

@media (max-width: 480px) {
  /* Forcer 1 slide visible sur très petit écran */
  .swiper[data-slides-per-view="3"] .swiper-slide,
  .swiper[data-slides-per-view="5"] .swiper-slide,
  .swiper[data-slides-per-view="7"] .swiper-slide {
    width: 250px !important;
  }

  /* Éviter le dépassement sur très petit écran */
  .wp-block-g2rd-carousel.alignfull {
    width: 100% !important;
    margin-left: -25% !important;
    margin-right: -25% !important;
  }
}

/* Responsive Styles */
@media (max-width: 768px) {
  .g2rd-carousel {
    padding: 15px;
  }

  .carousel-title h2 {
    font-size: inherit;
  }

  .carousel-title p {
    font-size: 1rem;
  }

  /* Ajuster les slides pour mobile */
  .swiper-slide {
    width: 280px !important;
    height: 200px !important;
  }

  .carousel-badge {
    left: 15px;
    top: 15px;
    font-size: 11px;
    padding: 5px 10px;
  }

  .carousel-title {
    padding-top: 40px;
    text-align: center;
  }

  /* Ajuster l'espacement */
  .swiper {
    padding-bottom: 40px;
  }

  /* Optimiser les boutons de navigation */
  .swiper-button-prev,
  .swiper-button-next {
    width: 35px;
    height: 35px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 14px;
  }

  /* Optimiser l'effet Coverflow pour mobile */
  .swiper-effect-coverflow .swiper-slide-active {
    transform: scale(1.05) translateZ(0) !important;
  }

  .swiper-effect-coverflow .swiper-slide-prev,
  .swiper-effect-coverflow .swiper-slide-next {
    transform: scale(0.9) translateZ(-50px) !important;
    opacity: 0.8;
  }
}

@media (max-width: 480px) {
  .g2rd-carousel {
    padding: 10px;
  }

  .swiper-slide {
    width: 250px !important;
    height: 180px !important;
  }

  .carousel-title h2 {
    font-size: inherit;
  }

  .carousel-title p {
    font-size: 0.9rem;
  }

  .carousel-badge {
    left: 10px;
    top: 10px;
    font-size: 10px;
    padding: 4px 8px;
  }

  .carousel-title {
    padding-top: 30px;
  }

  /* Réduire encore plus les boutons */
  .swiper-button-prev,
  .swiper-button-next {
    width: 30px;
    height: 30px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 12px;
  }

  /* Ajuster l'espacement */
  .swiper {
    padding-bottom: 35px;
  }
}

/* Editor Preview Styles */
.g2rd-carousel-preview {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 20px;
  background: #f9f9f9;
}

.g2rd-carousel-preview .carousel-slides {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 20px 0;
}

.g2rd-carousel-preview .carousel-slide {
  flex: 0 0 200px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.g2rd-carousel-preview .carousel-navigation {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.g2rd-carousel-preview .carousel-nav-prev,
.g2rd-carousel-preview .carousel-nav-next {
  background: #007cba;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
}

.g2rd-carousel-preview .carousel-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.g2rd-carousel-preview .pagination-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
}

.g2rd-carousel-preview .pagination-dot.active {
  background: #007cba;
}

/* Fix pour l'ancienne version de Swiper */
.swiper-container {
  width: 100%;
  padding-bottom: 50px;
}

/* Amélioration de l'affichage des images */
.swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Styles pour différents effets */
.swiper-effect-slide .swiper-slide {
  width: 300px;
}

.swiper-effect-coverflow .swiper-slide {
  width: 300px;
  transform-style: preserve-3d;
}

.swiper-effect-fade .swiper-slide {
  width: 100%;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.swiper-effect-fade .swiper-slide-active {
  opacity: 1;
}
