/* ============================================================
FRONT PAGE ONLY
- Searchbar + dropdowns + tags
- Results grid + map
- More filters modal
============================================================ */

/* ============================================================
SEARCHBAR WRAPPER (floating)
============================================================ */

.searchbar-wrapper {
  position: fixed;
  top: 150px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  background: #fff;
  padding: 8px 0;
  border-radius: 0;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  z-index: 9000;
  transition: width 0.3s ease, transform 0.3s ease;
}

.search-top {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: visible;
}

/* Mode compact (carte ouverte) */
.searchbar-wrapper.compact {
  width: 40%;
  transform: translateX(-100%);
}

.searchbar-wrapper.compact .search-row {
  flex-direction: column;
  align-items: flex-start;
}

/* ============================================================
MEGA SEARCHBAR GRID
============================================================ */

.mega-searchbar {
  display: grid;
  grid-template-columns: 0.25fr 1fr 1fr 1fr 0.3fr 0.4fr;
  width: 100%;
  background: transparent; /* fond géré par .searchbar-wrapper */
  padding: 0;
}

/* IMPORTANT: fix du sélecteur (tu avais un retour ligne) */
.mega-searchbar .reset-tags-col {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

/* Traits verticaux */
.mega-searchbar > * {
  border-right: 1px solid #000;
}

.mega-searchbar > *:last-child {
  border-right: none;
}

/* ============================================================
RESET
============================================================ */

.reset-tags-col a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  background: #fff;
  cursor: pointer;
  font-size: 0;
  text-decoration: none;
}

.reset-tags-col a::before {
  content: "↻";
  font-size: 24px;
  color: #878787;
  display: block;
  transition: transform 0.2s ease, font-size 0.2s ease, color 0.2s ease;
}

.reset-tags-col a:hover::before {
  transform: rotate(90deg);
  font-weight: 700;
  font-size: 30px;
  color: #AA6615;
}

/* ============================================================
SEARCH BLOCKS
============================================================ */

.search-block {
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  justify-content: center;
}

.search-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.search-row label,
.search-row .field-display,
.search-row .field-placeholder {
  display: block;
}

.search-row label {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: #000;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
  letter-spacing: 1px;
}

.field-display {
  display: block;
  color: #878787;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.field-placeholder {
  cursor: pointer;
}

/* Input mot-clé */
.field-display input[type="text"] {
  width: 100%;
  height: 22px;
  padding: 0;
  margin: 0;
  line-height: 22px;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  color: #878787;
  text-transform: lowercase;
}

.field-display input::placeholder {
  color: #878787;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
}

/* ============================================================
AUTOCOMPLETE
============================================================ */

#suggestions {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  display: none;
  z-index: 9100; /* > searchbar */
}

.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}

.suggestion-item:hover {
  background: #f2f2f2;
}

/* ============================================================
DROPDOWNS
============================================================ */

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 12px;
  width: calc(100% - 24px);
  background: #fff;
  border: 1px solid #ddd;
  z-index: 9050;
}

.dropdown-scroll {
  max-height: 260px;
  overflow-y: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  text-decoration: none;
  font-size: 14px;
  color: #000;
}

.dropdown-item img {
  width: 45px;
  height: 45px;
  object-fit: cover;
}

.dropdown-item:hover {
  background: #f4f4f4;
}

/* ============================================================
MAP BUTTON
============================================================ */

.search-map-button {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

#map-toggle-button {
  padding: 4px 12px;
  background: #fff;
  height: 40px;
  border: none;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  letter-spacing: 1px;
  color: #878787;
}

#map-toggle-button:hover {
  background: none;
  color: #AA6615;
  font-weight: 700;
}

/* ============================================================
ACTIVE FILTER TAGS
============================================================ */

.filters-grid {
  display: grid;
  grid-template-columns: 0.25fr 1fr 1fr 1fr 0.3fr 0.4fr;
  margin-top: 6px;
  padding: 0;
  width: 100%;
}

.more-filters-group {
  margin-top: 20px;
}


.filter-col {
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* FIX: inline-flex pour que ::before soit bien centré */
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #000;
  text-decoration: none;
  margin-right: 0;
  margin-bottom: 0;
}

.filter-tag::before {
  content: "✕";
  width: 14px;
  height: 14px;
  font-size: 10px;
  background: #000;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-tag:hover::before {
  background: #333;
}

/* Desktop : on cache Matériau / Programme dans la modale */
.more-filters-group.mobile-only {
  display: none;
}



/* ============================================================
RESULTS + MAP
============================================================ */

.results-map-wrapper {
  display: flex;
  width: 100%;
}

.image-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.single-image img {
  width: 100%;
  display: block;
  margin-bottom: 10px;
    border-radius: 0;
}

#image-columns {
  width: 100%;
  transition: width 0.4s ease, opacity 0.3s ease;
}

#project-map {
  width: 0;
  min-height: 1000px;
  overflow: hidden;
  transition: width 0.4s ease;
  position: fixed;
  right: 40px;
  top: 120px;
}

/* Etat map ouverte */
.results-map-wrapper.show-map #image-columns {
  width: 60%;
  opacity: 1;
  pointer-events: auto;
}

.results-map-wrapper.show-map #project-map {
  width: 40%;
  box-shadow: -12px 0 0 0 #fff;
}

/* ============================================================
MAP POPUP
============================================================ */

.project-popup .maplibregl-popup-content {
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  font-family: "Archivo", sans-serif;
  width: 220px;
}

.project-popup img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.popup-content {
  padding: 10px;
}

.popup-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: #000;
}

.popup-architecte {
  font-size: 13px;
  font-weight: 400;
  color: #666;
}

/* ============================================================
MORE FILTERS MODAL
============================================================ */

.more-filters-modal {
  position: fixed;
  inset: 0;
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  font-family: "Archivo", sans-serif;
}

.more-filters-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Overlay */
.more-filters-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.more-filters-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel */
.more-filters-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: 420px;
  max-width: calc(100% - 40px);
  background: #fff;
  padding: 30px;
  transition: transform 0.25s ease;
  z-index: 9999;
}

.more-filters-modal.is-open .more-filters-panel {
  transform: translate(-50%, -50%) scale(1);
}

.more-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.more-filters-title {
  font-family: "The Bigmouth Regular", sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: #000;
}

.more-filters-close {
  background: none;
  border: none;
  padding: 0;
  font-family: "Archivo", sans-serif;
  font-size: 18px;
  line-height: 1;
  color: #878787;
  cursor: pointer;
  font-weight: 700;
}

.more-filters-close:hover {
  background: none;
  color: #AA6615;
}

.more-filters-label {
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #000;
}

.more-filters-body {
  font-family: "Archivo", sans-serif;
  font-size: 12px;
}

/* ---------- Bouton ok ---------- */
.more-filters-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.more-filters-ok {
  background: #878787;
  color: #fff;
  border: none;
  padding: 8px 18px;
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
}

.more-filters-ok:hover {
  background: #AA6615;
}

/* ============================================================
MESSAGE AUCUN RÉSULTAT
============================================================ */
.no-results-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 90%;
  max-width: 600px;
  z-index: 10;
}

.no-results-message p {
  font-family: "Archivo", sans-serif;
  font-size: 12px;
  color: #000;
  line-height: 1.6;
  margin: 0;
}

/* Assurer que le conteneur parent permet le positionnement absolu */
.results-map-wrapper {
  position: relative;
  min-height: 70vh;
}

@media (max-width: 600px) {
  .no-results-message p {
    font-size: 14px;
  }
}

/* ============================================================
"+" BUTTON
============================================================ */

.search-more-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#more-filters-open {
  width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #fff;
  color: #878787;
  font-family: "Archivo", sans-serif;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  transform: translateY(-2px);
}

#more-filters-open:hover {
  background: none;
  color: #AA6615;
  font-weight: 700;
  font-size: 46px;
}

#more-filters-dot {
  position: absolute;
  top: 4px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: #AA6615;
  border-radius: 50%;
  display: none;
}

#more-filters-dot.is-on {
  display: block;
}

/* ============================================================
RESPONSIVE
============================================================ */


/* ---------- <= 1100px : ajustements généraux ---------- */
@media (max-width: 1100px) {
  .image-container {
    grid-template-columns: repeat(2, 1fr);
  }

.single-image img {
    border-radius: 0;
}

  .searchbar-wrapper {
    width: 90%;
    top: 130px;
    padding: 4px 0;
    border-radius: 0;
  }

  #project-map {
    right: 20px;
  }
}

/* ---------- <= 900px : tablet/mobile (barre sur 1 ligne + map non fixed) ---------- */
@media (max-width: 900px) {

  /* ===== Barre : 1 ligne (Reset | Mot-clé | + | Carte) ===== */
  .mega-searchbar {
    grid-template-columns: 44px 1fr 64px 84px;
    grid-template-areas: "reset motcle more map";
    align-items: center;
  }

  .mega-searchbar .reset-tags-col { grid-area: reset; }
  .mega-searchbar #bloc-motcle { grid-area: motcle; }
  .mega-searchbar .search-more-button { grid-area: more; }
  .mega-searchbar .search-map-button { grid-area: map; }

  /* On cache Matériau/Programme dans la barre (ils iront dans la modale +) */
  .mega-searchbar .dropdown-trigger {
    display: none;
  }

  /* Plus de séparateurs (effet “souligné”) */
  .mega-searchbar > * {
    border-right: none;
  }

  /* Mot-clé : label + input sur une ligne */
  .search-row {
    flex-direction: row;
    align-items: baseline;
  }

  /* Autocomplete : largeur totale du bloc mot-clé */
  #bloc-motcle #suggestions {
    left: 0;
    right: 0;
  }

  /* Bouton Carte un peu plus compact */
  #map-toggle-button {
    height: 35px;
    padding: 4px 10px;
  }

  /* ===== Tags ===== */
  .filters-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* ===== Map  ===== */
  .results-map-wrapper {
    flex-direction: column;
  }

  /* par défaut : on ne montre pas la carte */
  #project-map {
    display: none;
  }

  /* quand show-map : on cache les images */
  .results-map-wrapper.show-map #image-columns {
    display: none;
  }

  /* quand show-map : carte plein écran sous la searchbar */
  .results-map-wrapper.show-map #project-map {
    display: block;
    position: fixed;
    left: 0;
    right: 0;

    /* ajuste selon ta barre (ex: 115px / 130px) */
    top: 115px;

    bottom: 0;
    width: 100%;
    height: auto;
    min-height: unset;
    margin: 0;
    z-index: 1;
  }

/* Mobile/tablette : on les affiche dans la modale */
  .more-filters-group.mobile-only {
    display: block;
  }
}


/* ---------- <= 600px : micro-ajustements mobile ---------- */
@media (max-width: 600px) {
  .mega-searchbar {
    grid-template-columns: 44px 1fr 56px 72px;
  }

  .searchbar-wrapper {
    top: 115px;
    padding: 2px 0;
    border-radius: 0;
  }

  .search-block {
    padding: 4px 14px;
  }

  /* Sécurité : aucune bordure résiduelle */
  .mega-searchbar > * {
    border-right: none;
    border-bottom: none;
  }
}


