/* ==============================
   SECTION DE RECHERCHE
   ============================== */
.search-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 40%, white) 0%, color-mix(in srgb, var(--brand) 85%, black) 100%);
  padding: 72px 24px;
  margin-bottom: 50px;
  position: relative;
  overflow: visible; /* Permet au dropdown de s'afficher */
  z-index: 100; /* ← AJOUTÉ : passe au-dessus des autres sections */
}

.search-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="white" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.searchbar {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  box-shadow: 0 25px 40px rgba(15, 23, 42, 0.18);
  overflow: visible; /* Important pour le dropdown */
  border: 1px solid rgba(148, 163, 184, 0.22);
  position: relative;
  z-index: 1;
  isolation: isolate;
  transition: all 0.3s ease;
  box-sizing: border-box; /* ← AJOUTÉ : pour le responsive */
  width: 100%; /* ← AJOUTÉ */
}

.searchbar:hover {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

/* Inputs de recherche */
.searchbar input[type="text"] {
  flex: 1;
  padding: 18px 24px;
  border: none;
  font-size: 16px;
  color: #0f172a;
  background: transparent;
  outline: none;
  min-width: 0;
  transition: background 0.2s ease;
  border-radius: 0; /* ← AJOUTÉ */
  box-sizing: border-box; /* ← AJOUTÉ */
  
  /* Empêcher le texte de déborder */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Premier input : arrondi à gauche */
.searchbar input[type="text"]:first-child {
  border-radius: 10px 0 0 10px; /* ← AJOUTÉ */
}

.searchbar input[type="text"]::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.searchbar input[type="text"]:focus {
  background: #f9fafb;
}

/* Séparateurs verticaux */
.searchbar input[type="text"]:not(:last-of-type) {
  border-right: 1px solid #e5e7eb; /* ← MODIFIÉ : 1px au lieu de 2px */
}

/* Dropdown Type de contrat */
.dropdown-check {
  position: relative;
  display: flex;
  align-items: center;
  border-right: 1px solid #e5e7eb; /* ← MODIFIÉ : 1px au lieu de 2px */
  z-index: 10; /* ← MODIFIÉ : plus élevé */
  overflow: visible; /* ← AJOUTÉ */
}

.dropdown-check .dropbtn {
  background: transparent;
  border: none;
  padding: 18px 24px;
  font-size: 16px;
  color: #0f172a;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-check .dropbtn:hover {
  background: #f9fafb;
  color: var(--brand);
}

.dropdown-check .dropdown-content {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.2);
  border-radius: 12px;
  min-width: 240px;
  z-index: 9999; /* ← MODIFIÉ : très élevé */
  padding: 8px;
  border: 1px solid #e5e7eb;

  /* Caché par défaut */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
}

.dropdown-check.open .dropdown-content {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dropdown-check .dropdown-content label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 15px;
  color: #1f2937;
  font-weight: 500;
  border-radius: 8px;
}

.dropdown-check .dropdown-content label:hover {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand);
}

.dropdown-check .dropdown-content input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Bouton Recherche */
.btn-search {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  color: #ffffff;
  border: none;
  padding: 18px 40px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  position: relative;
  border-radius: 0 16px 16px 0; /* ← MODIFIÉ : arrondi à droite uniquement */
  overflow: hidden;
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.25);
}

.btn-search::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-search:hover::before {
  left: 100%;
}

.btn-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 48px rgba(15, 23, 42, 0.28);
}

.btn-search:active {
  transform: scale(0.98);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 968px) {
  .search-section {
    padding: 40px 16px;
    box-sizing: border-box; /* ← AJOUTÉ */
  }

  .searchbar {
    flex-direction: column;
    gap: 0;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box; /* ← AJOUTÉ */
  }

  .searchbar input[type="text"],
  .dropdown-check,
  .btn-search {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb; /* ← MODIFIÉ : 1px */
    border-radius: 0;
    box-sizing: border-box; /* ← AJOUTÉ */
  }

  /* Premier input : arrondi en haut en mobile */
  .searchbar input[type="text"]:first-child {
    border-radius: 12px 12px 0 0; /* ← AJOUTÉ */
  }

  .btn-search {
    border-bottom: none;
    border-radius: 0 0 12px 12px; /* Arrondi bas en mobile */
  }

  .dropdown-check .dropdown-content {
    left: 0;
    right: 0;
    width: auto;
  }
}

@media (max-width: 640px) {
  .search-section {
    padding: 32px 12px;
  }

  .searchbar input[type="text"],
  .dropdown-check .dropbtn,
  .btn-search {
    padding: 16px 18px;
    font-size: 15px;
  }
}

/* ==============================
   TAGS DE FILTRES
   ============================== */
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px auto;
  max-width: 1100px;
  padding: 0 20px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  background: var(--brand-hover);
  color: #fff;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 14px;
}

.filter-tag .tag-remove {
  background: transparent;
  border: none;
  color: #fff;
  margin-left: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
