/**
 * Responsive - Site Hello Elementor
 * Header compact, boutons au-dessus de la barre de recherche sur mobile,
 * hauteur du header réduite progressivement, contenu du body centré.
 */

/* ========== LARGEUR DE L'ENTÊTE : ne pas dépasser l'écran ========== */
.elementor-location-header,
.elementor-location-header .elementor-section,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
  box-sizing: border-box !important;
}

.elementor-location-header .elementor-section > .e-con,
.elementor-location-header .elementor-section > .elementor-container,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) > .e-con,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) > .elementor-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

@media (max-width: 767px) {
  .elementor-location-header,
  .elementor-location-header .elementor-section,
  .elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

@media (max-width: 479px) {
  .elementor-location-header,
  .elementor-location-header .elementor-section,
  .elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }
}

/* Annuler les largeurs > 100% définies dans les templates Elementor pour l'entête */
.elementor-location-header .elementor-section,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
  --width: 100% !important;
}

/* Header natif du thème */
#site-header.site-header,
.site-header.dynamic-header,
.site-header .header-inner {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.site-header:not(.header-full-width) .header-inner {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

@media (max-width: 767px) {
  .site-header .header-inner {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* ========== Hauteur du header réduite progressivement ========== */
.elementor-location-header .elementor-section,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
  --header-padding-block: clamp(0.5rem, 2vw, 1rem);
  padding-top: var(--header-padding-block) !important;
  padding-bottom: var(--header-padding-block) !important;
  min-height: 0 !important;
}

.elementor-location-header .elementor-section > .e-con,
.elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) > .e-con {
  min-height: 0 !important;
  align-items: center !important;
}

/* Réduction supplémentaire sur petits écrans */
@media (max-width: 1024px) {
  .elementor-location-header .elementor-section,
  .elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
}

@media (max-width: 767px) {
  .elementor-location-header .elementor-section,
  .elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
}

/* ========== Téléphone : menu, boutique, appel AU-DESSUS de la barre de recherche ========== */
@media (max-width: 767px) {
  /* Conteneur principal du header en colonne */
  .elementor-location-header .elementor-section > .e-con,
  .elementor-section:has(.xpro-elementor-search):has(.xpro-elementor-horizontal-menu) > .e-con {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  /* Colonne qui contient menu + search + boutons : disposition en 2 lignes */
  .elementor-location-header .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search),
  .elementor-section:has(.xpro-elementor-search) .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0.5rem 0.75rem !important;
    order: 2;
  }

  /* Ligne du haut : menu + boutique + appel (même ligne) */
  .elementor-location-header .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search) > .elementor-widget-xpro-horizontal-menu,
  .elementor-location-header .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search) > .e-con:has(.xpro-elementor-button),
  .elementor-location-header .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search) > .e-con:has(.wpr-pc-wrapper),
  .elementor-section:has(.xpro-elementor-search) .e-con:has(.xpro-elementor-search) > .elementor-widget-xpro-horizontal-menu,
  .elementor-section:has(.xpro-elementor-search) .e-con:has(.xpro-elementor-search) > .e-con:has(.xpro-elementor-button),
  .elementor-section:has(.xpro-elementor-search) .e-con:has(.xpro-elementor-search) > .e-con:has(.wpr-pc-wrapper) {
    order: 1 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
  }

  /* Barre de recherche : pleine largeur en dessous */
  .elementor-location-header .e-con:has(.xpro-elementor-horizontal-menu):has(.xpro-elementor-search) > .elementor-widget-xpro-search,
  .elementor-section:has(.xpro-elementor-search) .e-con:has(.xpro-elementor-search) > .elementor-widget-xpro-search {
    order: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-top: 0.25rem !important;
  }

  /* Input de recherche en pleine largeur sur mobile */
  .elementor-location-header .xpro-elementor-search-input-group > input,
  .elementor-section:has(.xpro-elementor-search) .xpro-elementor-search-input-group > input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .elementor-location-header .xpro-elementor-search-wrapper,
  .elementor-section:has(.xpro-elementor-search) .xpro-elementor-search-wrapper {
    width: 100% !important;
    text-align: center !important;
  }
}

/* Header natif du thème (sans Elementor header) */
@media (max-width: 767px) {
  .site-header.dynamic-header .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .site-header {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
}

/* ========== Tous les éléments du body bien centrés ========== */
body .elementor-section.elementor-section-boxed > .elementor-container,
body .e-con-boxed {
  margin-left: auto !important;
  margin-right: auto !important;
}

body .elementor .elementor-section,
body .elementor .e-con {
  box-sizing: border-box;
}

/* Contenu principal centré */
body:not([class*="elementor-page-"]) .site-main,
body .site-main {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Sections Elementor centrées */
.elementor-section.elementor-section-boxed > .elementor-container {
  margin-inline: auto !important;
}

/* Largeurs max cohérentes et centrage */
@media (min-width: 576px) {
  body .site-main {
    max-width: 540px;
  }
}
@media (min-width: 768px) {
  body .site-main {
    max-width: 720px;
  }
}
@media (min-width: 992px) {
  body .site-main {
    max-width: 960px;
  }
}
@media (min-width: 1200px) {
  body .site-main {
    max-width: 1140px;
  }
}

/* Pages Elementor : centrage du contenu global */
.elementor-page .elementor {
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
}

.elementor-page .elementor-section-full_width,
.elementor-page .elementor-section-width-full {
  max-width: 100vw;
}

.elementor-page .elementor-section-boxed .elementor-container {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ========== Menu Xpro : panneau fermé par défaut, ne pas élargir le site ========== */
/* Éviter tout défilement horizontal dû au panneau du menu */
html,
body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* Panneau du menu (à droite) : fermé par défaut, hors écran et invisible */
.xpro-elementor-horizontal-menu-responsive-mobile,
.xpro-elementor-horizontal-menu-responsive-tablet {
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translate3d(100%, 0, 0) !important;
  -webkit-transform: translate3d(100%, 0, 0) !important;
}

.xpro-elementor-horizontal-menu-responsive-mobile.xpro-push-left,
.xpro-elementor-horizontal-menu-responsive-tablet.xpro-push-left {
  transform: translate3d(-100%, 0, 0) !important;
  -webkit-transform: translate3d(-100%, 0, 0) !important;
}

/* Quand on clique sur le bouton menu : panneau visible */
.xpro-elementor-horizontal-menu-responsive-mobile.active,
.xpro-elementor-horizontal-menu-responsive-tablet.active {
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
}

/* Overlay du menu : affiché seulement quand le panneau est ouvert */
.xpro-elementor-horizontal-menu-overlay {
  display: block !important;
}
.xpro-elementor-horizontal-menu-overlay:not(.active) {
  pointer-events: none !important;
}

/* ==========================================================================
   RESPONSIVE GLOBAL – TOUTES LES PAGES DU SITE
   ========================================================================== */

/* --- Base : pas de débordement horizontal --- */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* --- Conteneurs Elementor : largeur et padding adaptatifs --- */
.elementor-section,
.elementor-section .elementor-container,
.e-con,
.e-con-inner {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.elementor-section-boxed > .elementor-container,
.e-con-boxed {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (max-width: 767px) {
  .elementor-section-boxed > .elementor-container,
  .e-con-boxed {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (max-width: 479px) {
  .elementor-section-boxed > .elementor-container,
  .e-con-boxed {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* --- Colonnes Elementor : empiler sur petit écran si besoin --- */
@media (max-width: 767px) {
  .elementor-column-wrap,
  .elementor-widget-wrap {
    width: 100% !important;
  }
}

/* --- Images et médias : ne jamais dépasser le conteneur --- */
img,
video,
iframe,
embed,
object,
.elementor-widget-image img,
.elementor-widget-video iframe,
.xpro-elementor-gallery img,
.wp-post-image,
.attachment-full {
  max-width: 100% !important;
  height: auto !important;
  vertical-align: middle;
}

.elementor-widget-video .elementor-fit-aspect-ratio {
  max-width: 100%;
}

/* --- Titres : taille réduite sur mobile --- */
@media (max-width: 767px) {
  .elementor-heading-title,
  h1.elementor-heading-title { font-size: clamp(1.5rem, 5vw, 2rem) !important; }
  h2.elementor-heading-title { font-size: clamp(1.25rem, 4vw, 1.75rem) !important; }
  h3.elementor-heading-title { font-size: clamp(1.1rem, 3.5vw, 1.5rem) !important; }
  h4.elementor-heading-title, h5.elementor-heading-title, h6.elementor-heading-title {
    font-size: clamp(1rem, 3vw, 1.25rem) !important;
  }
}

@media (max-width: 479px) {
  .elementor-heading-title,
  .entry-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* --- Texte et paragraphes --- */
.elementor-text-editor,
.elementor-widget-text-editor {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Boutons : pleine largeur sur très petit écran si utile --- */
@media (max-width: 479px) {
  .elementor-button-wrapper,
  .xpro-elementor-button {
    max-width: 100%;
  }
  .elementor-button-wrapper .elementor-button,
  .xpro-elementor-button {
    width: 100%;
    max-width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
}

/* --- Tableaux : défilement horizontal --- */
.elementor-widget-table .elementor-widget-container,
.table-responsive,
.wp-block-table,
table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.elementor-widget-table table,
table {
  min-width: 100%;
}

/* --- Formulaires --- */
@media (max-width: 767px) {
  .elementor-field-group,
  .wpcf7-form-control-wrap,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* --- Grilles et galeries --- */
.elementor-gallery,
.xpro-elementor-gallery,
.elementor-posts-container {
  max-width: 100%;
}

/* --- Footer --- */
.elementor-location-footer .elementor-section,
.site-footer .footer-inner {
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 575px) {
  .site-footer .footer-inner,
  .elementor-location-footer .elementor-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* --- Contenu WordPress classique (pages sans Elementor) --- */
.page-content,
.entry-content,
.post-content,
.site-main {
  max-width: 100%;
  overflow-wrap: break-word;
}

.page-content img,
.entry-content img,
.post-content img {
  max-width: 100%;
  height: auto;
}

/* --- Blocs full width : limiter à la largeur de l'écran --- */
.alignfull,
.elementor-section.elementor-section-stretched {
  max-width: 100vw;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%);
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* --- Espacements adaptatifs --- */
@media (max-width: 1024px) {
  .elementor-section > .elementor-container,
  .e-con {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 767px) {
  .elementor-section > .elementor-container,
  .e-con {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .elementor-element .elementor-widget-container {
    padding: 0;
  }
}

@media (max-width: 479px) {
  .elementor-section > .elementor-container,
  .e-con {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* --- Widgets Xpro / tiers : conteneur fluide --- */
.elementor-widget-xpro-search .xpro-elementor-search-wrapper,
.elementor-widget-xpro-button .xpro-elementor-button,
.elementor-widget-wpr-page-list .wpr-pc-wrapper {
  max-width: 100%;
}

/* --- Empêcher tout élément de faire déborder la page --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body .elementor-element,
body .elementor-widget {
  max-width: 100%;
}
