/* 
 * 商品图片显示强制修复样式
 * 使用最高优先级选择器强制修复所有商品图片显示问题
 * 这个文件将在所有其他CSS之后加载，确保样式生效
 */

/* ===== 最高优先级强制修复 - 使用ID选择器提高优先级 ===== */

/* 通用商品图片容器强制修复 */
html body .product-card .product-card__image,
html body .recommended-products .product-card .product-card__image,
html body .woocommerce .product-card .product-card__image,
html body .products-grid .product-card .product-card__image,
html body .shop-products .product-card .product-card__image,
html body .woocommerce ul.products li.product .product-card__image,
html body .woocommerce-page .product-card__image,
html body div.product-card div.product-card__image {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 75% !important; /* 4:3 比例 */
    overflow: hidden !important;
    background-color: #f8f9fa !important;
    display: block !important;
    border-radius: 12px 12px 0 0 !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
}

/* 现代浏览器支持aspect-ratio */
@supports (aspect-ratio: 4/3) {
    html body .product-card .product-card__image,
    html body .recommended-products .product-card .product-card__image,
    html body .woocommerce .product-card .product-card__image,
    html body .products-grid .product-card .product-card__image,
    html body .shop-products .product-card .product-card__image,
    html body .woocommerce ul.products li.product .product-card__image,
    html body .woocommerce-page .product-card__image,
    html body div.product-card div.product-card__image {
        height: auto !important;
        padding-bottom: 0 !important;
        aspect-ratio: 4/3 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* 商品图片强制修复 */
html body .product-card .product-card__image img,
html body .recommended-products .product-card .product-card__image img,
html body .woocommerce .product-card .product-card__image img,
html body .products-grid .product-card .product-card__image img,
html body .shop-products .product-card .product-card__image img,
html body .woocommerce ul.products li.product .product-card__image img,
html body .woocommerce-page .product-card__image img,
html body div.product-card div.product-card__image img,
html body .woocommerce ul.products li.product img,
html body .woocommerce ul.products li.product .attachment-woocommerce_thumbnail,
html body .woocommerce ul.products li.product .wp-post-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border: none !important;
    outline: none !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: top !important;
    transition: transform 0.3s ease !important;
}

/* 现代浏览器中的图片定位 */
@supports (aspect-ratio: 4/3) {
    html body .product-card .product-card__image img,
    html body .recommended-products .product-card .product-card__image img,
    html body .woocommerce .product-card .product-card__image img,
    html body .products-grid .product-card .product-card__image img,
    html body .shop-products .product-card .product-card__image img,
    html body .woocommerce ul.products li.product .product-card__image img,
    html body .woocommerce-page .product-card__image img,
    html body div.product-card div.product-card__image img {
        position: static !important;
        top: auto !important;
        left: auto !important;
    }
}

/* 链接包装器强制修复 */
html body .product-card .product-card__image a,
html body .recommended-products .product-card .product-card__image a,
html body .woocommerce .product-card .product-card__image a,
html body .products-grid .product-card .product-card__image a,
html body .shop-products .product-card .product-card__image a,
html body .woocommerce ul.products li.product a,
html body .woocommerce ul.products li.product .woocommerce-loop-product__link,
html body div.product-card div.product-card__image a {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    line-height: 0 !important;
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
    z-index: 1 !important;
}

/* 现代浏览器中的链接定位 */
@supports (aspect-ratio: 4/3) {
    html body .product-card .product-card__image a,
    html body .recommended-products .product-card .product-card__image a,
    html body .woocommerce .product-card .product-card__image a,
    html body .products-grid .product-card .product-card__image a,
    html body .shop-products .product-card .product-card__image a,
    html body div.product-card div.product-card__image a {
        position: static !important;
        top: auto !important;
        left: auto !important;
    }
}

/* 悬停效果 */
html body .product-card:hover .product-card__image img,
html body .recommended-products .product-card:hover .product-card__image img,
html body .woocommerce .product-card:hover .product-card__image img,
html body .products-grid .product-card:hover .product-card__image img,
html body .shop-products .product-card:hover .product-card__image img {
    transform: scale(1.05) !important;
}

/* 商品标签定位 */
/* html body .product-card .product-card__badge,
html body .recommended-products .product-card .product-card__badge,
html body .woocommerce .product-card .product-card__badge,
html body .products-grid .product-card .product-card__badge,
html body .shop-products .product-card .product-card__badge {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 10 !important;
    background-color: var(--color-primary, #dc3545) !important;
    color: white !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 20px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
} */

/* WooCommerce特定修复 */
html body.woocommerce ul.products,
html body.woocommerce-page ul.products {
    display: block !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

html body.woocommerce ul.products li.product,
html body.woocommerce-page ul.products li.product {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
    display: block !important;
}

/* 响应式设计强制修复 */
@media (max-width: 1024px) {
    html body .product-card .product-card__image,
    html body .recommended-products .product-card .product-card__image,
    html body .woocommerce .product-card .product-card__image,
    html body .products-grid .product-card .product-card__image,
    html body .shop-products .product-card .product-card__image {
        min-height: 220px !important;
    }
}

@media (max-width: 768px) {
    html body .product-card .product-card__image,
    html body .recommended-products .product-card .product-card__image,
    html body .woocommerce .product-card .product-card__image,
    html body .products-grid .product-card .product-card__image,
    html body .shop-products .product-card .product-card__image {
        min-height: 200px !important;
    }
}

@media (max-width: 480px) {
    html body .product-card .product-card__image,
    html body .recommended-products .product-card .product-card__image,
    html body .woocommerce .product-card .product-card__image,
    html body .products-grid .product-card .product-card__image,
    html body .shop-products .product-card .product-card__image {
        min-height: 180px !important;
    }
}

/* 确保商品卡片本身的样式 */
html body .product-card,
html body .recommended-products .product-card,
html body .woocommerce .product-card,
html body .products-grid .product-card,
html body .shop-products .product-card {
    background-color: white !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
    display: block !important;
    position: relative !important;
}

html body .product-card:hover,
html body .recommended-products .product-card:hover,
html body .woocommerce .product-card:hover,
html body .products-grid .product-card:hover,
html body .shop-products .product-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}
