#thumbnail-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 5px;
  box-sizing: border-box;
  width: 100%;
  align-content: start;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.thumbnail {
  border-radius: 0.2em;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s;
  background-color: #1e1e1e;
  width: 100%;
  padding-top: 100%; /* Keeps thumbnails square */
}

.thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
}

.thumbnail-title {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  color: rgb(225, 225, 225);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.5s;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* Limits the text to 2 lines */
  overflow: hidden;
  word-break: break-word; /* Breaks long words to prevent overflow */
  text-align: center;
}

.thumbnail:hover .thumbnail-title {
  opacity: 1;
}

.thumbnail:hover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: opacity 0.5s;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.9));
  z-index: 1;
}

.overlay-icon {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 14px;
  color: white;
  margin-right: 5px;
  opacity: 0;
  transition: opacity 0.5s;
  z-index: 2;
}

.thumbnail:hover .overlay-icon {
  opacity: 1;
  animation: slideInLeft 0.5s forwards;
}

.overlay-icon + .overlay-icon {
  left: 40px;
}

.resize-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 1000;
}

.resize-button {
  background-color: #121212;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, color 0.3s;
}

.resize-button:hover {
  background-color: #1e1e1e;
  color: #edb049;
}

/* Responsive Design for Medium Screens */
@media screen and (min-width: 548px) and (max-width: 1280px) {
  #thumbnail-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .thumbnail-title {
    font-size: 16px;
  }
  .overlay-icon {
    font-size: 14px;
  }
}

/* Responsive Design for Small Screens */
@media screen and (min-width: 375px) and (max-width: 667px) {
  #thumbnail-container {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .thumbnail-title {
    font-size: 14px;
    bottom: 5px;
    left: 5px;
    right: 5px;
    opacity: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.75);
    background-color: rgba(0, 0, 0, 0.7); /* Added for better contrast */
    padding: 5px;
    border-radius: 3px;
  }
  .overlay-icon {
    top: 5px;
    left: 5px;
    font-size: 12px;
  }
  .overlay-icon + .overlay-icon {
    left: 25px;
  }
  @keyframes slideInLeftSmall {
    from {
      transform: translateX(-15px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  .thumbnail:hover .overlay-icon {
    animation: slideInLeftSmall 0.5s forwards;
  }
}