/**
 * 代客下单商品网格 — 与 order.html 同款，H5 / PC 共用
 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.product-grid.product-grid--pc {
    gap: 10px;
    padding: 10px;
    align-items: start;
    align-content: start;
    grid-auto-rows: var(--pc-card-size, 100px);
}

.product-grid--pc .product-card {
    border-radius: 10px;
    width: 100%;
    height: var(--pc-card-size, auto);
    aspect-ratio: unset;
    max-height: var(--pc-card-size, none);
}

.product-card {
    aspect-ratio: 1 / 1;
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    user-select: none;
    min-width: 0;
    width: 100%;
}

@supports not (aspect-ratio: 1 / 1) {
    .product-card::before {
        content: '';
        display: block;
        padding-top: 100%;
    }
}

.product-card .product-img,
.product-card > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

.product-card .product-img-placeholder {
    position: absolute;
    inset: 0;
    background: #f3f4f6;
}

.product-name-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: block;
    padding: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    text-align: center;
    line-height: 1;
}

.product-name {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1;
    display: block;
    padding: 0 4px;
    margin: 0;
}

.product-grid--pc .product-name {
    font-size: 14px;
    padding: 0 6px;
}

.price-tag {
    position: absolute;
    top: 0;
    left: 0;
    background: #ef4444;
    color: #fff;
    font-size: 13px;
    padding: 3px 8px;
    border-bottom-right-radius: 8px;
    z-index: 10;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
}

.product-grid--pc .price-tag {
    font-size: clamp(9px, calc(var(--pc-card-size, 100px) * 0.12), 22px);
    padding: clamp(2px, calc(var(--pc-card-size, 100px) * 0.03), 6px) clamp(5px, calc(var(--pc-card-size, 100px) * 0.08), 14px);
    border-bottom-right-radius: clamp(6px, calc(var(--pc-card-size, 100px) * 0.08), 12px);
}

.price-tag-by-piece {
    background: #f97316;
}

.price-tag.hidden {
    display: none;
}

.count-tag {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: #fff;
    font-size: 20px;
    min-width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-weight: bold;
    padding: 0 4px;
}

.product-grid--pc .count-tag {
    top: clamp(3px, calc(var(--pc-card-size, 100px) * 0.04), 8px);
    right: clamp(3px, calc(var(--pc-card-size, 100px) * 0.04), 8px);
    font-size: clamp(11px, calc(var(--pc-card-size, 100px) * 0.2), 28px);
    min-width: clamp(22px, calc(var(--pc-card-size, 100px) * 0.34), 52px);
    height: clamp(22px, calc(var(--pc-card-size, 100px) * 0.34), 52px);
    border-radius: 999px;
}

.count-tag.hidden {
    display: none;
}
