/* Galerie en miniatures */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  border: px solid rgba(0,0,0,.08);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, border-color .08s ease;
  transform: scale(0.8);
}

.gallery-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

.gallery-item.selected {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
  border-color: #0d6efd;
}

.gallery-item .thumb {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.gallery-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-icon {
  font-size: 42px;
  opacity: .55;
}

.gallery-item .caption {
  padding: 8px 40px 8px 8px;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #fff;
}

/* Case à cocher custom en overlay */
.select-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.select-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.select-checkbox .box {
  width: 22px;
  height: 22px;
  border: 2px solid #6c757d;
  background: #fff;
  border-radius: 6px;
  display: inline-block;
  transition: all .12s ease;
}

.gallery-item.selected .select-checkbox .box {
  border-color: #0d6efd;
  background: #0d6efd;
  box-shadow: inset 0 0 0 3px #fff;
}