/* Switch-multiple custom style */
.switch-multiple {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  background: #fff;
  border: 2px solid var(--c-secondaire, #1976d2);
  border-radius: 0.6rem;
  gap: 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  width: fit-content;
  overflow: hidden;
  padding: 0.5rem;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 1;
  flex-grow: 0;
}

#switch-presentiel-rch {
  top: -1.8rem;
  left: 0.5rem;
}

.switch-multiple input[type="radio"] {
  display: none;
}

.switch-multiple label {
  cursor: pointer;
  padding: 0.15rem 0.7rem;
  border-radius: 0;
  transition: background 0.2s, color 0.2s;
  color: var(--c-secondaire, #1976d2) !important;
  background: transparent;
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  line-height: normal;
  box-sizing: border-box;
  margin: 0;
}

.switch-multiple input[type="radio"]:checked + label {
  background: #d6f3fc;
  color: var(--c-secondaire, #1976d2);
  box-shadow: none;
  z-index: 2;
  padding: 0.15rem 0.7rem;
  height: auto;
  line-height: normal;
  border-radius: 0.4rem;
}

.switch-multiple label + label {
  border-left: 1px solid transparent;
}

.switch-multiple .slider-option {
  display: none;
}
#bSansAgrementRch ~ label,
#bSansAgrementRch + span,
.field.weight-400 {
  font-size: 1rem !important;
  font-weight: 400;
  white-space: nowrap;
}
.field_datepicker {
  align-items: center;
}

.field_datepicker i.material-icons {
  font-size: 2rem;
  vertical-align: middle;
  margin-right: 0.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
}

.field.weight-400 {
  font-size: 1.1rem;
}

#bSansAgrementRch ~ label,
#bSansAgrementRch + span,
.field.weight-400 {
  font-size: 1rem !important;
  font-weight: 400;
}

.field_datepicker {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  flex: 1 1 0;
}

/* .field_datepicker input[type="text"].datepicker {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
} */


/* Layout du formulaire de recherche */
.filtre_recherche {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.field-recherche {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1rem;
  color: var(--c-secondaire);
  margin-bottom: 0;
  width: 100%;
  flex-shrink: 0;
  flex-grow: 0;
  min-width: 0;
  box-sizing: border-box; 
}

div.field-recherche:nth-child(7) {
  flex: 1 1 0;
  flex-direction: column;
  padding-top: 0 !important;
}

div.filtre-haut {
  height: 3rem;
}

/* Forcer tous les <select> à occuper la même largeur que les champs date */
.field-recherche select {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.field_datepicker {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  flex: 1 1 0;
}

/* .field_datepicker input[type="text"].datepicker {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex:  1 1 0 !important;
  /* max-width: 33% !important; 
} */

#bSansAgrementRch[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: block;
  z-index: 2;
}

#bSansAgrementRch[type="checkbox"]:checked::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 4px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  z-index: 3;
}

/* Checkbox rond pour #bSansAgrementRch */
#bSansAgrementRch[type="checkbox"] {
  width: 1.2rem !important;
  height: 1.2rem !important;
  border-radius: 50% !important;
  border: 2px solid var(--c-secondaire, #1976d2);
  accent-color: var(--c-secondaire, #1976d2);
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.2s;
}


#bSansAgrementRch[type="checkbox"]:checked {
  background: var(--c-secondaire, #1976d2);
  /* box-shadow: 0 0 0 2px #fff inset; */
}

#bSansAgrementRch[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px #90caf9;
}

#sRechercheCommunes,
#sRechercheKilometre,
#nTypeFormationRch {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='20' viewBox='0 0 16 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 1C9.85622 1 11.4793 1.64062 12.9102 2.95996C14.2833 4.22611 15.0006 5.93574 15 8.2002C14.9999 9.59946 14.4418 11.2176 13.1836 13.0771C12.0325 14.7782 10.3129 16.6429 8 18.6738C5.68666 16.6424 3.96684 14.7785 2.81641 13.0781C1.5589 11.2194 1.00072 9.60045 1 8.2002C1 5.93566 1.71761 4.22618 3.09082 2.95996C4.52174 1.64055 6.14453 1 8 1Z' stroke='%23592494' stroke-width='2'/%3E%3C/svg%3E%0A");
  background-repeat: no-repeat;
  background-position: 1.5rem center;
  padding: 1rem 3rem 1rem 4rem;
  height: 1rem;
  width: 20rem;
  border-radius: 0.6rem;
  border: none;
  color: var(--c-secondaire);
  font-size: 1.4rem;
  border: 1px solid var(--c-secondaire);
  border-radius: 50px;
}

#sRechercheCommunes::placeholder {
  color: var(--c-secondaire);
  opacity: 0.7;
  font-size: 1.3rem;
  font-style: italic;
}

.field-recherche > *:not(.switch-multiple) {
  flex: 1 1 0 !important;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.icon_filtre {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-top: 0.6rem;
}

.field-ligne-2 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: 1.4rem !important;
}

#eSectionNormale {
  margin-top: 2rem;
}

/* ==========================================================
   Autocomplétion commune — s'ajoute à vos styles existants,
   ne redéfinit rien de vos classes (.recherche_general, .weight-400, ...)
   ========================================================== */

  /* Le champ input existe déjà dans votre CSS : on ne touche qu'à
   son conteneur direct, pour pouvoir positionner la liste en absolu. */
  .recherche_general {
    position: relative;
  }

  .ca-loading {
    position:absolute;
    top:50%;
    right:14px;
    transform:translateY(-50%);
    width:14px;
    height:14px;
    border-radius:50%;
    border:2px solid #e2e5e9;
    border-top-color:#0f5fa6;
    animation:ca-spin .6s linear infinite;
    display:none;
    pointer-events:none;
  }

  .ca-loading.is-visible {
    display:block;
  }

  @keyframes ca-spin {
    to {
      transform:translateY(-50%) rotate(360deg);
    }
  }

  .ca-list {
    list-style:none;
    margin:6px 0 0;
    padding:6px;
    position:absolute;
    top:100%;
    left:0;
    min-width:260px;
    background:#fff;
    border:1px solid #e2e5e9;
    border-radius:8px;
    box-shadow:0 8px 24px rgba(16, 24, 40, .12);
    max-height:280px;
    overflow-y:auto;
    z-index:50;
    display:none;
  }

  .ca-list.is-open {
    display:block;
  }

  .ca-option {
    display:flex;
    align-items:baseline;
    gap:8px;
    padding:9px 10px;
    border-radius:6px;
    cursor:pointer;
    font-size:14px;
    color:#1f2933;
  }

  .ca-option .ca-nom {
    font-weight:500;
  }

  .ca-option .ca-cp {
    color:#6b7280;
    font-size:12.5px;
    margin-left:auto;
    white-space:nowrap;
  }

  .ca-option[aria-selected="true"],
  .ca-option:hover {
    background:#eaf3fb;
  }

  .ca-empty {
    padding:10px;
    font-size:13px;
    color:#6b7280;
  }

    #sRechercheKilometre:disabled {
      background-color: #e9ecef;
      color: #6c757d;
      cursor: not-allowed;
      opacity: 0.65;
      border-color: #ced4da;
    }

.location-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
}

.location-group:hover, .location-group:focus {
  text-decoration: none;
}

.distance-text {
  color: #6c757d;
  font-size: 14px;
  font-weight: 500;
}

.btn-primary {
  justify-content: center;
  border-radius: 3rem !important;
}

.action_uniscite_btn_recherche_formation {
  flex: 0 0 auto !important;
  width: fit-content !important;
}

.select2-dropdown {
  border: 1px solid var(--c-secondaire, #592494) !important;
  /* border-top: none !important; */
  border-radius: 1.5rem 1.5rem !important;
  background: var(--c-tertiaire, #f9f6fe) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Titre de domaine (gras, majuscule, noir) */
.select2-results__option .select2-option--domaine {
  color: #161616 !important;
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  background: transparent !important;
  cursor: default !important;
}

/* Sous-domaine (violet, lien) */
.select2-results__option .select2-option--sous-domaine {
  color: var(--c-secondaire, #592494) !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  background: transparent !important;
  padding: 1rem 1rem !important;
}

.select2-results__option.select2-option--sous-domaine:hover,
.select2-container--default .select2-results__option--highlighted[aria-selected].select2-option--sous-domaine {
  color: #161616 !important;
  background: transparent !important;
  text-decoration: underline;
}

/* Enlever le highlight par défaut sur le titre de domaine */
.select2-container--default .select2-results__option--highlighted[aria-selected].select2-option-domaine {
  background: transparent !important;
  color: #161616 !important;
}

.select2-container--default .select2-results>.select2-results__options {
  padding: 1rem 1rem;
  max-height: 400px;
}

.select2-container--default .select2-search--dropdown {
  padding: 0.5rem 2rem !important;
  background: transparent !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: none !important;
  border-bottom: 2px solid var(--c-secondaire, #592494) !important;
  border-radius: 0 !important;
  padding: 0.5rem 0 !important;
  font-size: 0.8rem !important;
  color: var(--c-secondaire, #592494) !important;
  background: transparent !important;
  outline: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
  color: var(--c-secondaire, #592494);
  opacity: 0.5;
}

@media (max-width: 900px) {
  .field-recherche.force-padding-05  {
   flex-direction: column;
  }
  .field.weight-400 {
    padding-left: 0;
  }
  .field-ligne-2 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  #sRechercheCommunes {
    width: 10rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    background-size: 1rem;
    background-position: 0.3rem center;
  }
  #sRechercheCommunes::placeholder {
    font-size: 0.7rem;
  }
}
/* ============================================================
   ADAPTATIONS MOBILE — à ajouter à la fin de vos fichiers CSS
   (breakpoint principal : 768px, cohérent avec vos règles
   existantes à 900px / 768px)
   ============================================================ */

@media (max-width: 768px) {

  /* ---------- 1. CONTENEURS GÉNÉRAUX ---------- */
  /* Ces éléments sont actuellement figés à 1160px de large :
     ils débordent sur mobile et provoquent un scroll horizontal. */
  .main-container,
  #taille_responsive,
  header .main-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #contenu {
    padding: 0 1rem !important;
  }

  /* ---------- 2. BLOC RECHERCHE FORMATION ---------- */
  #filtre_formation {
    margin-left: 0 !important;
    /* était 60px, casse l'alignement sur mobile */
  }

  .recherche_general {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  /* #sRechercheCommunes : en desktop, height:1rem + padding:1rem 3rem
     est calculé en content-box, ce qui écrase visuellement le champ
     sur mobile. On repasse en border-box avec une hauteur explicite. */
  #sRechercheCommunes {
    box-sizing: border-box !important;
    width: 100% !important;
    height: auto !important;
    min-height: 3rem;
    padding: 0.75rem 1.5rem 0.75rem 3rem !important;
    background-position: 1rem center !important;
    font-size: 1rem !important;
    line-height: normal;
  }

  .more_filtre.btn_filtre_formation {
    align-self: flex-start;
  }

  /* Le bloc de filtres avancés passe en colonne */
  .filtre_recherche,
  #formulaire_recherche_formation .filtre_recherche {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  #formulaire_recherche_formation .filtre_recherche>* {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 auto !important;
  }

  #formulaire_recherche_formation .filtre_recherche .select2-container,
  #formulaire_recherche_formation .filtre_recherche .field_datepicker {
    width: 100% !important;
  }

  /* #sRechercheKilometre : même souci de box-model que #sRechercheCommunes
     (width:20rem + padding 1rem 3rem en content-box), il dépasse du
     conteneur sur mobile. On force border-box + largeur fluide.
     Il hérite aussi d'une icône de localisation en background-image
     (règle commune avec #sRechercheCommunes) : on garde de la place
     à gauche pour elle au lieu de la faire chevaucher le texte. */
  #formulaire_recherche_formation .filtre_recherche #sRechercheKilometre,
  #sRechercheKilometre {
    box-sizing: border-box !important;
    width: 100% !important;
    height: auto !important;
    min-height: 3rem;
    padding: 0.75rem 1rem 0.75rem 2.75rem !important;
    background-position: 0.9rem center !important;
    background-size: 1rem !important;
    font-size: 1rem !important;
  }

  .field-recherche {
    flex-direction: column;
    align-items: stretch;
  }

  div.field-recherche:nth-child(7) {
    padding-top: 0.5rem !important;
  }

  .field_datepicker {
    flex-direction: row;
    /* icône + champ restent sur une ligne */
  }

  /* ---------- 3. CARTES DE FORMATION ---------- */
  /* .card_formation est calée sur 33% -> une seule colonne sur mobile */
  .card_formation {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    padding: 1.25rem;
  }

  /* ==========================================================
     REFONTE COMPLÈTE de .event-card pour coller à la maquette :
     - bordure fine dégradée sur les 4 coins (au lieu des 2 grosses
       barres latérales ::before/::after de 15px)
     - tailles et espacements resserrés
     - hiérarchie typographique : labels fins, valeurs en gras
     ========================================================== */
  .event-card,
  .event-card * {
    box-sizing: border-box !important;
  }

  .event-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 22px !important;
    border: 2px solid transparent;
    background-image: linear-gradient(#FAF7FF, #FAF7FF),
      linear-gradient(126.88deg, #2821A9 0%, #B34474 50%, #AE90DC 98.96%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    padding: 1.4rem 1.3rem !important;
    gap: 16px !important;
    margin-bottom: 0.5rem;
  }

  .section_formation {
    flex-direction: column;
    gap: 1.1rem;
    /* respiration entre les cartes */
  }

  /* ----- Header : date à gauche / distance + picto lieu à droite ----- */
  .card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .date-text {
    font-size: 1.1rem;
    font-weight: 700;
  }

  .status-pill {
    font-size: 11px;
    padding: 3px 10px;
    white-space: nowrap;
  }

  .location-group {
    gap: 6px;
  }

  .distance-text {
    font-size: 0.8rem;
  }

  .location-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .location-icon .material-icons {
    font-size: 16px;
  }

  /* ----- Titre : petite icône ronde + texte compact ----- */
  .card-title-row {
    gap: 10px;
    margin-top: 2px;
  }

  .title-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  .card-title {
    font-size: 1.15rem;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* ----- Description ----- */
  .card-description {
    font-size: 1rem;
    line-height: 1.55;
    color: #555;
    margin: 0;
    overflow-wrap: break-word;
  }

  /* ----- Meta (durée / par / lieu) ----- */
  .card-meta {
    gap: 10px;
    margin: 0;
  }

  .card-meta li {
    font-size: 1rem;
    line-height: 1.4;
    align-items: flex-start;
    gap: 8px;
    color: #272727;
  }

  .card-meta li .meta-icon {
    font-size: 16px;
    margin-top: 1px;
    flex-shrink: 0;
    color: #8a8a8a;
  }

  .card-meta li>span:not(.meta-icon) {
    min-width: 0;
    font-weight: 400;
    /* "par", "Rhône" en poids normal */
  }

  .card-meta li strong {
    font-weight: 700;
  }

  /* Ligne "Rhône VENISSIEUX" : pas d'icône dans la maquette, on aligne
     simplement le texte avec les lignes du dessus (largeur icône + gap) */
  .meta-location {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-left: 24px;
  }

  /* ----- Bouton ----- */
  .card-cta {
    width: 100%;
    justify-content: center;
    padding: 12px 18px !important;
    font-size: 1.05rem;
    border-radius: 999px;
    margin-top: 4px;
  }

  .cta-icon {
    width: 26px;
    height: 26px;
  }

  /* Texte des cartes (card_formation) : les span internes sont à
     1.1rem/1.2rem en desktop, trop grand une fois la carte en pleine
     largeur mobile. */
  .card_formation span {
    font-size: 0.9rem !important;
  }

  .card_formation span.dDateFormation {
    font-size: 1rem !important;
  }

  .card_formation .lieu,
  .card_formation .duree {
    font-size: 0.9rem !important;
  }

  .card_formation .sTitreLibelle {
    font-size: 1rem !important;
  }

  /* ---------- 4. THÉMATIQUES (déjà 50% ≥900px, on passe à 100% en dessous de 768) ---------- */
  .thematique_formation .une_thematique {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* ---------- 5. TITRES / BANDEAU ---------- */
  #bandeau_accueil_parcours {
    font-size: 1.6rem;
  }

  .bandeau_accueil {
    font-size: 1rem;
  }

  h2 {
    font-size: 1.5rem !important;
    white-space: normal;
    /* évite la troncature sur petit écran */
  }

  h2:after,
  h1:after {
    display: none;
    /* le trait décoratif casse la mise en page en colonne */
  }

  /* ---------- 6. IMAGE DE PRÉSENTATION ---------- */
  .picto_formation {
    height: 220px;
    /* la valeur desktop (460px) est disproportionnée sur mobile */
    border-top-left-radius: 60px;
    border-top-right-radius: 60px;
  }

  /* Photo de groupe : zoom sur le haut pour ne pas afficher les têtes coupées en bas du cadre */
  .photo_accueil {
    overflow: hidden;
    /* force Safari à rogner l'image zoomée (transform) selon les coins arrondis */
    isolation: isolate;
    margin-bottom: 20px;
    border-top-left-radius: 60px;
    border-top-right-radius: 60px;
  }

  .photo_accueil .picto_formation {
    display: block;
    /* ratio fixe (celui d'un écran de 375px) pour garder le même cadrage quelle que soit la largeur */
    height: auto;
    aspect-ratio: 313 / 220;
    margin-bottom: 0;
    border-radius: 0;
    object-position: center 31%;
    transform: scale(1.3);
    transform-origin: center 31%;
  }

  .presentation_formation {
    font-size: 1rem;
  }

  /* ---------- 7. BOUTONS PLEINE LARGEUR ---------- */
  .btn-primary,
  .btn-secondary,
  #formation_savoir_plus {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .more_formation .btn-primary {
    width: auto;
    /* garder ce bouton centré, pas forcément pleine largeur */
  }
}

/* ============================================================
   Petit mobile (≤ 480px) : resserrer encore un peu
   ============================================================ */
@media (max-width: 480px) {
  #bandeau_accueil_parcours {
    font-size: 1.3rem !important;
  }

  .card-title {
    font-size: 0.9rem !important;
  }

  .card_formation,
  .event-card {
    padding: 1.1rem !important;
    gap: 12px !important;
  }

  .card-description,
  .card-meta li {
    font-size: 0.6rem !important;
  }
}