/* Supprime le cadre/fond du conteneur Leaflet custom autour du bouton */
.leaflet-control-custom,
.leaflet-bar.leaflet-control-custom {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Bouton "Dessiner sur la carte" au même style que .advanced-search-bar .search-btn */
.draw-map-btn {
    background: #1a7f37 !important;
    color: #fff !important;
    border: none !important;
    outline: none !important;
    border-radius: 8px !important;
    padding: 0.63em 2.1em !important;
    font-size: 1.08em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(26, 127, 55, 0.06) !important;
    transition: background 0.2s;
    margin-left: 1em;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-control-custom .draw-map-btn,
.leaflet-bar .draw-map-btn,
.leaflet-bar button.draw-map-btn,
.leaflet-bar a.draw-map-btn {
    border: none !important;
    outline: none !important;
    background: #1a7f37 !important;
    box-shadow: 0 1px 6px rgba(26, 127, 55, 0.06) !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    filter: none !important;
}


.leaflet-bar .draw-map-btn:focus,
.leaflet-bar .draw-map-btn:active {
    outline: none !important;
    box-shadow: 0 1px 6px rgba(26, 127, 55, 0.10) !important;
}


.draw-map-btn:hover, .draw-map-btn:focus {
    background: #166c2f;
}

/* Layout principal acheter : carte à 60%, annonces à droite en 2 colonnes */

.advanced-search-bar {
  width: 100vw;
  min-width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  position: relative;
  background: #fff;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 4px 28px 0 rgba(34,48,74,0.09);
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  align-items: center;
  justify-content: center; /* Centrer les éléments */
  padding: 1.2em 2em 1.2em 2em;
  margin-bottom: 0; /* Coller au layout principal */
  border-bottom: 1px solid #f0f0f0;
}
@media (max-width: 900px) {
  .advanced-search-bar {
    padding: 1.2em 0.7em 1em 0.7em;
    gap: 0.7em;
  }
}
@media (max-width: 600px) {
  .advanced-search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5em;
    padding: 0.7em 0.1em 0.7em 0.1em;
    border-radius: 0 0 10px 10px;
    margin-bottom: 1.2em;
  }
}

.advanced-search-bar form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1em 1.5em;
  align-items: flex-end;
  width: 100%;
}
.location-input-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 0.3em;
}

.advanced-search-bar input[type="text"],
.advanced-search-bar select,
.advanced-search-bar input[type="number"] {
  border: 1px solid #e3e3e8;
  border-radius: 10px;
  padding: 0.7em 1.2em;
  font-size: 1em;
  background: #fafbfc;
  transition: all 0.2s ease;
  min-width: 200px;
  margin-right: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.search-location-input {
  padding-right: 40px !important; /* Espace pour le bouton de géolocalisation */
}

.geolocation-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
}

.geolocation-btn:hover {
  background: rgba(26, 127, 55, 0.1);
  transform: scale(1.1);
}

.geolocation-btn:active {
  transform: scale(0.95);
}
.advanced-search-bar input[type="text"]:focus,
.advanced-search-bar select:focus,
.advanced-search-bar input[type="number"]:focus {
  border: 1.5px solid #1a7f37;
  outline: none;
}
.advanced-search-bar .dropdown {
  position: relative;
  min-width: 120px;
}
.advanced-search-bar .dropdown-toggle {
  background: #fafbfc;
  border: 1px solid #e3e3e8;
  border-radius: 10px;
  padding: 0.7em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  position: relative;
}
.advanced-search-bar .dropdown-toggle:focus {
  border: 1.5px solid #1a7f37;
  outline: none;
}
.advanced-search-bar .dropdown-menu {
  display: none;
  position: absolute;
  left: 50%;
  top: 105%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.11);
  z-index: 9000; /* Valeur très élevée pour s'afficher au-dessus de la carte Leaflet */
}

.ad-type-menu {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  padding: 1em 0.8em;
  min-width: 110px;
}

.ad-type-option {
  background: #f7f8fa;
  border: none;
  border-radius: 7px;
  padding: 0.65em 0;
  font-size: 1.08em;
  color: #22304a;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.17s, color 0.17s;
  margin: 0.18em 0;
  width: 100%;
  display: block;
  text-align: center;
}
.ad-type-option:hover {
  background: #e3fbe5;
  color: #1a7f37;
}
.ad-type-option.selected, .ad-type-option:active {
  background: #1a7f37;
  color: #fff;
}

.rooms-menu {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  padding: 1em 0.8em;
  min-width: 110px;
}
.rooms-option {
  background: #f7f8fa;
  border: none;
  border-radius: 7px;
  padding: 0.5em 0;
  font-size: 1.08em;
  color: #22304a;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.17s, color 0.17s;
  margin: 0 0.1em;
  text-align: center;
}
.rooms-option:hover {
  background: #e3fbe5;
  color: #1a7f37;
}
.rooms-option.selected, .rooms-option:active {
  background: #1a7f37;
  color: #fff;
}

/* Onglets menu prix */
.price-tabs-group {
  display: flex;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  border: 1.5px solid #e3e3e8;
  background: #f7f8fa;
  margin-bottom: 1.1em;
  width: fit-content;
}
.price-tab {
  flex: 1 1 0;
  padding: 0.7em 2.1em;
  font-size: 1.09em;
  font-weight: 600;
  border: none;
  background: #f7f8fa;
  color: #22304a;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  border-right: 1.5px solid #e3e3e8;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.price-tab:last-child {
  border-right: none;
}
.price-tab.active {
  background: #fff;
  color: #1a7f37;
  box-shadow: 0 -1px 8px rgba(26,127,55,0.06);
}
.price-tab:not(.active):hover {
  background: #e3fbe5;
  color: #1a7f37;
}
@media (max-width: 700px) {
  .price-tabs-group {
    width: 100%;
    flex-direction: row;
  }
  .price-tab {
    padding: 0.7em 0.5em;
    font-size: 1em;
  }
}

/* Chambres & Salles de bains */

/* MODAL fiche-annonce : visible partout, centré */
#fiche-annonce-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(34,48,74,0.85);
  opacity: 1;
  display: none; /* sera mis à flex par le JS */
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
#fiche-annonce-modal.open {
  display: flex;
  opacity: 1;
}
#fiche-annonce-modal .fiche-modal-content {
  background: #fff;
  border-radius: 16px;
  max-width: 600px;
  max-height: 95vh;
  overflow: auto;
  padding: 2em;
  box-shadow: 0 8px 48px rgba(34,48,74,0.18);
}
@media (min-width: 900px) {
  /* Modal fiche-annonce : exactement sur la colonne annonces, aligné à gauche de .acheter-ads-col */
  #fiche-annonce-modal {
    left: calc(60vw); /* largeur de la carte = 60vw, donc le modal commence juste après */
    right: 0;
    top: 110px; /* hauteur du header + barre de recherche, ajuste si besoin */
    width: 40vw;
    min-width: 400px;
    max-width: none;
    height: calc(100vh - 110px);
    border-radius: 0;
    align-items: flex-start;
    justify-content: flex-end;
    background: rgba(34,48,74,0.85);
    box-shadow: -4px 0 32px rgba(34,48,74,0.10);
  }
  #fiche-annonce-modal .fiche-modal-content {
    border-radius: 0 0 0 0;
    width: 100%;
    max-width: none;
    min-width: 0;
    box-shadow: none;
  }
}


.bedsbaths-menu {
  display: none; /* important pour héritage du comportement dropdown */
  min-width: 320px;
  padding: 1.1em 1.3em;
  background: #f8fafd;
  border: 1px solid #e3e3e8;
  border-radius: 12px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.10);
}
.bedsbaths-section {
  margin-bottom: 0.7em;
}
.bedsbaths-label {
  font-size: 1.04em;
  font-weight: 600;
  color: #4c5770;
  margin-bottom: 0.45em;
}
.bedsbaths-btn-row {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0.2em;
}
.bedsbaths-btn {
  border: 1.5px solid #e3e3e8;
  background: #fff;
  color: #22304a;
  border-radius: 8px;
  margin-right: 0.5em;
  padding: 0.45em 1.1em;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border 0.18s, color 0.18s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bedsbaths-btn.selected, .bedsbaths-btn:active {
  background: #1a7f37;
  color: #fff;
  border: 1.5px solid #1a7f37;
}
.bedsbaths-btn:hover {
  background: #e3fbe5;
  border: 1.5px solid #1a7f37;
  color: #1a7f37;
}
#bedrooms-exact-match {
  margin-right: 0.4em;
  accent-color: #1a7f37;
}
.bedsbaths-section label {
  font-size: 0.99em;
  color: #444;
  margin-top: 0.3em;
  margin-bottom: 0;
  font-weight: 400;
}

.advanced-search-bar .dropdown.open > .dropdown-menu,
.advanced-search-bar .dropdown.open > .bedsbaths-menu {
  display: block;
}
.advanced-search-bar label {
  font-size: 0.98em;
  color: #333;
  margin-bottom: 0.2em;
  display: block;
}
.advanced-search-bar .search-btn {
  background: #1a7f37;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75em 2.5em;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26,127,55,0.15);
  transition: all 0.3s ease;
  margin-left: 1em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.advanced-search-bar .search-btn:hover {
  background: #166b2e;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(26,127,55,0.2);
}
.advanced-search-bar .buyability-btn {
  background: #f7f8fa;
  color: #1a7f37;
  border: 1px solid #e3e3e8;
  border-radius: 7px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4em 1.2em;
  font-size: 0.99em;
  margin-top: 0.6em;
  cursor: pointer;
  transition: background 0.2s;
}
.advanced-search-bar .buyability-btn:hover {
  background: #e3fbe5;
}
@media (max-width: 700px) {
  .advanced-search-bar {
    padding: 1em 0.5em;
  }
  .advanced-search-bar form {
    flex-direction: column;
    gap: 0.7em 0;
    align-items: stretch;
  }
  .advanced-search-bar input,
  .advanced-search-bar .dropdown-menu {
    min-width: 200px;
  }
  .advanced-search-bar .search-btn {
    width: 100%;
    margin-left: 0;
  }
}

.acheter-layout-root {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  gap: 0.5em; /* Réduire l'espace entre la carte et la colonne des annonces */
  background: #f7f8fa;
  min-height: 70vh;
  justify-content: space-between; /* Assurer une répartition équilibrée de l'espace */
  overflow: hidden; /* Éviter les débordements */
  margin-top: -1px; /* Coller à la barre de recherche */
}
.acheter-map-col {
  width: 62vw; /* Augmenter légèrement la largeur de la carte */
  min-width: 420px;
  max-width: 68vw;
  height: 82vh; /* Augmenter la hauteur de la carte */
  padding: 0;
  margin: 0;
  display: flex;
  align-items: flex-start;
  position: relative;
  z-index: 1; /* S'assurer que la carte est derrière les mini-cartes */
}
.acheter-ads-col {
  width: 36vw; /* Ajuster la largeur de la colonne */
  min-width: 320px;
  max-width: 37vw;
  margin-left: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligner les éléments à gauche */
  height: 82vh; /* Augmenter la hauteur pour correspondre à la carte */
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  position: relative;
  z-index: 2; /* S'assurer que la colonne est au-dessus de la carte */
}
#acheter-map-container {
  width: 100%;
  height: 75vh;
  min-height: 500px;
  border-radius: 16px;
  box-shadow: 0 4px 28px 0 rgba(34,48,74,0.09);
}


#acheter-map-container {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border-radius: 0px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.09);
  overflow: hidden;
}
/* Ce style est déjà défini plus haut */
.acheter-ads-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em; /* Augmenter l'espace entre les cartes */
  margin-top: 1em;
  padding: 0 0.5em; /* Ajouter un padding pour éviter que les cartes ne touchent les bords */
  width: 100%; /* S'assurer que la grille prend toute la largeur disponible */
  box-sizing: border-box; /* Inclure le padding dans la largeur */
}
.acheter-ads-grid .acheter-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 1.1em 1.3em;
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  width: 100%; /* S'assurer que la carte prend toute la largeur disponible */
  box-sizing: border-box; /* Inclure le padding dans la largeur */
  margin: 0; /* Supprimer les marges */
  position: relative; /* Nécessaire pour le z-index */
  z-index: 3; /* S'assurer que les cartes sont au-dessus de la colonne */
  transition: box-shadow 0.18s;
}
.acheter-ads-grid .acheter-card:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
}

/* Effet d'ombré pour les cards d'annonces sur mobile - même style que la grande card blanche */
@media (max-width: 768px) {
  /* Ombre modérée pour les cards de la section Acheter (exclut la homepage) */
  .acheter-ads-grid .acheter-card:not(.latest-listings .acheter-card),
  #acheter-results .acheter-card:not(.latest-listings .acheter-card) {
    box-shadow:
      0 4px 16px rgba(26,43,73,0.15), /* ombre principale bleutée */
      0 1.5px 6px rgba(0,0,0,0.10);   /* ombre noire diffuse */
    border-radius: 16px !important;
    background: #fff !important;
  }
}
@media (max-width: 1000px) {
  .acheter-layout-root {
    flex-direction: column;
    gap: 0.5em;
  }
  .acheter-map-col, .acheter-ads-col {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
  }
  .acheter-ads-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================================
   ICÔNES PAPACASA DANS LES CARDS D'ANNONCES
   ====================================================== */
.info-chambres {
  background-color: red !important; /* TEST TEMPORAIRE */
}
.info-chambres::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url('/static/images/Icones%20papacasa/icon-bed.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 4px;
  vertical-align: middle;
}

.info-sdb::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url('/static/images/Icones%20papacasa/icon-bath.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 4px;
  vertical-align: middle;
}

.info-surface::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url('/static/images/Icones%20papacasa/icon-area.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 4px;
  vertical-align: middle;
}

.info-type::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url('/static/images/Icones%20papacasa/icon-type.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: 4px;
  vertical-align: middle;
}

.info-type {
  color: #1a7f37;
  font-weight: 600;
}

/* ======================================================
   CORRECTIF POUR LES MENUS DÉROULANTS ET LEAFLET
   ====================================================== */
/* Fix pour les menus déroulants qui apparaissent derrière la carte Leaflet */

/* Forcer les menus déroulants au premier plan */
.advanced-search-bar .dropdown-menu {
  z-index: 9999 !important;
  pointer-events: auto !important;
}

.advanced-search-bar .dropdown {
  z-index: 9999 !important;
  position: relative !important;
}

/* Résoudre le problème de chevauchement des contrôles Leaflet */
.leaflet-top, .leaflet-bottom {
  z-index: 800 !important; /* Réduire le z-index des contrôles Leaflet */
}

/* Assurer que la carte passe sous les menus */
.leaflet-container {
  z-index: 0 !important;
}

/* Les styles de z-index sont maintenant gérés dans leaflet-fix.css */

/* Style pour mettre en évidence une carte d'annonce lors du survol d'un marqueur */
.acheter-card.highlight {
  box-shadow: 0 0 0 3px #1a7f37, 0 4px 20px rgba(0,0,0,0.15);
  background-color: #f0fff4;
  position: relative;
  z-index: 100; /* Valeur élevée pour s'assurer que la carte est au-dessus des autres */
  transform: scale(1.02); /* Légèrement agrandir la carte pour un effet visuel plus marqué */
  transition: all 0.2s ease;
}
