/* ==================================================
   Header and Subheader Spacing Fix
   Corrige l'espacement entre le menu et les titres
   ================================================== */

/* ==================================================
   DESKTOP (992px+)
   ================================================== */
@media only screen and (min-width: 992px) {
  
  /* Réduire l'espace du header */
  header.header-static {
    margin-bottom: 0 !important;
    padding-bottom: 15px !important;
  }
  
  header.header-static.transparent {
    margin-bottom: 0 !important;
  }
  
  /* Supprimer les marges-top du header */
  header.header-static.mt-lg-4 {
    margin-top: 0 !important;
  }
  
  header.header-static.pt-lg-2 {
    padding-top: 20px !important;
  }
  
  /* Réduire l'espace du subheader - espacement optimal */
  #subheader {
    margin-top: 0 !important;
    padding-top: 110px !important;
    padding-bottom: 90px !important;
  }
  
  #subheader.sm-mt-90 {
    margin-top: 0 !important;
  }
  
  /* Ajuster le container du subheader */
  #subheader .container {
    padding-top: 0 !important;
  }
  
  /* Espacement du contenu */
  #subheader .row {
    margin-top: 0 !important;
  }
  
  #subheader h1 {
    margin-top: 0 !important;
    margin-bottom: 15px !important;
  }
  
  #subheader .crumb {
    margin-top: 10px !important;
  }
  
  /* Espacement entre header et content */
  header + #content {
    margin-top: 0 !important;
  }
  
  header ~ #subheader {
    margin-top: 0 !important;
  }
}

/* ==================================================
   TABLET (768px - 991px)
   ================================================== */
@media only screen and (min-width: 768px) and (max-width: 991.98px) {
  
  header.header-static {
    margin-bottom: 0 !important;
    padding-bottom: 12px !important;
    padding-top: 15px !important;
  }
  
  header.header-static.mt-lg-4 {
    margin-top: 0 !important;
  }
  
  #subheader {
    margin-top: 0 !important;
    padding-top: 90px !important;
    padding-bottom: 70px !important;
  }
  
  #subheader.sm-mt-90 {
    margin-top: 0 !important;
  }
  
  #subheader h1 {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
  }
  
  #subheader .crumb {
    margin-top: 8px !important;
  }
}

/* ==================================================
   MOBILE (< 768px)
   ================================================== */
@media only screen and (max-width: 767.98px) {
  
  header.header-static {
    margin-bottom: 0 !important;
    padding-bottom: 10px !important;
    padding-top: 15px !important;
  }
  
  header {
    margin-bottom: 0 !important;
  }
  
  header.header-static.mt-lg-4 {
    margin-top: 0 !important;
  }
  
  /* Calculer la hauteur exacte du header pour éviter le chevauchement */
  header {
    position: relative !important;
    z-index: 1000 !important;
  }
  
  header.header-static,
  header.transparent {
    height: auto !important;
    min-height: 70px !important;
  }
  
  /* Augmenter le padding-top pour éviter que le titre soit caché */
  #subheader {
    margin-top: 0 !important;
    padding-top: 100px !important;
    padding-bottom: 50px !important;
    position: relative !important;
    z-index: 1 !important;
  }
  
  #subheader.sm-mt-90 {
    margin-top: 0 !important;
    padding-top: 100px !important;
  }
  
  #subheader .container {
    padding-top: 0 !important;
  }
  
  #subheader h1 {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    padding-top: 0 !important;
    position: relative !important;
    z-index: 2 !important;
  }
  
  #subheader .crumb {
    margin-top: 8px !important;
    position: relative !important;
    z-index: 2 !important;
  }
  
  /* Réduire l'espacement du header transparent - S'assurer qu'il est visible */
  header.transparent {
    padding-bottom: 10px !important;
    background: rgba(24, 29, 36, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* S'assurer que le header est toujours visible */
  header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: rgba(24, 29, 36, 0.95) !important;
  }
  
  /* S'assurer que le header ne chevauche pas le contenu */
  header + #content,
  header ~ #content {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  
  header + #content #subheader,
  header ~ #content #subheader {
    padding-top: 100px !important;
  }
  
  /* Fix pour le carrousel de la page d'accueil - éviter qu'il soit masqué par le header */
  header.transparent + #content > section.text-light.no-top.no-bottom {
    padding-top: 80px !important;
    margin-top: 0 !important;
  }
  
  header.transparent ~ #content > section.text-light.no-top.no-bottom:first-child {
    padding-top: 80px !important;
    margin-top: 0 !important;
  }
}

/* ==================================================
   AJUSTEMENTS GLOBAUX
   ================================================== */

/* Supprimer toutes les marges entre header et content/subheader */
header + #content {
  margin-top: 0 !important;
}

header ~ #subheader {
  margin-top: 0 !important;
}

/* Fix pour le header transparent avec margin-top */
header.transparent.mt-lg-4 {
  margin-top: 0 !important;
}

/* Fix pour éviter les doubles marges */
#content.no-top {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Ajuster spécifiquement le subheader qui suit le header */
header.header-static ~ #content #subheader,
header.header-static + #content #subheader {
  margin-top: 0 !important;
}

/* Réduire le padding-top global du subheader */
#subheader {
  padding-top: 110px !important;
}

@media only screen and (max-width: 991.98px) {
  #subheader {
    padding-top: 90px !important;
  }
}

@media only screen and (max-width: 767.98px) {
  #subheader {
    padding-top: 100px !important;
  }
  
  /* S'assurer que le titre n'est jamais caché */
  #subheader h1 {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  
  /* Fix pour le carrousel de la page d'accueil - éviter qu'il soit masqué par le header */
  header.transparent + #content > section.text-light.no-top.no-bottom {
    padding-top: 80px !important;
    margin-top: 0 !important;
  }
  
  header.transparent ~ #content > section.text-light.no-top.no-bottom:first-child {
    padding-top: 80px !important;
    margin-top: 0 !important;
  }
  
  /* S'assurer que la section du carrousel a un espacement suffisant */
  section.text-light.no-top.no-bottom {
    padding-top: 80px !important;
    margin-top: 0 !important;
  }
}
