/* GENERAL */

input::placeholder {
  font-style: italic;
}


/* =========================
   LAYOUT : sidebar + contenu
   ========================= */


/* ✅ SIDEBAR : max 25% écran, responsive */
.sidebar{
  border-right: 1px solid #e2e5ea;

  /* min: 280px (lisible)
     fluide: 22vw
     max: 25vw (¼ écran) */
  flex: 0 0 clamp(280px, 22vw, 25vw);
  width: clamp(280px, 22vw, 25vw);
  max-width: 25vw;
}

/* sidebar : éviter débordements dans flex */
.sidebar .d-flex,
.sidebar .row,
.sidebar .col,
.sidebar .col-md-6{
  min-width: 0;
}
.sidebar input,
.sidebar select,
.sidebar textarea{
  width: 100%;
  max-width: 100%;
}
.sidebar .d-flex.align-items-center.gap-2{
  flex-wrap: wrap;
}

.sidebar .d-flex.align-items-center.gap-2 > *:not(#clearDates){
  flex: 1 1 220px;
  min-width: 180px;
}

#clearDates{
  flex: 0 0 auto;
  min-width: auto;
}

.custom-container > .d-flex.flex-row.gap-5 > .d-flex.flex-column{
  flex: 1 1 auto;
  min-width: 0;   /* crucial */
  width: 100%;
}

.sidebar.sticky-top{
  top: 12px;                      
  max-height: calc(100vh - 12px);  /* 100vh moins le top */
  overflow-y: auto;
  overscroll-behavior: contain;    /* évite le “scroll chain” */
}


#recherche-et-index {
  padding-bottom: 1.5rem;
}


/* =========================
   GRID / LISTE
   ========================= */

#vignettes.image-grid{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* neutralise les marges inline dans le HTML */
.canvas-tile{
  margin: 0 !important;
}

/* thumb mosaïque (carré) */
.canvas-link.thumb{
  display:block;
  width:100%;
  aspect-ratio: 1 / 1;
  overflow:hidden;
  /* border-radius: 10px; */
  background:#eee;
}
.canvas-link.thumb img,
.canvas-link.thumb .card-img-top{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

/* ✅ MODE LISTE : 1 colonne + image à gauche */
#vignettes.image-grid.is-list{
  grid-template-columns: 1fr;
  gap: 10px;
}

#vignettes.image-grid.is-list .canvas-tile{
  display: flex;
  flex-direction: row;      /* image à gauche */
  align-items: center;
  gap: 14px;
  padding: 10px;
  width: 100%;
}

#vignettes.image-grid.is-list .canvas-tile{
  border-radius: 1rem 1rem 1rem 1rem;
}

.canvas-tile{
  border-radius: 1rem 1rem 1rem 1rem;
}
.canvas-link.thumb {
  border-radius: 1rem 1rem 0 0;
}

/* image à gauche, taille fixe */
#vignettes.image-grid.is-list .canvas-link.thumb{
  width: 120px;
  flex: 0 0 120px;
  aspect-ratio: 1 / 1;
}

/* texte à droite */
#vignettes.image-grid.is-list .card-body{
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 !important;
}
#vignettes.image-grid.is-list .card-title{
  margin: 0;
}

/* =========================
   RESPONSIVE : sidebar au-dessus
   ========================= */
@media (max-width: 992px){
  .custom-container > .d-flex.flex-row.gap-5{
    flex-wrap: wrap;
  }

  .sidebar{
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e2e5ea;
  }

  .custom-container > .d-flex.flex-row.gap-5 > .d-flex.flex-column{
    flex: 1 1 100%;
    min-width: 0;
  }
}


/* Slider dates */

.noUi-connect {
  background-color: #D20A11;;
}

/* bulk select */
.canvas-tile{
  position: relative;
}

.bulk-index-badge{
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background: #D20A11;
  color: white;
  font-weight: 600;
  font-size: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.bulk-check{
  display: none !important;
}

.canvas-tile.bulk-selected .canvas-link.thumb img{
  opacity: 0.5;
  transition: opacity 0.15s ease;
}


/* =========================
   MODE LISTE - type Bootstrap row card
   ========================= */

.image-grid.is-list{
  grid-template-columns: 1fr; /* une seule colonne */
  gap: 16px;
}

/* card horizontale */
.image-grid.is-list .canvas-tile{
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

/* bloc image (équivalent col-md-4) */
.image-grid.is-list .canvas-link.thumb{
  flex: 0 0 220px;        /* largeur image */
  max-width: 220px;
  aspect-ratio: auto;     /* on annule le carré */
  height: auto;
  border-radius: 1rem 1rem 1rem 1rem;
}

/* image */
.image-grid.is-list .canvas-link.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem 1rem 1rem 1rem;
}

/* texte (équivalent col-md-8) */
.image-grid .card-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
}

.image-grid.is-list .card-body {
  text-align: left;
  align-items: flex-start;     /* aligne à gauche en flex */
}

/* titre */
.image-grid.is-list .card-title{
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.canvas-tile .card-title{
  font-weight: 600;
  line-height: 1.2;
}

.canvas-tile .badge{
  font-weight: 500;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.bulk-mode .canvas-tile .stretched-link::after {
  pointer-events: none;
}

body.bulk-mode .canvas-tile {
  cursor: pointer;
}

body.bulk-mode .bulk-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  display: block;
}

body.bulk-mode .canvas-tile.bulk-selected {
  outline: 3px solid #d20a11;
  outline-offset: 2px;
}

.bulk-index-badge {
  position: absolute;
  top: 8px;
  left: 42px;
  z-index: 40;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: #d20a11;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}