/* Description HTML is supplier photos (size charts, lifestyle shots) at native size.
   Flex children default to min-width:auto, so the column grew with the image and
   max-width:100% never applied. Pin the column, then scale every img to it. */
.product-detail-container {
  max-width: 1200px;
  width: 100%;
  overflow-x: hidden;
}
.product-detail-content,
.product-detail-left,
.good-detail,
.good-detail-content,
.container .content .good-detail-content {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden;
}
.good-detail-content {
  width: 100% !important;
  overflow-x: auto;
}
.good-detail-content img,
.good-detail-content video,
.good-detail-content iframe {
  display: block !important;
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  margin: 10px 0 !important;
  object-fit: contain !important;
}
.good-detail-content table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}
.good-detail-content td,
.good-detail-content th {
  word-break: break-word;
}

/* Hide original swipe once AliExpress-style gallery is mounted */
.my-swipe.dx-gal-hide-swipe {
  display: none !important;
}

/* AliExpress-style gallery: thumbs + main photo */
#dx-gallery {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: #fff;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
}
#dx-gallery.dx-gal-single .dx-gal-thumbs,
#dx-gallery.dx-gal-single .dx-gal-nav,
#dx-gallery.dx-gal-single .dx-gal-count {
  display: none !important;
}
.dx-gal-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 72px;
  max-height: 420px;
  overflow-y: auto;
  flex-shrink: 0;
  padding-right: 2px;
}
.dx-gal-thumb {
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.dx-gal-thumb.is-on {
  border-color: #ff424e;
  box-shadow: 0 0 0 1px #ff424e;
}
.dx-gal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dx-gal-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 4px;
  overflow: hidden;
}
.dx-gal-main-img {
  max-width: 100%;
  max-height: 480px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.dx-gal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.dx-gal-prev { left: 10px; }
.dx-gal-next { right: 10px; }
.dx-gal-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Phone: thumbs under the main image (horizontal strip) */
@media (max-width: 900px) {
  #dx-gallery {
    flex-direction: column;
    padding: 8px 0 4px;
  }
  .dx-gal-thumbs {
    order: 2;
    flex-direction: row;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 4px;
  }
  .dx-gal-main {
    order: 1;
    min-height: 240px;
    border-radius: 0;
  }
  .dx-gal-main-img {
    max-height: 280px;
  }
  .dx-gal-thumb {
    width: 56px;
    height: 56px;
  }
}

/* Desktop product column alignment */
@media (min-width: 901px) {
  body.dx-detail-gallery .product-detail-info,
  body.dx-detail-gallery .product-detail-left .product-detail-info {
    align-items: flex-start;
  }
  #dx-gallery {
    width: 480px;
    max-width: 100%;
    flex-shrink: 0;
  }
  .dx-gal-main {
    min-height: 400px;
  }
  .dx-gal-main-img {
    max-height: 400px;
  }
}
