/* =============================================================================
   PROFESSIONAL IMAGE ALIGNMENT AND OPTIMIZATION
   ============================================================================= */

/* Base Image Styles */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Image Container Base */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Aspect Ratio Containers */
.aspect-ratio-16-9 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 */
    overflow: hidden;
    border-radius: 12px;
}

.aspect-ratio-4-3 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 */
    overflow: hidden;
    border-radius: 12px;
}

.aspect-ratio-1-1 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 Square */
    overflow: hidden;
    border-radius: 12px;
}

.aspect-ratio-3-2 {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* 3:2 */
    overflow: hidden;
    border-radius: 12px;
}

/* Image inside aspect ratio containers */
.aspect-ratio-16-9 img,
.aspect-ratio-4-3 img,
.aspect-ratio-1-1 img,
.aspect-ratio-3-2 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 0;
    transition: transform 0.3s ease;
}

/* Hover Effects for Images */
.image-container:hover img,
.aspect-ratio-16-9:hover img,
.aspect-ratio-4-3:hover img,
.aspect-ratio-1-1:hover img,
.aspect-ratio-3-2:hover img {
    transform: scale(1.05);
}

/* Image Overlay Effects */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.8) 0%,
        rgba(147, 51, 234, 0.8) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.image-container:hover .image-overlay {
    opacity: 1;
}

.image-overlay-content {
    text-align: center;
    color: white;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.image-container:hover .image-overlay-content {
    transform: translateY(0);
}

/* Professional Image Grid */
.image-grid {
    display: grid;
    gap: 20px;
    margin: 30px 0;
}

.image-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.image-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.image-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.image-grid-masonry {
    column-count: 3;
    column-gap: 20px;
}

.image-grid-masonry .image-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

/* Featured Image Styles */
.featured-image {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin: 30px 0;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}

.featured-image:hover img {
    transform: scale(1.1);
}

.featured-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 40px 30px 30px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.featured-image:hover .featured-image-caption {
    transform: translateY(0);
}

/* Gallery Styles */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay i {
    color: white;
    font-size: 2rem;
}

/* Thumbnail Navigation */
.thumbnail-nav {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.thumbnail-nav img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail-nav img:hover,
.thumbnail-nav img.active {
    opacity: 1;
    border-color: #3b82f6;
    transform: scale(1.1);
}

/* Lazy Loading Placeholder */
.lazy-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 200px;
    border-radius: 12px;
}

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

.lazy-image.loaded {
    animation: none;
    background: none;
}

/* Image Zoom Effect */
.image-zoom {
    position: relative;
    overflow: hidden;
    cursor: zoom-in;
}

.image-zoom img {
    transition: transform 0.3s ease;
}

.image-zoom:hover img {
    transform: scale(1.2);
}

/* Image Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: #3b82f6;
}

/* Image Filters */
.image-filter-grayscale {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.image-filter-grayscale:hover {
    filter: grayscale(0%);
}

.image-filter-sepia {
    filter: sepia(100%);
    transition: filter 0.3s ease;
}

.image-filter-sepia:hover {
    filter: sepia(0%);
}

.image-filter-blur {
    filter: blur(2px);
    transition: filter 0.3s ease;
}

.image-filter-blur:hover {
    filter: blur(0px);
}

/* Professional Card Image Styles */
.card-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    height: 200px;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    border-radius: 0;
}

.card-image-container:hover img {
    transform: scale(1.05);
}

.card-image-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Logo and Brand Image Styles */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.logo-container img {
    max-height: 50px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo-container:hover img {
    transform: scale(1.1);
}

/* Avatar and Profile Images */
.avatar {
    border-radius: 50%;
    border: 3px solid #e5e7eb;
    transition: all 0.3s ease;
}

.avatar:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.avatar-sm { width: 40px; height: 40px; }
.avatar-md { width: 60px; height: 60px; }
.avatar-lg { width: 80px; height: 80px; }
.avatar-xl { width: 120px; height: 120px; }

/* Background Images */
.bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.bg-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.bg-image > * {
    position: relative;
    z-index: 2;
}

/* =============================================================================
   RESPONSIVE IMAGE STYLES
   ============================================================================= */

/* Tablet Styles */
@media (max-width: 1024px) {
    .image-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .image-grid-masonry {
        column-count: 2;
    }
    
    .featured-image {
        height: 300px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .image-grid-2,
    .image-grid-3,
    .image-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .image-grid-masonry {
        column-count: 2;
        column-gap: 15px;
    }
    
    .featured-image {
        height: 250px;
        border-radius: 12px;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .thumbnail-nav img {
        width: 50px;
        height: 50px;
    }
    
    .card-image-container {
        height: 180px;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .image-grid-2,
    .image-grid-3,
    .image-grid-4 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .image-grid-masonry {
        column-count: 1;
    }
    
    .featured-image {
        height: 200px;
        margin: 20px 0;
    }
    
    .gallery-item img {
        height: 120px;
    }
    
    .thumbnail-nav {
        gap: 8px;
    }
    
    .thumbnail-nav img {
        width: 40px;
        height: 40px;
    }
    
    .card-image-container {
        height: 160px;
    }
    
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
}

/* High DPI Display Optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .image-container,
    .featured-image,
    .gallery-item {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .image-overlay,
    .gallery-item-overlay,
    .lightbox {
        display: none !important;
    }
    
    .image-container,
    .featured-image,
    .gallery-item {
        break-inside: avoid;
        box-shadow: none;
    }
    
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .image-container,
    .featured-image,
    .gallery-item,
    .thumbnail-nav img,
    img {
        transition: none !important;
        animation: none !important;
    }
    
    .image-container:hover,
    .featured-image:hover,
    .gallery-item:hover {
        transform: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .image-container {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .image-container:hover {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    }
    
    .thumbnail-nav img {
        border-color: #374151;
    }
    
    .thumbnail-nav img:hover,
    .thumbnail-nav img.active {
        border-color: #60a5fa;
    }
    
    .card-image-badge {
        background: rgba(96, 165, 250, 0.9);
    }
    
    .avatar {
        border-color: #374151;
    }
    
    .avatar:hover {
        border-color: #60a5fa;
    }
}

