/* Image Optimization and Display Styles */

/* Background Images */
.hero-section,
.dashboard-header,
.profile-header,
.support-header,
.workflow-header,
.reports-header,
.demo-users-card,
.register-container {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    position: relative;
}

/* Lazy Loading for Images */
img {
    loading: lazy;
    max-width: 100%;
    height: auto;
}

/* Avatar Images */
.profile-avatar,
.message-avatar {
    background-size: cover !important;
    background-position: center !important;
    overflow: hidden;
}

/* Image Overlays for Better Text Readability */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.image-content {
    position: relative;
    z-index: 2;
}

/* Responsive Images */
@media (max-width: 768px) {
    .hero-section,
    .dashboard-header,
    .profile-header {
        background-attachment: scroll !important;
    }
}

/* Image Loading States */
.image-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;
    }
}

/* Optimized Background Patterns */
.pattern-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    pointer-events: none;
}

/* Service Card Icons with Images */
.service-icon {
    background-size: 60% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Ensure Proper Contrast */
.hero-section h1,
.hero-section p,
.dashboard-header h2,
.profile-header h1,
.support-header h2,
.workflow-header h2,
.reports-header h2 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Image Accessibility */
img[alt] {
    border: none;
}

img:not([alt]) {
    outline: 2px solid red;
}

/* Performance Optimization */
.blur-load {
    filter: blur(5px);
    transition: filter 0.3s;
}

.blur-load.loaded {
    filter: blur(0);
}

/* Card Images */
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

/* Icon Backgrounds */
.icon-bg {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

/* Optimize Images for Print */
@media print {
    .hero-section,
    .dashboard-header,
    .profile-header,
    .support-header,
    .workflow-header,
    .reports-header {
        background-image: none !important;
        background-color: #f5f5f5 !important;
    }
}

/* Fallback Colors When Images Don't Load */
.hero-section {
    background-color: #1b4332;
}

.dashboard-header {
    background-color: #f093fb;
}

.profile-header {
    background-color: #667eea;
}

.support-header {
    background-color: #2d6a4f;
}

.workflow-header {
    background-color: #4facfe;
}

.reports-header {
    background-color: #43e97b;
}

/* Image Gallery Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.image-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.image-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ensure Background Images are Visible */
[style*="background-image"] {
    min-height: 200px;
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Use higher resolution images for retina displays if available */
    .hero-section,
    .dashboard-header {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}