.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Square aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease-in-out;
}

.product-image.lazyload,
.product-image.lazyloading {
    opacity: 0;
}

.product-image.lazyloaded {
    opacity: 1;
}

.fallback-image {
    opacity: 0.7;
    filter: grayscale(50%);
    border: 1px dashed #ccc;
    background-color: #f8f9fa;
}

.fallback-image:hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

/* Product Image Upload */
.product-images-upload {
    margin: 1rem 0;
}

.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #eee;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8f9fa;
    padding: 0.5rem;
}

.image-preview-item .image-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.image-preview-item .image-actions button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    padding: 0;
}

.image-preview-item .image-actions button:hover {
    background: white;
    color: #333;
}

.image-preview-item .image-actions .delete-image {
    color: #dc3545;
}

.image-preview-item .image-actions .set-main {
    color: #28a745;
}

.image-preview-item.is-main {
    border-color: #28a745;
}

.image-preview-item.is-main::after {
    content: '✓';
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.image-upload-controls {
    text-align: center;
}

.image-upload-controls .help-text {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.875rem;
}

/* Loading states */
.loading .product-images-upload {
    opacity: 0.5;
    pointer-events: none;
}

/* Error states */
.image-preview-item.has-error {
    border-color: #dc3545;
}

.image-preview-item.has-error::after {
    content: '!';
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}