/* ========================================
   SEARCH BAR
   ======================================== */

.search-bar {
  --sb-maxw: 1060px;
  --sb-padinput: 20px;
  --sb-pad: 15px 25px;
  --sb-radius: 3px;
  --sb-shadow: 0 1px 20px rgba(0,0,0,.05);
  --sb-sep: 1px solid #eae9e6;
  --sb-gap: 0; /* si tu veux un vrai gap entre les 2 champs plus tard */
  --sb-focuskey:var(--fc-munsell);
  --sb-focusloc:var(--fc-light-green);     
  /* version sticky = zéro “jump” */
  position: sticky;
  top: var(--header-h);
  z-index: 1;
  margin-top: 20px;
  padding: var(--sb-pad);
  background: var(--color-bg);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
}

.search-bar.is-fixed { animation: none; }

/* Animer uniquement tant que .was-fixed n’est pas présent */
.search-bar.is-fixed:not(.was-fixed) {
  animation: slideDown .5s ease both;
}

/* (optionnel) accessibilité */
@media (prefers-reduced-motion: reduce){
  .search-bar.is-fixed:not(.was-fixed){ animation: none; }
}

/* animation pour adoucir */
@keyframes slideDown {
  from {
    transform: translateY(-100%);  
  }
  to {
    transform: translateY(0);     
  }
}

/* ===== Inner layout ===== */
.search-bar__inner{
  margin: 0 auto;
  max-width: var(--sb-maxw);
  display: grid;
  grid-template-columns: 1fr 1fr auto; /* keyword | localisation | bouton filtres */
  align-items: center;
  gap: var(--sb-gap);
}

/* ===== Keyword field ===== */
.search-bar__keyword{
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: var(--sb-padinput);        
}

/* Séparateur vertical entre keyword et localisation */
.search-bar__keyword::after{
  content: "";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  height: 60%;
  border-right: var(--sb-sep);
}

.keyword__input{
  height: var(--height-input);
  width: 100%;
  border: none;
  background: transparent;
  padding-right: 8px;
  min-width: 0;
}

.keyword__input:focus + .keyword-submit i {
  color: var(--sb-focuskey);
}

.keyword-submit{
  cursor: pointer;
  transition: color 0.3s ease;
  padding: 0;
}

/* ===== Localisation field ===== */
.search-bar__localisation{
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  padding-left: var(--sb-padinput);
  min-width: 0;
}

.localisation__input{
  height: var(--height-input);
  width: 100%;
  border: none;
  background: transparent;
  padding-left:  var(--sb-padinput); 
  cursor: pointer;
  min-width: 0;
}

.localisation__input:focus + i {
  color: var(--sb-focusloc);
}

.localisation__input:focus, .keyword__input:focus {
  outline: none;   
  border: none;   
  box-shadow: none;
}
.localisation__header {
  display: flex;
  gap: var(--gap-xl);
  align-items: center;
}
.localisation__icon{ font-size: var(--fs-400); }

/* Liste de résultats localisation */
.localisation__result, .localisation__panel, .suggest-listbox {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 25px);
  display: none;                 /* JS l’ouvrira */
  background: var(--color-bg);
  padding: 20px;
  border-radius:20px;
  box-shadow:
    0 10px 15px -3px rgba(0,0,0,.1),
    0 4px 6px -2px rgba(0,0,0,.05);
  font-size: var(--fs-200);
  z-index: 20;
  
}
.localisation__panel--flex-column {
  flex-direction: column;
  gap: 20px;
}
.localisation__result--flex-columm {
  flex-direction: column;
  gap: 7px;
}
.suggest-listbox--flex-column {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ===== Bouton filtres (colonne 3) ===== */
.search-filter{
  position: relative;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--height-input);
  padding: 0 12px;
  background: var(--color-main-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s ease;
}
.search-filter:hover{
  background: color-mix(in srgb, var(--color-hightlight), #fff 94%);
}

/* ===== Ouverture des listes (classe utilitaire) ===== */
.is-open > .keyword-input__result,
.is-open > .localisation__result{
  display: block !important;
}

/* ===== Responsive ===== */
@media (max-width: 900px){
  .search-bar__inner{
    grid-template-columns: 1fr 1fr;
    row-gap: 12px;
  }
  #filter{ grid-column: 1 / -1; justify-self: stretch; }
}
@media (max-width: 640px){
  .search-bar__inner{
    grid-template-columns: 1fr; /* empile tout */
  }
  .search-bar__keyword::after{ display: none; } /* pas de séparateur en pile */
}
@media (max-width: 768px) {
  .search-bar{
    display: none;
  }
}


/* ========================================
   SHEET — Mobile/Tablet (iOS friendly)
   - Header & Footer collés
   - Scroll interne only
   - Safe-areas iOS
   - Renommage .sheet__ui -> .sheet__footer
   ======================================== */

:root{
  /* Anim */
  --sheet-dur: .3s;
  --sheet-overlay-dur: .3s;
  --sheet-ease-in: cubic-bezier(.33, 0, 0, 1);
  --sheet-ease-out: cubic-bezier(.33, 0, 0, 1);
  --title-slide-dur: 400ms;
  --title-slide-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* UI */
  --bottom-bar-h: 56px; /* ajuste si ta .bottom-bar diffère */
  --surface-border: #eee;
  --footer-pad: 20px;
  --header-pad-x: 16px;
  --header-pad-y: 12px;

  /* Safe areas (iOS Notch) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Les sheets passent AU-DESSUS de la bottom-bar */
.sheets-container{
  position: relative;
  z-index: 2000;            /* > z-index de .bottom-bar */
  max-width: 100%;
  overflow: hidden !important;
}

/* iOS scrolling fluide dans les conteneurs défilants */
@supports (-webkit-touch-callout: none){
  .sheet__body,
  .sheet__scroll{
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* --------------------------------------------------
   Scroll-lock page (géré par JS, mais styles prêts)
---------------------------------------------------*/
html.sheet-open,
body.sheet-locked{
  overflow: hidden !important;
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
}

/* --------------------------------------------------
   Overlay
---------------------------------------------------*/
.sheet-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  opacity: 0;
  pointer-events: none;
  overflow: hidden !important;
  transition: opacity var(--sheet-overlay-dur) var(--sheet-ease-in);
  /* Évite les gestes qui traversent sur iOS */
  touch-action: none;
}
.sheet-overlay.is-visible{
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------
   Sheet (plein écran, au-dessus de la bottom bar)
---------------------------------------------------*/

@supports (height: 100dvh){
  .sheet{ height: 100dvh; }             /* viewport dynamique moderne */
}
/* Fallback iOS anciens WebKit */
@supports (-webkit-touch-callout: none){
  .sheet{ height: -webkit-fill-available; }
}

.sheet {
  position: fixed;
  inset: 0;
  /* Hauteur vraiment "visuelle" iOS : */
  height: 100svh;
  background: #fff;
  /*box-shadow: 0 -12px 40px rgba(0,0,0,.18);*/
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  padding-bottom: max(var(--safe-bottom), 0px);
  transform: translateY(100%);
  will-change: transform;
  pointer-events: none;
  overflow: hidden !important;
  overscroll-behavior: contain;
  touch-action: none;
}

/* ====== MOBILE / TABLET : bottom-sheet vertical ====== */
@media (max-width: 1023.98px) {
  .sheet.is-opening {
    animation: sheetIn var(--sheet-dur) var(--sheet-ease-in) forwards;
  }
  .sheet.is-open {
    transform: translateY(0);
  }
  .sheet.is-closing {
    animation: sheetOut var(--sheet-dur) var(--sheet-ease-out) forwards;
  }
}

/* ====== DESKTOP : panneau latéral droite ====== */
@media (min-width: 1024px) {
  .sheet {
    /* part de la droite */
    width: min(420px, 100vw);  /* adaptatif */
    left: auto;
    right: 0;
    transform: translateX(100%);
    /*box-shadow: -12px 0 40px rgba(0,0,0,.18);*/
    padding-bottom: 0; /* plus de safe-bottom en desktop */
  }

  .sheet-overlay {
    background: rgb(0 0 0 / 55%);
    cursor: pointer;
  }

  .sheet.is-opening {
    animation: sheetInRight var(--sheet-dur) var(--sheet-ease-in) forwards;
  }
  .sheet.is-open {
    transform: translateX(0);
  }
  .sheet.is-closing {
    animation: sheetOutRight var(--sheet-dur) var(--sheet-ease-out) forwards;
  }
}

/* Visibilité (commune mobile + desktop) */
.sheet[aria-hidden="true"] { visibility: hidden; }
.sheet.is-opening,
.sheet.is-open,
.sheet.is-closing {
  visibility: visible;
  pointer-events: auto;
}

/* Keyframes */
@keyframes sheetIn   { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetOut  { from { transform: translateY(0); }    to { transform: translateY(100%); } }
@keyframes sheetInRight  { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes sheetOutRight { from { transform: translateX(0); }    to { transform: translateX(100%); } }


/* --------------------------------------------------
   Header — collé en haut (safe-area friendly)
---------------------------------------------------*/
.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;

  /* Hauteur fixe + padding adaptatif top (safe-area) */
  block-size: 64px; /* hauteur visuelle souhaitée */
  padding-inline: var(--header-pad-x);
  padding-block-start: calc(var(--safe-top, 0px) + 8px);
  padding-block-end: 8px;

  border-bottom: 1px solid var(--surface-border);
  overflow: hidden;
  box-sizing: border-box;
}

.sheet__title{
  display: inline-flex;
  align-items: center;
  gap: .625rem;
}
.sheet__title {
  transform: none !important;
  animation: none !important;
}
.sheet.title-visible .sheet__title,
.sheet.title-intro .sheet__title {
  transform: none !important;
  animation: none !important;
}
.sheet__title i { font-size:var(--fs-600);}
.sheet__title h2{
  margin: 0;
  font-size: var(--fs-500, 1.125rem);
}
.sheet__logo{ width: 40px; height: 40px; }

/* Titre: fin d'anim / switch */
.sheet.title-visible .sheet__title{ transform: translateX(0); }
.sheet.title-intro .sheet__title{
  animation: titleSlideInBounce var(--title-slide-dur) var(--title-slide-ease) forwards;
}
@keyframes titleSlideInBounce{
  0%{ transform: translateX(-110%);}
  78%{ transform: translateX(4%);}
  100%{ transform: translateX(0);}
}
/* --------------------------------------------------
   Body (non scrollant) + zone scroll dédiée
---------------------------------------------------*/
.sheet__body{
  /* Le body reste “conteneur” (non scrollant) */
  overflow: hidden;
  padding: 20px; /* léger padding si tu n'utilises pas .sheet__scroll */
}
.sheet__body.sheet__body--localisation {
    display: inline-flex;
    flex-direction: column;
    gap: 20px;
}
/* text si pas de criter de recherche  */
.sheet__no-filter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* indispensable */
  text-align: center;
}
/* Zone scrollable dédiée (ex: #sheet-filters) */
.sheet__scroll{
  flex: 1 1 auto;
  min-height: 0;                    /* crucial pour grid + iOS */
  overflow: auto;                   /* seul élément qui scrolle */
  -webkit-overflow-scrolling: touch;
  display: block;
  padding: 15px 25px 25px;
  margin-bottom: 0;                 /* footer désormais collé, pas besoin d’espace */
  overscroll-behavior: contain;     /* empêche le “pull to bounce” parent */
}
.sheet__scroll h4{
  font-size: inherit;
  margin-top: 1rem;
  margin-bottom: .5rem;
}
.sheet__scroll h4:first-of-type{
  margin-top: 0;
  margin-bottom: .5rem;
}
/* --------------------------------------------------
   Section
---------------------------------------------------*/
.sheet__section {
  position: relative;
}
/* --------------------------------------------------
   Panel
---------------------------------------------------*/
.sheet__panel {
  overflow: auto;                       /* doit scroller */
  -webkit-overflow-scrolling: touch;    /* inertie iOS */
  touch-action: pan-y;                  /* autorise le scroll vertical */
  overscroll-behavior: contain;         /* évite de scroller l'arrière-plan */
}

/* --------------------------------------------------
   TAGS 
---------------------------------------------------*/
.sheet__tags-container {
  padding: 0.9rem 0;
  margin-bottom: 15px;
}
.sheet__tags-container[data-has="0"], .localisation__tags-container[data-has="0"] {
  display: none;
}
.sheet__tags-container[data-has="1"], .localisation__tags-container[data-has="1"]  {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-start;
}
.sheet__tags.is-visible{ display: grid; }
.sheet__tags{
  display: none;
  
}
.sheet__tags[data-visible="0"]{ display: none; }
.sheet__tags[data-visible="1"]{
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
  background:#fff;
  border-bottom: 1px solid var(--surface-border);
}
.sheet__tags > div{ display: flex; flex-wrap: wrap; gap: 6px; }
.sheet__tags > div[data-has="0"]{ display: none; }
.sheet__tags-title[visible="0"] {
  display: none;
}
.sheet__tags-title[visible="1"] {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: solid 1px #c3c3c3;
  padding-bottom: 10px;
}

/* --------------------------------------------------
   Footer (renommage .sheet__ui -> .sheet__footer)
   - Collé en bas
---------------------------------------------------*/
.sheet__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;

  /* Hauteur fixe + sécurité iOS */
  block-size: 64px; /* hauteur visuelle du footer */
  padding-inline: var(--footer-pad, 16px);
  padding-block-end: calc(var(--safe-bottom, 0px) + 8px);
  padding-block-start: 8px;

  background: #fff;
  border-top: 1px solid var(--surface-border);
  box-sizing: border-box;

  /* Sécurité viewport */
  inline-size: 100%;
  max-inline-size: 100vw;
  flex-shrink: 0; /* empêche l’écrasement en flex parent */
}

.sheet__footer--reset {
  block-size: auto; 
  border-top: none;
  flex-direction: column;
}

/* Alias temporaire pour ne rien casser pendant la migration */
.sheet__ui{ /* DEPRECATED: remplacé par .sheet__footer */
  left: 0; right: 0; padding: var(--footer-pad);
  background: #fff;
  border-top: 1px solid var(--surface-border);
  padding-bottom: calc(var(--footer-pad) + var(--safe-bottom));
  box-sizing: border-box;
  max-width: 100vw;
}

/* Bouton d’action principal dans le footer */
.sheet__footer button,
.sheet__ui button{
  background: #fff;
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 8px 12px;
  border-radius: 20px;
  width: 100%;
  justify-content: center;
  font-weight: bold;
  color: #405059;
  border: 2px solid #405059;
}

/* --------------------------------------------------
   Réductions motion
---------------------------------------------------*/
@media (prefers-reduced-motion: reduce){
  .sheet-overlay{ transition: none; }
  .sheet.is-opening, .sheet.is-closing{ animation: none; }
  .sheet.is-open{ transform: none; }
  .sheet.title-intro .sheet__title{ animation: none; }
  .sheet.title-visible .sheet__title{ transform: none; }
}

/* --------------------------------------------------
   Divers (x overflow)
---------------------------------------------------*/
.sheet,
.sheet__footer{ max-width: 100vw; }
.sheet{ overflow-x: hidden; }


.sheet--sub {
  inset: 0;
  background: #fff;
  z-index: 1600; /* au-dessus du sheet parent */
  transform: translateX(100%);
  will-change: transform;
  pointer-events: none;
  visibility: hidden;
}
.sheet--sub .sheet__title {
  transform:none;
}

.sheet--sub.is-active {
  visibility: visible;
  pointer-events: auto;
  animation: slideInSheet var(--sheet-dur, 360ms) var(--sheet-ease-in, cubic-bezier(0.22, 1, 0.36, 1)) forwards;
}

.sheet--sub.is-leaving {
  visibility: visible;
  animation: slideOutSheet var(--sheet-dur, 360ms) var(--sheet-ease-out, cubic-bezier(0.7, 0, 0.3, 1)) forwards;
}

.sheet--sub.is-leaving-down {
  visibility: visible;
  animation: subLeaveDown var(--sheet-dur, 360ms) var(--sheet-ease-out, cubic-bezier(0.7,0,0.3,1)) forwards;
}

@keyframes slideOutBackSheet {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
/* Keyframes horizontaux */
@keyframes slideInSheet {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideOutSheet {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}
@keyframes subLeaveDown {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

/*============================
/ FILTRES
/*============================*/

/* ================================
   Localisation Mobile — v1.0
   ================================ */

.localisation__result--m {
  position: absolute;
  flex-direction: column;
  left: 0;
  right: 0;
  top: calc(100%);
  z-index: 5000;

  max-height: 42vh;
  min-height: 42vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;

  background: #fff;
  padding-block: 4px;
  list-style: none;
  margin: 0;
}

.localisation__result--m li {
  padding: 10px 16px;
  line-height: 1.5;
  cursor: pointer;
}

.localisation__result--m li + li {
  border-top: 1px solid var(--surface-border, #eee);
}

/* Effet tactile/hover/active */
.localisation__result--m li:hover,
.localisation__result--m li:active {
  background: var(--surface-hover, #f4f4f4);
}

/* Accessibilité visuelle */
.localisation__result--m li[aria-selected="true"] {
  background: var(--accent-bg, #e9e5ff);
  color: var(--accent-fg, #3d2db7);
}

.localisation__preset--list, .localisation__preset--list-m {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  gap: 5px;
}

.localisation__preset--list li, .localisation__preset--list-m li {
  display: flex;
  justify-content: space-around;
  border: solid 1px #adadad;
  border-radius: 40px;
  padding: 5px 10px;
  width: 100%;
  cursor: pointer;
}
.localisation__range-panel, .localisation__range-radius--m {
  flex-direction: column;
  gap: 10px;
}

/*--------------------------------------------
/  bright
/*-------------------------------------------*/

.filter-block--bright { --accent: #e74c3c; }

/* conteneur */
.bright-slider { display: grid; gap: .5rem; }

/* échelle texte */
.bright-slider__scale {
  display: flex; justify-content: space-between;
  font-size: .875rem; color: #666;
}

/* range de base */
.bright-slider__input, .radius-slider__input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  background: linear-gradient(90deg, #eee, #ddd);
  border-radius: 999px;
  outline: none;
  transition: box-shadow .2s ease, background .2s ease;
}

/* track (webkit) */
.bright-slider__input::-webkit-slider-runnable-track, .radius-slider__input::-webkit-slider-runnable-track {
  /*height: 12px; */
  border-radius: 999px;
 /* background: linear-gradient(90deg, #eee, #ddd);*/
}
/* thumb (webkit) */
.bright-slider__input::-webkit-slider-thumb, .radius-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 25px; height: 25px; margin-top: 0px;
  border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  border: solid #ff1749 1px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bright-slider__input:active::-webkit-slider-thumb, .radius-slider__input:active::-webkit-slider-thumb  { transform: scale(1.05); }

/* track (Firefox) */
.bright-slider__input::-moz-range-track, .radius-slider__input::-moz-range-track {
  height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, #eee, #ddd);
}
/* thumb (Firefox) */
.bright-slider__input::-moz-range-thumb, .radius-slider__input::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bright-slider__input:active::-moz-range-thumb, .radius-slider__input:active::-moz-range-thumb { transform: scale(1.05); }

/* focus ring */
.bright-slider__input:focus-visible, .radius-slider__input:focus-visible {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, .25);
}

/* ticks (optionnel) */
#bright-ticks option { color: transparent; }

/*--------------------------------------------
/  format
/*-------------------------------------------*/

.filter-format--layout {
  display: flex;
  gap: 12px;
}

.filter-format--layout [data-value] {
  flex: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #f5f5f5;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  position: relative;
  padding: 8px;
}

/* Chaque format = une "mini-vignette" interne */
.filter-format--layout [data-value]::before {
  content: "";
  display: block;
  background: #ddd;
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

/* Portrait = ratio vertical */
.filter-format--portait::before {
  width: 40%;
  aspect-ratio: 3 / 4;
}

/* Paysage = ratio horizontal */
.filter-format--landscape::before {
  width: 70%;
  aspect-ratio: 16 / 9;
}

/* Carré */
.filter-format--square::before {
  width: 50%;
  aspect-ratio: 1 / 1;
}

/* Hover (optionnel) */
.filter-format--layout [data-value]:hover {
  border-color: #bbb;
}

/* Sélectionné */
.filter-format--layout [data-value].is-selected {
  border-color: #ff1749;
  background: #fff;
}

.filter-format--layout [data-value].is-selected::before {
  background: #ff1749;
}