/* CSS for image placeholders */

/* General image placeholder styles */
img {
    /* Prevent broken image icon */
    position: relative;
    min-height: 100px;
}

/* Product images in admin panel */
.product-image,
.news-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    display: block;
}

/* Product cards */
.product-card img,
.product-card-new img,
.product-image-new img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    display: block;
}

/* News cards */
.news-card img,
.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    display: block;
}

/* Product detail images */
.product-detail-image,
#main-product-image {
    width: 100%;
    max-width: 600px;
    height: 400px;
    object-fit: contain;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    display: block;
}

/* Thumbnails */
.thumbnail-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: border-color 0.3s;
}

.thumbnail-item:hover img {
    border-color: #0066cc;
}

/* Loading state for images */
img.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Hide alt text when image fails to load */
img:not([src]),
img[src=""],
img:not([src]):not([srcset]) {
    visibility: hidden;
}

/* Better placeholder display */
img::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
}

img::after {
    content: "No Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* Specific styles for different pages */

/* Admin products table */
#productsTableBody img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

/* Admin news table */
#newsTableBody img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

/* Products grid */
.products-grid img,
.products-grid-new img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* News grid */
.news-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Ensure minimum dimensions */
img[src*="no-image"] {
    min-width: 100px;
    min-height: 100px;
}
