/* Professional Image Loading System */

/* Image Loading Container */
.image-loading-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Loading Skeleton */
.image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    z-index: 1;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Image Loading Spinner */
.image-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Image Loading Progress */
.image-loading-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(59, 130, 246, 0.1);
    z-index: 2;
}

.image-loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #1E3A8A);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 0 3px 3px 0;
}

/* Professional Image Overlay */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            rgba(0, 0, 0, 0.4) 0%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.6) 100%);
    z-index: 3;
    transition: opacity 0.3s ease;
}

.image-overlay:hover {
    opacity: 0.8;
}

/* Text Visibility Enhancements */
.image-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    z-index: 4;
    padding: 2rem;
}

.image-text-overlay h1,
.image-text-overlay h2,
.image-text-overlay h3,
.image-text-overlay h4,
.image-text-overlay h5,
.image-text-overlay h6 {
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    font-weight: 700;
    margin-bottom: 1rem;
}

.image-text-overlay p {
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    line-height: 1.6;
}

/* Professional Image Styling */
.professional-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
    opacity: 0;
}

.professional-image.loaded {
    opacity: 1;
    transform: scale(1.02);
}

.professional-image.error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Hero Section Image Loading */
.hero-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.8s ease;
    opacity: 0;
    transform: scale(1.1);
}

.hero-image.loaded {
    opacity: 1;
    transform: scale(1);
}

.hero-image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    background-size: 200% 200%;
    animation: hero-skeleton-loading 2s infinite;
}

@keyframes hero-skeleton-loading {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Service Card Image Loading */
.service-card-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.service-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
    opacity: 0;
}

.service-card-image.loaded {
    opacity: 1;
}

/* Gallery Image Loading */
.gallery-image-container {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-image-container:hover {
    transform: translateY(-5px);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
    opacity: 1;
}

.gallery-image.loading {
    opacity: 0;
}

.gallery-image.loaded {
    opacity: 1;
}

/* Image Loading States */
.image-loading-container.loading .image-skeleton {
    display: block;
}

.image-loading-container.loading .image-loading-spinner {
    display: block;
}

.image-loading-container.loaded .image-skeleton,
.image-loading-container.loaded .image-loading-spinner {
    display: none;
}

.image-loading-container.error .image-skeleton,
.image-loading-container.error .image-loading-spinner {
    display: none;
}

/* Responsive Image Loading */
@media (max-width: 768px) {
    .image-text-overlay {
        padding: 1rem;
    }

    .image-text-overlay h1 {
        font-size: 1.5rem;
    }

    .image-text-overlay h2 {
        font-size: 1.25rem;
    }

    .image-text-overlay p {
        font-size: 0.9rem;
    }

    .service-card-image-container {
        height: 150px;
    }

    .gallery-image-container {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .image-text-overlay {
        padding: 0.75rem;
    }

    .image-text-overlay h1 {
        font-size: 1.25rem;
    }

    .image-text-overlay h2 {
        font-size: 1.1rem;
    }

    .image-text-overlay p {
        font-size: 0.85rem;
    }

    .service-card-image-container {
        height: 120px;
    }

    .gallery-image-container {
        height: 150px;
    }
}

/* Image Loading Performance */
.image-loading-container {
    will-change: transform;
}

.professional-image {
    will-change: opacity, transform;
}

.hero-image {
    will-change: opacity, transform;
}

/* Image Loading Accessibility */
.image-loading-container:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.image-loading-container[aria-label] {
    cursor: pointer;
}

/* Image Loading Error State */
.image-error-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6B7280;
    z-index: 2;
}

.image-error-fallback i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #9CA3AF;
}

.image-error-fallback p {
    font-size: 0.9rem;
    margin: 0;
}