/* Shared wrapper styles */
.amz-image-wrapper {
    margin: 0 auto 20px auto;
    border: 2px solid #999;
    border-radius: 5px;
    background: #fff;
    overflow: hidden;
    position: relative;
    text-align: center;
}

/* Size variants */
.amz-image-wrapper.size-l {
    width: 500px;
    height: 500px;
}
.amz-image-wrapper.size-m {
    width: 160px;
    height: 160px;
}

/* No-border variant */
.amz-image-wrapper.no-border {
    border: none;
}

/* Image scaling */
.amz-image-wrapper.size-l img {
    max-width: 100%;
    max-height: calc(100% - 70px); /* leave room for button */
    height: auto;
    width: auto;
    margin: 0 auto;
    display: block;
    object-fit: contain;
}

.amz-image-wrapper.size-m img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Button inside box */
.amz-button {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.check-price-btn, .buy-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #ff9600;
    color: #000;
    text-decoration: none!important;
    border-radius: 4px;
    font-weight: bold;
    min-width: 140px;
    text-align: center;
}
.check-price-btn:hover, .buy-btn:hover {
    background: #e68a00;
}

/* Discount ribbon */
.discount-ribbon {
    position: absolute;
    top: 40px;
    left: -5px;
    background: #DC0E40;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: rotate(-45deg);
    transform-origin: top left;
    z-index: 3;
}

/* Mobile Safari fix */
@media (max-width: 640px) {
    .amz-image-wrapper.size-l {
        width: 90vw;
        height: 90vw;
    }
    .amz-image-wrapper.size-l img {
        max-height: calc(100% - 60px); /* reserve less space on mobile */
    }
    .amz-button {
        bottom: 10px;
    }
}
