/* =========================================
   OM — Group News : CSS consolidé
   ========================================= */

/* Layout du bloc filtres */
.om-news-filters { margin-block: 1rem 1.25rem; }
.om-filters-grid { display:flex !important; flex-wrap:wrap !important; gap:.9rem !important; align-items:flex-start !important; }
.om-field .om-label { display: block; font-size: .9rem; margin-bottom: .25rem; font-weight: 600; }
.om-actions { display: flex; gap: .5rem; align-items: flex-end; }
.om-apply { cursor: pointer; }
.om-reset { text-decoration: underline; }
/* Chaque item n’est plus forcé à 100% */
.om-field{
  display:inline-flex !important;
  flex-direction:column !important;
  width:auto !important;
  min-width:auto !important;
  flex:0 0 auto !important; /* pas d’extension */
}

/* Le dropdown doit flotter au-dessus sans pousser le layout */
.om-news-filters,
.om-filters-grid,
.om-field.om-multi,
.om-field.om-date { overflow: visible !important; }

.om-field.om-multi,
.om-field.om-date { position: relative !important; border-left: 1px solid var(--e-global-color-primary); }

/* Boutons principaux (entités / localisations / date) */
button.om-dd-toggle, button.om-dd-toggle:hover, button.om-dd-toggle:active, button.om-dd-toggle:focus {
  width:auto !important;
  max-width:100%;
  white-space:nowrap;           /* garde le libellé sur une ligne */
  padding-inline:.6rem 2rem;    /* laisse la place pour la flèche ::after */
  text-align: left;
  padding: .2rem 1.2rem;
  border: 1px solid var(--e-global-color-primary);
  border-radius: .5rem;
  background: #fff;
  cursor: pointer;
  background-color: transparent;
  color: var(--e-global-color-primary);
  text-transform: uppercase;
  font-weight: 700;
  font-style: normal;
  font-size: 0.8rem;
}

/* Panneaux déroulants (overlay) */
.om-dd {
  position: absolute !important;
  top: calc(100% + 25px) !important;
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  margin: 0 !important;
  z-index: 10050 !important;
  width: max(320px, 100%) !important;  
}
.om-dd[hidden] { display: none; }

/* Listes multi */
.om-dd .om-dd-list {
  position: static !important;
  max-height: 16rem !important;
  overflow: auto !important;
  border: 1px solid var(--e-global-color-primary);
  border-radius: .5rem;
  background: #fff;
  padding: .25rem;
}
.om-dd-list li { list-style: none; }
.om-dd-list label { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: .35rem; }
.om-dd-list label:hover { background: #f5f7fb; }

/* (Nous n’affichons plus les boutons internes du panneau) */
.om-dd-actions { display: none !important; }

/* Bloc date (contenu du panneau) */
.om-field.om-date .om-dd-box {
  border: 1px solid var(--e-global-color-primary);
  border-radius: .5rem;
  background: #fff;
  padding: .75rem;
}
.om-field.om-date .om-date-row {
  display: grid;
  grid-template-columns: 85px 1fr;
  gap: .5rem;
  align-items: center;
  margin-bottom: 10px;
}
.om-field.om-date .om-date-lbl { font-weight: 600; }

/* Champ recherche : style perso + loupe + placeholder */
.om-field input[type="search"] {
  width: 100%;
  border: 1px solid var(--e-global-color-primary);
  border-radius: 20px !important;
}

#omq, #omq-jobs {
  background: url('https://open-modal.com/wp-content/uploads/2025/11/picto-loupe.svg') no-repeat 0.9rem center;
  background-size: 1.5rem 1.5rem;   /* taille de la loupe */
  padding-left: 3rem;               /* espace avant texte */
  color: var(--e-global-color-primary);  /* texte saisi */
  height: 2.5rem;                   /* confort visuel */
  border-radius: .5rem;             /* coins */
  font-style: italic;
  font-family: "DM Sans", Sans-serif;
}

/* Placeholder — compatible navigateurs */
.om-news-filters input::placeholder {
  color: var(--e-global-color-primary);
  opacity: 1;
}
.om-news-filters input::-webkit-input-placeholder { color: var(--e-global-color-primary); opacity: 1; }
.om-news-filters input:-ms-input-placeholder      { color: var(--e-global-color-primary); opacity: 1; }
.om-news-filters input::-ms-input-placeholder     { color: var(--e-global-color-primary); opacity: 1; }

/* Sécurité si un parent Elementor clippe (à activer si besoin) */
/* .elementor-widget-container, .elementor-container, .elementor-element { overflow: visible !important; } */

/* Sécurité si la grille passe au-dessus : */
/* .e-loop-item, .elementor-loop-container { z-index: auto !important; } */

/* =======================================================
   Icône flèche à droite sur les boutons déroulants
   (Entités / Localisation / Date)
   ======================================================= */
.om-dd-toggle {
  position: relative;
  background-image: none !important; /* on supprime tout éventuel fond */
  padding-right: 2rem !important;    /* espace pour la flèche */
}

/* Flèche SVG décorative (même taille/couleur pour tous les dropdowns) */
.om-dd-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.5rem;
  width: 1.1rem;
  height: 1.1rem;
  background: url("https://open-modal.com/wp-content/uploads/2025/11/fleche-filtre.svg") no-repeat center;
  background-size: contain;
  transform: translateY(-50%);
  pointer-events: none; /* pas cliquable */
  opacity: 1;
}

/* Option : rotation quand le menu est ouvert */
.om-dd-toggle[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

.om-actions button[type="submit"], .om-actions a {
  color: var(--e-global-color-primary);
  background-color: #ffffff;
  border: 1px solid var(--e-global-color-primary) !important;
  border-radius: 20px !important;
  font-style: normal;
  font-weight: 400;
  padding: .5rem 1rem !important;
  height: 2.5rem;
  font-size: 1rem;
}
.om-actions button[type="submit"]:hover, .om-actions a:hover {
  color: #ffffff;
  background-color: var(--e-global-color-primary);
}


/* Le panneau se cale sur la largeur du bouton (déjà synchro côté JS),
   mais au cas où le JS est bloqué, on met une largeur mini égale au bouton */
.om-field.om-multi .om-dd,
.om-field.om-date  .om-dd{
  min-width:100% !important;
}

/* Le champ de recherche peut, lui, prendre la place disponible (si souhaité) */
.om-field:first-child{
  flex:1 1 300px !important;    /* s’étire si de la place, sinon min 300px */
}
.om-field:first-child input[type="search"]{
  width:100% !important;
}

/* Les inputs date gardent une largeur compacte */
.om-field.om-date .om-dd-box input[type="date"]{
  width:auto !important;
}

/* Optionnel : empêche les gros labels sélectionnés de faire grandir le bouton */
.om-dd-toggle{
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ====== Nouveau layout : search à gauche (largeur contenu), le reste à droite ====== */

/* La rangée devient un flex qui wrappe */
.om-filters-grid{
  display:flex !important;
  flex-wrap:wrap !important;
  gap:.75rem !important;
  align-items:center !important;
}

/* Chaque item n'occupe que sa propre largeur */
.om-field{
  flex:0 0 auto !important;
  width:auto !important;
  min-width:0 !important;
}

/* 1) SEARCH à gauche : largeur = contenu (pas 100%) */
.om-field:first-child{ margin-right:.5rem; }
.om-field:first-child input[type="search"]{
  width:auto !important;          /* annule l'ancien 100% */
  max-width:36ch;                 /* lisible, ajuste si besoin */
}

/* 2) GROUPE DE DROITE : on pousse à droite à partir du 1er bouton 'Entités' */
.om-field.om-multi:first-of-type{
  margin-left:auto !important;    /* tout ce qui suit part à droite */
}

/* Les autres boutons restent compacts */
.om-dd-toggle{
  width:auto !important;
  max-width:100%;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  padding-inline:.6rem 2rem;      /* conserve l'espace pour la flèche ::after */
}

/* Les actions (Filtrer / Réinitialiser) se collent naturellement à droite après les boutons */
.om-actions{ order: 10; }

/* Mobile : si trop serré, repasse la search à 100% en < 480px */
@media (max-width: 480px){
  .om-field:first-child input[type="search"]{ width:100% !important; max-width:none; }
  .om-field.om-multi:first-of-type{ margin-left:0 !important; } /* tout s'empile proprement */
}

/* Centrer le panneau sous le bouton, avec garde-fous responsive */
.om-field.om-multi .om-dd,
.om-field.om-date  .om-dd{
  left: 50% !important;
  transform: translateX(-50%) !important;
  min-width: 100% !important;                /* ≥ largeur du bouton */
  width: auto !important;
  max-width: calc(100vw - 2rem) !important;  /* marge écran */
}

/* Quand on veut forcer l’alignement gauche/droite via JS */
.om-dd.is-left  { left: 0 !important;   transform: none !important; }
.om-dd.is-right { left: auto !important; right: 0 !important; transform: none !important; }

/* === largeur minimale des panneaux déroulants (Entités / Date) === */
.om-field.om-multi .om-dd,
.om-field.om-date  .om-dd {
  min-width: 220px !important;            /* largeur mini confortable */
  width: auto !important;                 /* laisse le JS ajuster si besoin */
  max-width: calc(100vw - 2rem) !important; /* pas de débordement écran */
}

/* Optionnel : améliore la lisibilité du contenu dans les listes */
.om-dd .om-dd-list label {
  white-space: nowrap;
  min-width: 180px; /* évite les retours à la ligne trop tôt */
}

/* Correctif flèche dropdown : espace suffisant à droite */
.om-dd-toggle {
  position: relative; /* déjà présent, mais on renforce */
  display: inline-flex;
  align-items: center;
  padding-right: 2.75rem !important; /* un peu plus d'espace pour la flèche */
}

.om-dd-toggle::after {
  right: 0.75rem !important; /* flèche bien collée au bord droit */
}

/* Correctif : Filtrer et Réinitialiser même style */
.om-actions button,
.om-actions a {
  color: var(--e-global-color-primary) !important;
  background-color: #ffffff !important;
  border: 1px solid var(--e-global-color-primary) !important;
  border-radius: 20px !important;
  font-style: normal !important;
  font-weight: 400 !important;
  padding: .5rem 1rem !important;
  height: 2.5rem !important;
  font-size: 1rem !important;
  text-decoration: none !important; /* enlève souligné éventuel sur l'anchor */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.om-actions button:hover,
.om-actions a:hover {
  color: #ffffff !important;
  background-color: var(--e-global-color-primary) !important;
}

/**** menu Filtres Offres emploi et Actualités ******/
@media (max-width: 480px) {
  .om-dd {
    top: calc(100% + 8px) !important;
  }
  .om-field.om-multi, .om-field.om-date {
    border-left: 0px !important;
  }

  /* Chaque champ (contrat, localisation, métiers…) sur une ligne pleine largeur */
  .om-field {
    display: block;
    width: 80% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Champ multi (contrat / localisation / métiers) : parent du dropdown */
  .om-field.om-multi {
    position: relative;
  }

  /* Ligne des boutons Filtrer / Réinitialiser si tu as un conteneur pour eux */
  .om-actions {
    display: flex;
    gap: 12px;
    width: 100%;
  }

  .om-actions button {
    flex: 1 1 0;
  }
  .om-field.om-multi {
    border-left: 0;
  }
  button.om-dd-toggle {
    padding-left: 0;
  }
}