.wp-image-selector {
  flex-direction: column;
  display: flex;
  gap: 30px;
  margin: 20px 0;
}

.wp-image-selector .preview {
  width: 100%;
}

.wp-image-selector .preview img {
  width: 100%;
  max-width: 100%;
  border-radius: 6px;
}

.wp-image-selector .thumbs {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.wp-image-selector .thumbs-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 20px;
}

/* .wp-image-selector .thumbs-container img {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.wp-image-selector .thumbs-container img:hover {
  border-color: #0073aa;
} */

.thumb-wrapper {
  position: relative;
  aspect-ratio: 1/1; /* vuông, tự động co theo chiều ngang */
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
}

.thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* overlay mặc định mờ */
.thumb-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 50%);
  transition: background 0.2s;
  border-radius: 4px;
}

/* hover thì giảm mờ */
.thumb-wrapper:hover::after {
  background: rgba(0, 0, 0, 0.1);
}

/* ảnh đang active (đang hiển thị ở preview) thì không có overlay */
.thumb-wrapper.active::after {
  background: transparent;
  border: 2px solid #0073aa;
}

.preview {
  position: relative;
  width: 400px; /* tùy chỉnh */
  max-width: 100%;
  aspect-ratio: 4/3; /* tùy chỉnh */
  overflow: hidden;
}

.preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.preview img.active {
  opacity: 1;
  z-index: 2;
}

@media (min-width: 768px) {
  .wp-image-selector {
    flex-direction: row;
  }

  .wp-image-selector .preview {
    width: 60%;
  }
  .wp-image-selector .thumbs {
    width: 40%;
  }
}
