/**
 * Weldor Image Placeholder Styles
 * Enhanced styling for placeholder images and loading states
 */

/* Placeholder image containers */
.weldor-placeholder {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    position: relative;
    overflow: hidden;
}

.weldor-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Image loading states */
.image-loading {
    opacity: 0.7;
    position: relative;
}

.image-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: loading-sweep 1.5s infinite;
}

@keyframes loading-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.image-loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.image-error {
    opacity: 0.8;
    filter: grayscale(30%);
    border: 2px dashed #ffc107;
    background-color: #fff3cd;
}

/* Lazy loading styles */
.lazy-load {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.lazy-loaded {
    opacity: 1;
}

/* Product image specific styles */
.product-image .weldor-placeholder,
.product-slider-img .weldor-placeholder {
    min-height: 200px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.main-product-image .weldor-placeholder {
    min-height: 400px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Client logo placeholder styles */
.client-logo .weldor-placeholder {
    min-height: 80px;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
}

/* Category placeholder styles */
.category-image .weldor-placeholder {
    min-height: 250px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Admin form placeholder styles */
.placeholder-preview {
    text-align: center;
    padding: 30px 20px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.placeholder-preview:hover {
    border-color: #adb5bd;
    background-color: #e9ecef;
}

.placeholder-preview img {
    max-width: 100%;
    height: auto;
    opacity: 0.7;
}

.placeholder-preview p {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Thumbnail placeholder styles */
.thumbnail-image.weldor-placeholder {
    min-height: 80px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .weldor-placeholder {
        min-height: 120px;
    }
    
    .main-product-image .weldor-placeholder {
        min-height: 250px;
    }
    
    .product-image .weldor-placeholder,
    .product-slider-img .weldor-placeholder {
        min-height: 150px;
    }
}

/* SVG placeholder styling */
.weldor-placeholder svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* Hover effects for interactive placeholders */
.product-card:hover .weldor-placeholder,
.product-slider-card:hover .weldor-placeholder {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Focus states for accessibility */
.weldor-placeholder:focus,
img:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .weldor-placeholder::before,
    .image-loading::after {
        display: none;
    }
    
    .weldor-placeholder {
        background-color: #f8f9fa !important;
        border: 1px solid #000 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .weldor-placeholder {
        border: 2px solid #000;
        background-color: #fff;
    }
    
    .image-error {
        border: 2px solid #ff0000;
        background-color: #ffeeee;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .weldor-placeholder::before,
    .image-loading::after,
    .lazy-load,
    .lazy-loaded,
    .image-loaded {
        animation: none;
        transition: none;
    }
}