.services-bg-1,
.services-bg-2,
.services-bg-3,
.services-bg-4,
.services-bg-5 {
  width: 100%;
  height: 100%;
  min-height: 350px;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.video-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* Chemins d'images */

/* CORRECTION DU POSITIONNEMENT */
#services-wrapper {
  padding: 50px 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.halves-services {
  margin-bottom: 50px;
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 400px;
  /* IMPORTANT: Forcer la hauteur */
  height: auto;
}

.halves-services:last-child {
  margin-bottom: 0;
}

.halves-services .half {
  width: 50%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* CORRECTION: Assurer le positionnement relatif */
  flex: 1;
}

/* CORRECTION IMPORTANTE: Container pour les images */
.halves-services .half:first-child {
  position: relative;
  overflow: hidden;
}

.img-fullwidth-wrapper {
  padding: 30px;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
}

.img-fullwidth-txt-services-right,
.img-fullwidth-txt-services-left {
  padding: 40px;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
  background-color: rgba(255, 255, 255, 0.95);
  /* Légère transparence pour éviter les conflits */
}

/* Styles pour les conteneurs de texte */
.center-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-block {
  width: 100%;
  max-width: 500px;
  text-align: left;
}

/* CORRECTION: Styles pour les titres et sous-titres */
.section-subheading {
  margin-bottom: 20px;
}

.section-subheading h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.section-subheading span {
  position: relative;
  padding-bottom: 10px;
}

.services-heading {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin: 8px 0;
  color: #333;
}

.services-number-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #999;
  margin-bottom: 20px;
}

/* Styles pour le contenu */
.post-txt {
  font-size: 16px;
  line-height: 1.6;
  color: #666;
  margin: 20px 0;
}

.post-txt p {
  margin: 0 0 15px 0;
}

/* Diviseurs */
.inner-divider-post {
  width: 50px;
  height: 2px;
  background-color: #ddd;
  margin: 20px 0;
}

.inner-divider-in-post {
  width: 30px;
  height: 1px;
  background-color: #eee;
  margin: 15px 0;
}

/* CORRECTION: Classes pour la visibilité mobile */
.visible-mobile-devices {
  display: none !important;
}

.hidden-mobile-devices {
  display: block !important;
}

/* CORRECTION MAJEURE: Ajustements pour mobile */
@media only screen and (max-width: 768px) {
  #services-wrapper {
    padding: 30px 0;
  }

  .halves-services {
    margin-bottom: 30px;
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  .halves-services .half {
    width: 100% !important;
    min-height: 300px;
    flex: none;
  }

  .img-fullwidth-wrapper {
    padding: 20px;
  }

  .img-fullwidth-txt-services-right,
  .img-fullwidth-txt-services-left {
    padding: 20px;
    background-color: white;
  }

  .services-heading {
    font-size: 28px;
  }

  .center-block {
    max-width: 100%;
  }

  /* CORRECTION: Affichage mobile pour les images */
  .visible-mobile-devices {
    display: flex !important;
    position: relative;
    /* Assurer que le conteneur parent prend la hauteur de son contenu */
    min-height: unset;
  }

  .visible-mobile-devices .video-wrapper {
    position: relative;
    width: 100%;
    /* Utilise padding-bottom pour maintenir le ratio 9:16 (16/9 = 1.777 -> 177.7%) */
    padding-bottom: 177.77%; /* (hauteur / largeur) * 100% pour un ratio 9:16 */
    height: 0;
    overflow: hidden; /* Cache tout débordement de l'aspect ratio */
    max-width: 360px; /* Limite la largeur du conteneur */
    margin: 0 auto; /* Centre le conteneur horizontalement */
  }

  .visible-mobile-devices .video-wrapper .video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .hidden-mobile-devices {
    display: none !important;
  }

  /* Réorganisation pour mobile */
  .services-bg-1,
  .services-bg-2,
  .services-bg-3,
  .services-bg-4,
  .services-bg-5 {
    position: relative;
    min-height: 250px;
  }
}

/* CORRECTION: Ajustements pour tablettes */
@media only screen and (max-width: 1024px) and (min-width: 769px) {
  .services-heading {
    font-size: 32px;
  }

  .img-fullwidth-txt-services-right,
  .img-fullwidth-txt-services-left {
    padding: 30px;
  }

  .halves-services .half {
    min-height: 300px;
  }
}

/* CORRECTION: Styles pour éviter les conflits avec Bootstrap */
.halves-services .half {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}

.img-fullwidth-wrapper,
.img-fullwidth-txt-services-right,
.img-fullwidth-txt-services-left {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}

/* CORRECTION: Reset des styles qui pourraient interférer */
#services * {
  box-sizing: border-box;
}

#services .row {
  margin-left: 0;
  margin-right: 0;
}

#services .col-lg-12 {
  padding-left: 15px;
  padding-right: 15px;
}

/* CORRECTION: Forcer le positionnement correct */
.halves-services {
  clear: both;
  width: 100%;
  display: flex !important;
  flex-wrap: nowrap;
}

/* CORRECTION: Éviter les débordements */
.container-fluid.sections {
  overflow-x: hidden;
  width: 100%;
}

/* CORRECTION: Styles pour les écrans très larges */
@media only screen and (min-width: 1200px) {
  .halves-services .half {
    min-height: 450px;
  }

  .services-heading {
    font-size: 40px;
  }
}

/* CORRECTION: Fallback pour les navigateurs plus anciens */
.halves-services {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
}

.halves-services .half {
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}
.video-portrait {
  width: 100%;
  max-width: 360px;        /* ne jamais dépasser la taille native */
  aspect-ratio: 9 / 16;    /* garde le format téléphone */
  height: auto;            /* laissé à l'aspect-ratio */
  object-fit: cover;       /* pas de bandes noires (format identique, pas de recadrage visible) */
  border-radius: 8px;
  display: block;
  margin: 0 auto;          /* centrage horizontal de sécurité */
}

/* Centrage dans les colonnes vidéo */
.half.visible-mobile-devices,
.half.hidden-mobile-devices {
  display: flex;
  align-items: center;      /* centre verticalement */
  justify-content: center;  /* centre horizontalement */
}

/* Centrage de la vidéo portrait sur les grands écrans */
.half.hidden-mobile-devices .video-bg.video-portrait {
  left: 50%;
  transform: translateX(-50%);
}

/* Optionnel: donner de la hauteur pour que le centrage vertical soit visible */
.halves-services {
  min-height: 60vh;         /* ajuste selon ton design */
}

/* Correction pour la plage d'écrans 600px - 980px */
@media only screen and (min-width: 600px) and (max-width: 980px) {
  .halves-services {
    flex-direction: row;
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap; /* Assure que les halves restent sur une seule ligne si possible */
  }

  .halves-services .half {
    width: 50% !important;
    min-height: 300px; /* Ajuste la hauteur minimale pour cette plage */
  }

  /* S'assurer que le texte prend sa place */
  .img-fullwidth-txt-services-right,
  .img-fullwidth-txt-services-left {
    padding: 30px;
  }
}

