/* Global Image Fit Fix - Ensures all images fit within their containers */

/* Fix for background images to use contain instead of cover */
.bg-image-fix,
[style*="background-size: cover"] {
    background-size: contain !important;
    background-repeat: no-repeat !important;
}

/* Fix for img elements to use contain instead of cover */
img[style*="object-fit: cover"] {
    object-fit: contain !important;
}

/* Global fix for any element with object-fit cover */
[style*="object-fit: cover"] {
    object-fit: contain !important;
}

/* Common image container classes that should use contain */
.image-container img,
.product-image img,
.store-logo img,
.banner-image img,
.main-image-container img,
.additional-image-container img,
.promotion-picture img,
.lucky-draw-picture img {
    object-fit: contain !important;
}

/* Fix for product grid images */
.product-grid img {
    object-fit: contain !important;
}

/* Fix for card images */
.card-img-top img,
.card img {
    object-fit: contain !important;
}

/* Fix for avatar and profile images */
.avatar img,
.profile img {
    object-fit: contain !important;
}

/* Fix for dropzone thumbnails */
.dz-thumbnail,
.dropzone img {
    object-fit: contain !important;
}

/* Ensure images in lists don't overflow */
.img-fluid {
    object-fit: contain !important;
}

/* Fix for any image with fixed dimensions */
img[style*="width:"][style*="height:"] {
    object-fit: contain !important;
}

/* Background image fixes for common containers */
.banner-preview,
.logo-preview,
.image-preview,
[id*="Preview"],
[id*="preview"] {
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Responsive image containers */
.responsive-image-container {
    position: relative;
    overflow: hidden;
}

.responsive-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
}

/* Video elements should also use contain */
video {
    object-fit: contain !important;
}

/* UNIFIED UPLOAD CONTAINER STYLING - Ensures all upload boxes have consistent sizing */

/* Main image upload containers */
.main-image-container {
    width: 100%;
    height: 180px !important;
    position: relative;
    border: 2px dashed #ccc;
    background-color: #f8f9fa !important;
    box-shadow: 2px 4px 4px #00000040;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    min-width: unset !important;
    top: 0 !important;
}

.main-image-container img {
    width: 100%;
    height: 180px !important;
    object-fit: contain !important;
    display: none;
}

/* Additional image upload containers */
.additional-image-container {
    width: 100%;
    height: 180px !important;
    position: relative;
    border: 2px dashed #ccc;
    background-color: #f8f9fa !important;
    box-shadow: 2px 4px 4px #00000040;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
}

.additional-image-container img {
    width: 100%;
    height: 180px !important;
    object-fit: contain !important;
    display: none;
}

/* Video upload containers */
.main-video-container {
    width: 100%;
    height: 180px !important;
    position: relative;
    border: 2px dashed #ccc;
    background-color: #f8f9fa !important;
    box-shadow: 2px 4px 4px #00000040;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
}

.main-video-container video {
    width: 100%;
    height: 180px !important;
    object-fit: contain !important;
    display: none;
}

/* Free gift upload containers */
.free-gift-picture {
    width: 100%;
    height: 180px !important;
    position: relative;
    border: 2px dashed #ccc;
    background-color: #f8f9fa !important;
    box-shadow: 2px 4px 4px #00000040;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
}

.free-gift-picture img {
    width: 100%;
    height: 180px !important;
    object-fit: contain !important;
    display: none;
}

/* Overlay icons styling for upload containers */
.overlay-icons {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 10px;
}

.overlay-icons i {
    font-size: 20px;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px;
    border-radius: 50%;
    cursor: pointer;
}

/* Icon overlay for uploading */
.icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #ffffff;
}

.icon-overlay i {
    cursor: pointer;
}

/* Hide file input */
input[type="file"] {
    display: none;
}

/* Ensure grid layout consistency */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* For 2x3 grid layout specifically */
.upload-grid-2x3 .col-6 {
    width: 50% !important;
    padding-right: 7.5px;
    padding-left: 7.5px;
}

/* Ensure all upload containers maintain aspect ratio */
.main-image-container,
.additional-image-container,
.main-video-container,
.free-gift-picture {
    aspect-ratio: unset !important;
} 