.woocommerce-product-gallery.images {
  display: block;
}
.woocommerce-product-gallery.images .woocommerce-product-gallery__wrapper {
  display: block;
}
/* Product Detail plugin styles for Product Detailed Pictures */
.gallery-view-detailed-pictures {
  margin-top: 20px;
  margin-bottom: 10px;
  padding: 15px;
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  width: 100%;
  box-sizing: border-box;
}
.gallery-view-title {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: bold;
  color: #333;
  border-bottom: 2px solid #0073aa;
  padding-bottom: 8px;
}
.gallery-view-gallery-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #f8f8f8;
  border: 1px dashed #ddd;
  min-height: 160px;
}
.gallery-view-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px;
  min-height: 140px;
}
.gallery-image-item {
  flex: 0 0 120px;
  width: 120px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  display: block;
  background: #f9f9f9;
  border: 2px solid #ddd;
}
.gallery-image-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: #0073aa;
}
.gallery-view-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  display: block;
  background: transparent;
}
.gallery-image-item.selected,
.gallery-image-item:has(.gallery-view-gallery-img.selected) {
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0,115,170,0.3);
}
/* Selected badge (check mark) */
.gallery-image-item.selected::after,
.gallery-image-item:has(.gallery-view-gallery-img.selected)::after {
  content: '\2714'; /* check mark */
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 16px;
  color: #fff;
  background: #2c7cf6;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.gallery-placeholder-message {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-style: italic;
  min-height: 120px;
  width: 100%;
  text-align: center;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 2px dashed #ddd;
}
/* Optional main image styling if present */
.gallery-view-main-img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
/* Ensure images do not exceed wrapper width */
.woocommerce-product-gallery__wrapper {
  max-width: 100%;
  overflow: hidden;
  display: block;
}
.woocommerce div.product div.images{
  padding-left: 0 !important;
}
.woocommerce-product-gallery__wrapper img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}
.gallery-view-main-image-container, .gallery-view-main-placeholder {
  max-width: 100%;
}
/* Keep main image area constrained similarly to Woo default */
.gallery-view-main-image .woocommerce-product-gallery__wrapper {
  width: 100%;
}
.gallery-view-main-image-container {
  width: 100%;
  position: relative;
}
/* 3D iframe container responsiveness */
.gallery-view-3d-iframe-container {
  width: 100% !important;
  max-width: 100%;
}
.gallery-view-3d-iframe-container iframe {
  width: 100% !important;
  height: 100% !important;
}

/* 3D view left floating thumbnails */
.pd-3d-left-thumbs {
  position: absolute;
  top: 20px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}
.pd-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.pd-zoom-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.pd-zoom-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.pd-zoom-close:hover { background: rgba(255,255,255,0.28); }
.pd-3d-thumb {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  background: #ffffff;
}
.pd-3d-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pd-3d-thumb.selected {
  border-color: #1e90ff;
  box-shadow: 0 0 0 2px rgba(30,144,255,0.4);
}

/* Special first thumbnail with background image and icon overlay */
.pd-3d-special-thumb {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pd-3d-icon-overlay {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.pd-3d-thumb .pd-3d-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(30,144,255,0.95);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 12px;
  line-height: 1;
}
@media (max-width: 768px) {
  .gallery-view-gallery { gap: 8px; padding: 8px; }
  .gallery-image-item { flex: 0 0 100px; width: 100px; height: 120px; }
  .gallery-view-title { font-size: 14px; }
  
  /* Mobile responsive for 3D icon overlay */
  .pd-3d-icon-overlay {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
  
  .pd-3d-left-thumbs {
    top: 15px;
    left: 8px;
    gap: 10px;
  }
  
  .pd-3d-thumb {
    width: 70px;
    height: 70px;
  }
}

/* ------------------------------------------------------------------
   Single Product responsive layout fixes (tablet & mobile)
   Ensure images/summary stack and fill the container on small screens
------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .single-product .content_wrap,
  .single-product .content_container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
  }

  .woocommerce div.product div.images,
  .woocommerce div.product .gallery-view-main-image,
  .woocommerce div.product div.summary {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding-left: 0 !important;
    clear: both !important;
  }

}

@media (max-width: 768px) {
  .single-product .content_wrap,
  .single-product .content_container {
    padding-left: 12px;
    padding-right: 12px;
  }

  
}

/* ==========================================
   购物车产品图片预览组件样式 (替代763-764行内联样式)
   ========================================== */

/* 购物车图片预览容器 */
.cart-image-preview-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    overflow-x: auto;
    gap: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* 单图显示容器 */
.cart-image-preview-container.single-image {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: visible;
}

/* 单个图片项容器 (替代763行内联样式) */
.cart-image-item{
    display: inline-block !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    width: 75px !important;
    padding: 2px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* 购物车图片样式 (替代764行内联样式) */
.cart-image-thumb {
    width: 70px !important;
    height: 70px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    border: 3px solid #0000008c !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    cursor: pointer !important;
    display: block !important;
    box-sizing: border-box !important;
}

/* 封面图片样式 */
.cart-image-thumb.cover {
    object-fit: cover !important;
}

/* 图片标签 */
.cart-image-label {
    font-size: 11px !important;
    color: #666 !important;
    font-weight: 500 !important;
    margin-top: 4px !important;
    line-height: 1.2 !important;
    text-align: center !important;
}

/* 单图模式标签间距 */
.cart-image-preview-container.single-image .cart-image-label {
    margin-top: 4px;
}

/* 鼠标悬停效果 */
.cart-image-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

/* 自定义滚动条样式 */
.cart-image-preview-container::-webkit-scrollbar {
    height: 6px;
}

.cart-image-preview-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-image-preview-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.cart-image-preview-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 平板端优化 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .cart-image-item{
        width: 36px !important;
        padding: 1px !important;
        margin: 0px !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .cart-image-thumb {
        width: 51px !important;
        height: 50px !important;
        border-width: 2px !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 4px !important;
        display: block !important;
        margin: 0px !important;
    }
    
    .cart-image-label {
        font-size: 8px !important;
        margin-top: 1px !important;
        margin-bottom: 0px !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        padding: 0px !important;
    }
    
    .cart-image-preview-container {
        gap: 0px !important;
        margin: 0px !important;
        padding: 0px !important;
    }
}

/* 手机端优化 (最大768px) */
@media (max-width: 768px) {
    .cart-image-preview-container {
        gap: 0px !important;
        padding: 0 !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    .cart-image-item{
        width: 55px !important;
        padding: 0px !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .cart-image-thumb {
        width: 35px !important;
        height: 45px !important;
        border-width: 1px !important;
        border-radius: 4px !important;
        box-shadow: 0 1px 6px rgba(0,0,0,0.1) !important;
        box-sizing: border-box !important;
    }
    
    .cart-image-label {
        font-size: 7px !important;
        margin-top: 1px !important;
        font-weight: 400 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.1 !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    /* 手机端悬停效果调整 */
    .cart-image-thumb:hover {
        transform: none !important;
        box-shadow: 0 1px 6px rgba(0,0,0,0.15) !important;
    }
    
    /* 防止购物车项目内容超宽 */
    .woocommerce table.cart .cart-image-preview-container {
        max-width: calc(100vw - 20px) !important;
        width: auto !important;
    }
}

/* 小屏手机端优化 (最大480px) */
@media (max-width: 480px) {
    .cart-image-item {
        width: 34px !important;
        padding: 0px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 0px !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .cart-image-thumb {
        width: 32px !important;
        height: 33px !important;
        margin-right:2px !important;
        border-radius: 3px !important;
        border-width: 1px !important;
        box-sizing: border-box !important;
    }
    
    .cart-image-label {
        font-size: 8px !important;
        margin-top: 1px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1 !important;
    }
    
    /* 极小屏幕下的购物车容器 */
    .woocommerce table.cart .cart-image-preview-container {
        max-width: calc(100vw - 10px) !important;
    }
}

/* 超小屏幕优化 (最大400px) */
@media (max-width: 400px) {
    .cart-image-preview-container {
        padding: 0 !important;
        max-width: 100% !important;
        gap: 0px !important;
    }
    
    .cart-image-item{
        width: 45px !important;
        padding: 0px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .cart-image-thumb {
        width: 38px !important;
        height: 36px !important;
        margin-right:2px !important;
        border-width: 1px !important;
        border-radius: 3px !important;
        box-sizing: border-box !important;
    }
    
    .cart-image-label {
        font-size: 5px !important;
        margin-top: 1px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1 !important;
    }
    
    /* 超小屏幕下的购物车容器 */
    .woocommerce table.cart .cart-image-preview-container {
        max-width: calc(100vw - 20px) !important;
    }
}

/* 极小屏幕优化 (最大320px - iPhone SE等) */
@media (max-width: 320px) {
    .cart-image-item{
        width: 32px !important;
        padding: 0px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    .cart-image-thumb {
        width: 30px !important;
        height: 32px !important;
        border-width: 1px !important;
        border-radius: 2px !important;
    }
    
    .cart-image-label {
        font-size: 4px !important;
        margin-top: 0px !important;
        line-height: 1 !important;
    }
    
    .woocommerce table.cart .cart-image-preview-container {
        max-width: calc(100vw - 15px) !important;
        gap: 0px !important;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .cart-image-thumb {
        /* 移除悬停效果，增加点击反馈 */
        transition: transform 0.1s ease !important;
    }
    
    .cart-image-thumb:active {
        transform: scale(0.95) !important;
    }
    
    /* 增大触摸目标 */
    .cart-image-item{
        min-height: 44px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
}

/* ==========================================
   图片放大浏览器 (Image Lightbox)
   ========================================== */

/* 点击放大提示样式 */
.clickable-zoom {
    cursor: pointer !important;
    position: relative !important;
}

.clickable-zoom:hover {
    opacity: 0.8 !important;
}

.clickable-zoom::after {
    content: '🔍' !important;
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-size: 10px !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease !important;
    pointer-events: none !important;
}

.clickable-zoom:hover::after {
    opacity: 1 !important;
}

/* 模态框主容器 */
.image-lightbox-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9) !important;
    z-index: 999999 !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.image-lightbox-overlay.active {
    display: flex !important;
    opacity: 1 !important;
}

/* 模态框内容容器 */
.image-lightbox-content {
    position: relative !important;
    max-width: 90% !important;
    max-height: 90% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: white !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

/* 图片容器 */
.image-lightbox-image-container {
    position: relative !important;
    width: 100% !important;
    max-width: 800px !important;
    max-height: 600px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background: #f5f5f5 !important;
}

/* 主图片 */
.image-lightbox-image {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

/* 图片标题 */
.image-lightbox-title {
    padding: 15px 20px !important;
    background: white !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    text-align: center !important;
    border-top: 1px solid #eee !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 关闭按钮 */
.image-lightbox-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 35px !important;
    height: 35px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 18px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
    z-index: 10 !important;
}

.image-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9) !important;
}

/* 导航按钮 */
.image-lightbox-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 50px !important;
    height: 50px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 20px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
    z-index: 10 !important;
}

.image-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.9) !important;
}

.image-lightbox-nav.disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

.image-lightbox-prev {
    left: 15px !important;
}

.image-lightbox-next {
    right: 15px !important;
}

/* 图片计数器 */
.image-lightbox-counter {
    position: absolute !important;
    bottom: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    padding: 5px 12px !important;
    border-radius: 15px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

/* 手机端优化 */
@media (max-width: 768px) {
    .image-lightbox-content {
        max-width: 95% !important;
        max-height: 95% !important;
    }
    
    .image-lightbox-image-container {
        max-height: 70vh !important;
    }
    
    .image-lightbox-title {
        padding: 12px 15px !important;
        font-size: 14px !important;
    }
    
    .image-lightbox-close {
        width: 30px !important;
        height: 30px !important;
        top: 10px !important;
        right: 10px !important;
        font-size: 16px !important;
    }
    
    .image-lightbox-nav {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }
    
    .image-lightbox-prev {
        left: 10px !important;
    }
    
    .image-lightbox-next {
        right: 10px !important;
    }
    
    .image-lightbox-counter {
        bottom: 10px !important;
        font-size: 11px !important;
        padding: 4px 10px !important;
    }
}

