/**
 * Smart Finance Hub - Image Styling and Optimization
 * Handles responsive images, lazy loading effects, and visual enhancements
 */

/* ==========================================================================
   Base Image Styles
   ========================================================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Image transitions */
.featured-image, .content-image, .team-photo, .sidebar-image, .ad-image {
    transition: opacity 0.3s ease-in-out;
    opacity: 1;
}

/* Lazy loading images (if enabled) */
.lazy-image {
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Responsive images */
.responsive-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Image placeholders */
.placeholder {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* ==========================================================================
   Hero Section Images
   ========================================================================== */

.hero {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    z-index: 1;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ==========================================================================
   Featured Article Images
   ========================================================================== */

.featured-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.article-card .featured-image {
    height: 200px;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   In-Content Images
   ========================================================================== */

.content-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    margin: 2rem auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-image.left {
    float: left;
    margin: 1rem 2rem 1rem 0;
    max-width: 300px;
}

.content-image.right {
    float: right;
    margin: 1rem 0 1rem 2rem;
    max-width: 300px;
}

.content-image.center {
    display: block;
    margin: 2rem auto;
}

/* Image captions */
.image-caption {
    text-align: center;
    font-size: 0.9rem;
    color: #718096;
    font-style: italic;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Financial Charts and Graphics
   ========================================================================== */

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.chart-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    text-align: center;
}

/* ==========================================================================
   Sidebar Images and Icons
   ========================================================================== */

.sidebar-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.financial-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.icon-item {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.icon-item:hover {
    transform: translateY(-2px);
}

.icon-item img {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
}

.icon-label {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
}

/* ==========================================================================
   Team Photos and Profile Images
   ========================================================================== */

.team-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

/* ==========================================================================
   Advertisement and CTA Images
   ========================================================================== */

.ad-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.ad-image:hover {
    transform: scale(1.02);
}

.cta-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 12px;
    margin: 2rem auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Background Patterns and Decorative Elements
   ========================================================================== */

.pattern-overlay {
    position: relative;
}

.pattern-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.1) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
}

/* Financial gradient backgrounds */
.bg-financial-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-success-gradient {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.bg-warning-gradient {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* ==========================================================================
   Loading States and Animations
   ========================================================================== */

.image-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .featured-image {
        height: 200px;
    }
    
    .content-image.left,
    .content-image.right {
        float: none;
        margin: 1rem auto;
        max-width: 100%;
    }
    
    .team-photo {
        width: 100px;
        height: 100px;
    }
    
    .chart-container {
        padding: 1rem;
    }
    
    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .featured-image {
        height: 150px;
        border-radius: 8px;
    }
    
    .sidebar-image {
        height: 150px;
    }
    
    .ad-image {
        height: 200px;
    }
    
    .icon-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .lazy-image,
    .responsive-image {
        opacity: 1 !important;
    }
    
    .hero-background,
    .ad-image {
        display: none;
    }
    
    .featured-image,
    .content-image {
        break-inside: avoid;
        max-width: 100%;
        height: auto;
    }
}